From 0791cdbcfc231bc55e5277d94398953e4180bed3 Mon Sep 17 00:00:00 2001 From: John Kitchin Date: Sat, 14 Mar 2015 18:03:23 -0400 Subject: [PATCH] updated my customized helm-bibtex formatter helm-bibtex changed its interface. this seems to work with a new helm-bibtex. --- org-ref.org | 34 +++++++++++++++++++--------------- 1 file changed, 19 insertions(+), 15 deletions(-) diff --git a/org-ref.org b/org-ref.org index f9bc3ad..6d69a14 100644 --- a/org-ref.org +++ b/org-ref.org @@ -3422,22 +3422,26 @@ Next, we are going to add keywords to the helm interface. This modifies the helm (defun helm-bibtex-candidates-formatter (candidates source) "Formats BibTeX entries for display in results list." (cl-loop - with width = (with-helm-window (window-width)) - for entry in candidates - for entry = (cdr entry) - for entry-key = (helm-bibtex-get-value entry 'entry-key) - for fields = (--map (helm-bibtex-clean-string - (helm-bibtex-get-value entry it " ")) - '(author title year has-pdf has-note entry-type)) - for fields = (-update-at 0 'helm-bibtex-shorten-authors fields) - for fields = (append fields - (list (or (helm-bibtex-get-value entry 'keywords) + with width = (with-helm-window (helm-bibtex-window-width)) + for entry in candidates + for entry = (cdr entry) + for entry-key = (helm-bibtex-get-value "=key=" entry) + if (assoc-string "author" entry 'case-fold) + for fields = '("author" "title" "year" "=has-pdf=" "=has-note=" "=type=") + else + for fields = '("editor" "title" "year" "=has-pdf=" "=has-note=" "=type=") + for fields = (--map (helm-bibtex-clean-string + (helm-bibtex-get-value it entry " ")) + fields) + for fields = (-update-at 0 'helm-bibtex-shorten-authors fields) + for fields = (append fields + (list (or (helm-bibtex-get-value "keywords" entry) "" ))) - collect - (cons (s-format "$0 $1 $2 $3 $4$5 $6" 'elt - (-zip-with (lambda (f w) (truncate-string-to-width f w 0 ?\s)) - fields (list 36 (- width 85) 4 1 1 7 7))) - entry-key))) + collect + (cons (s-format "$0 $1 $2 $3 $4$5 $6" 'elt + (-zip-with (lambda (f w) (truncate-string-to-width f w 0 ?\s)) + fields (list 36 (- width 85) 4 1 1 7 7))) + entry-key))) #+END_SRC Next, we add some functions to add keywords to a bibtex entry using a helm interface, and a new action to add keywords to entries from helm-bibtex. -- 2.39.2