update packages
This commit is contained in:
@@ -4,8 +4,8 @@
|
||||
;; Justin Burkett <justin@burkett.cc>
|
||||
;; Maintainer: Titus von der Malsburg <malsburg@posteo.de>
|
||||
;; URL: https://github.com/tmalsburg/helm-bibtex
|
||||
;; Package-Version: 20200908.1017
|
||||
;; Package-Commit: 1bb81d77e08296a50de7ebfe5cf5b0c715b7f3d6
|
||||
;; Package-Version: 20211019.1306
|
||||
;; Package-Commit: aa775340ba691d2322948bfdc6a88158568a1399
|
||||
;; Version: 1.0.0
|
||||
;; Package-Requires: ((parsebib "1.0") (s "1.9.0") (dash "2.6.0") (f "0.16.2") (cl-lib "0.5") (biblio "0.2") (emacs "26.1"))
|
||||
|
||||
@@ -70,6 +70,8 @@ different name, use a cons cell `(\"orgfile.org\" . \"bibfile.bib\")' instead."
|
||||
:group 'bibtex-completion
|
||||
:type '(choice file (repeat file)))
|
||||
|
||||
;;;###autoload (put 'bibtex-completion-bibliography 'safe-local-variable 'stringp)
|
||||
|
||||
(defcustom bibtex-completion-library-path nil
|
||||
"A directory or list of directories in which PDFs are stored.
|
||||
Bibtex-completion assumes that the names of these PDFs are
|
||||
@@ -124,7 +126,7 @@ ebib:key depending on the major mode of the current buffer. Note
|
||||
that the functions should accept a list of keys as input. With
|
||||
multiple marked entries one can insert multiple keys at once,
|
||||
e.g. \cite{key1,key2}. See the functions
|
||||
`bibtex-completion-format-citation-ebib' and
|
||||
`bibtex-completion-format-citation-org-cite' and
|
||||
`bibtex-completion-format-citation-cite' as examples."
|
||||
:group 'bibtex-completion
|
||||
:type '(alist :key-type symbol :value-type function))
|
||||
@@ -640,9 +642,11 @@ the hash table."
|
||||
|
||||
(defun bibtex-completion-make-candidate (entry)
|
||||
"Return a candidate for ENTRY."
|
||||
(cons (bibtex-completion-clean-string
|
||||
(s-join " " (-map #'cdr entry)))
|
||||
entry))
|
||||
(let* ((candidate (bibtex-completion-clean-string
|
||||
(s-join " " (-map #'cdr entry))))
|
||||
(candidate (concat candidate " " (car (assoc "=has-pdf=" entry))))
|
||||
(candidate (concat candidate " " (car (assoc "=has-note=" entry)))))
|
||||
(cons candidate entry)))
|
||||
|
||||
(defun bibtex-completion-parse-bibliography (&optional ht-strings)
|
||||
"Parse the BibTeX entries listed in the current buffer and return a list of entries in the order in which they appeared in the BibTeX file.
|
||||
@@ -707,8 +711,8 @@ does not exist, or if `bibtex-completion-pdf-field' is nil."
|
||||
((not value) nil) ; Field not defined.
|
||||
((f-file? value) (list value)) ; A bare full path was found.
|
||||
((-any 'f-file? (--map (f-join it (f-filename value)) (-flatten bibtex-completion-library-path))) (-filter 'f-file? (--map (f-join it (f-filename value)) (-flatten bibtex-completion-library-path))))
|
||||
(t ; Zotero/Mendeley/JabRef format:
|
||||
(let ((value (replace-regexp-in-string "\\([^\\]\\);" "\\1\^^" value)))
|
||||
(t ; Zotero/Mendeley/JabRef/Calibre format:
|
||||
(let ((value (replace-regexp-in-string "\\([^\\]\\)[;,]" "\\1\^^" value)))
|
||||
(cl-loop ; Looping over the files:
|
||||
for record in (s-split "\^^" value)
|
||||
; Replace unescaped colons by field separator:
|
||||
@@ -1047,6 +1051,12 @@ which no PDF is available are omitted."
|
||||
for pdfs = (bibtex-completion-find-pdf key bibtex-completion-find-additional-pdfs)
|
||||
append (with-no-warnings (--map (org-make-link-string it key) pdfs)))))
|
||||
|
||||
(defun bibtex-completion-format-citation-org-cite (keys)
|
||||
"Format org-links using Org mode's own cite syntax."
|
||||
(format "[cite:%s]"
|
||||
(s-join ";"
|
||||
(--map (format "@%s" it) keys))))
|
||||
|
||||
(defun bibtex-completion-format-citation-org-apa-link-to-PDF (keys)
|
||||
"Format org-links to PDF for entries in KEYS.
|
||||
Link text loosely follows APA format. Uses first matching PDF if
|
||||
@@ -1123,7 +1133,7 @@ The format depends on
|
||||
'bibtex-completion-apa-get-value entry))
|
||||
("inbook"
|
||||
(s-format
|
||||
"${author} (${year}). ${title}. In ${editor} (Eds.), ${booktitle} (pp. ${pages}). ${address}: ${publisher}."
|
||||
"${author} (${year}). ${chapter}. In ${editor} (Eds.), ${title} (pp. ${pages}). ${address}: ${publisher}."
|
||||
'bibtex-completion-apa-get-value entry))
|
||||
("incollection"
|
||||
(s-format
|
||||
@@ -1204,7 +1214,7 @@ Return DEFAULT if FIELD is not present in ENTRY."
|
||||
("year" (or value
|
||||
(car (split-string (bibtex-completion-get-value "date" entry "") "-"))))
|
||||
(_ value))
|
||||
"")))))
|
||||
(or default ""))))))
|
||||
|
||||
(defun bibtex-completion-apa-format-authors (value &optional abbrev)
|
||||
"Format author list in VALUE in APA style.
|
||||
@@ -1290,7 +1300,10 @@ Surrounding curly braces are stripped."
|
||||
(replace-regexp-in-string
|
||||
"\\(^[[:space:]]*[\"{][[:space:]]*\\)\\|\\([[:space:]]*[\"}][[:space:]]*$\\)"
|
||||
""
|
||||
(s-collapse-whitespace value))
|
||||
;; Collapse whitespaces when the content is not a path:
|
||||
(if (equal bibtex-completion-pdf-field field)
|
||||
value
|
||||
(s-collapse-whitespace value)))
|
||||
default)))
|
||||
|
||||
(defun bibtex-completion-insert-key (keys)
|
||||
@@ -1535,15 +1548,24 @@ bibliography file that will open that file for editing."
|
||||
|
||||
(defun bibtex-completion-find-local-bibliography ()
|
||||
"Return a list of BibTeX files associated with the current file.
|
||||
If the current file is a BibTeX file, return this
|
||||
file. Otherwise, try to use `reftex' to find the associated
|
||||
BibTeX files. If this fails, return nil."
|
||||
|
||||
If the current file is a BibTeX file, return this file. In LaTeX
|
||||
documents, use `reftex' to find associated BibTeX files. In org
|
||||
files return the local or global org bibliography (see oc.el).
|
||||
If all fails, return nil."
|
||||
(or (and (buffer-file-name)
|
||||
(string= (or (f-ext (buffer-file-name)) "") "bib")
|
||||
(list (buffer-file-name)))
|
||||
;; LaTeX:
|
||||
(and (buffer-file-name)
|
||||
(string= (or (f-ext (buffer-file-name)) "") "tex")
|
||||
(require 'reftex-cite nil t)
|
||||
(ignore-errors (reftex-get-bibfile-list)))))
|
||||
(ignore-errors (reftex-get-bibfile-list)))
|
||||
;; Org (with oc.el):
|
||||
(and (buffer-file-name)
|
||||
(string= (or (f-ext (buffer-file-name)) "") "org")
|
||||
(fboundp 'org-cite-list-bibliography-files)
|
||||
(org-cite-list-bibliography-files))))
|
||||
|
||||
(defun bibtex-completion-get-key-bibtex ()
|
||||
"Return the key of the BibTeX entry at point, nil otherwise.
|
||||
|
||||
Reference in New Issue
Block a user