mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-15 10:30:25 -08:00
Recognize multicite macros from biblatex
* lisp/textmodes/reftex-cite.el (reftex-all-used-citation-keys): Match the citation keys used with multicite macros provided by biblatex. (bug#38249) * test/lisp/textmodes/reftex-tests.el (reftex-all-used-citation-keys): Adjust test accordingly.
This commit is contained in:
parent
7b94c6b00b
commit
845246093f
2 changed files with 64 additions and 3 deletions
|
|
@ -1144,8 +1144,6 @@ recommended for follow mode. It works OK for individual lookups."
|
|||
(defun reftex-all-used-citation-keys ()
|
||||
"Return a list of all citation keys used in document."
|
||||
(reftex-access-scan-info)
|
||||
;; FIXME: multicites macros provided by biblatex
|
||||
;; are not covered in this function.
|
||||
(let ((files (reftex-all-document-files))
|
||||
(re (concat "\\\\"
|
||||
"\\(?:"
|
||||
|
|
@ -1170,6 +1168,25 @@ recommended for follow mode. It works OK for individual lookups."
|
|||
"\\)"
|
||||
;; Now match the key:
|
||||
"{\\([^}]+\\)}"))
|
||||
;; Multicites: Match \MACRONAME(Global Pre)(Global Post)
|
||||
(re2 (concat "\\\\"
|
||||
(regexp-opt '("cites" "Cites"
|
||||
"parencites" "Parencites"
|
||||
"footcites" "footcitetexts"
|
||||
"smartcites" "Smartcites"
|
||||
"textcites" "Textcites"
|
||||
"supercites"
|
||||
"autocites" "Autocites"
|
||||
"volcites" "Volcites"
|
||||
"pvolcites" "Pvolcites"
|
||||
"fvolcites" "Fvolcites"
|
||||
"svolcites" "Svolcites"
|
||||
"tvolcites" "Tvolcites"
|
||||
"avolcites" "Avolcites"))
|
||||
"\\(?:([^)]*)\\)\\{0,2\\}"))
|
||||
;; For each key in list [prenote][postnote]{key}
|
||||
(re3 (concat "\\(?:\\[[^]]*\\]\\)\\{0,2\\}"
|
||||
"{\\([^}]+\\)}"))
|
||||
file keys kk k)
|
||||
(save-current-buffer
|
||||
(while (setq file (pop files))
|
||||
|
|
@ -1188,7 +1205,29 @@ recommended for follow mode. It works OK for individual lookups."
|
|||
(setq kk (split-string kk "[, \t\r\n]+"))
|
||||
(while (setq k (pop kk))
|
||||
(or (member k keys)
|
||||
(setq keys (cons k keys))))))))))
|
||||
(setq keys (cons k keys))))))
|
||||
;; And now search for citation lists:
|
||||
(goto-char (point-min))
|
||||
(while (re-search-forward re2 nil t)
|
||||
;; Make sure we're not inside a comment:
|
||||
(unless (save-match-data
|
||||
(nth 4 (syntax-ppss)))
|
||||
(while (progn
|
||||
;; Ignore the value of
|
||||
;; `reftex-allow-detached-macro-args' since we
|
||||
;; expect a bigger number of args and detaching
|
||||
;; them seems natural for line breaks:
|
||||
(while (looking-at "[ \t\r\n]+\\|%.*\n")
|
||||
(goto-char (match-end 0)))
|
||||
(and (looking-at re3)
|
||||
(goto-char (match-end 0))))
|
||||
(setq kk (match-string-no-properties 1))
|
||||
(while (string-match "%.*\n?" kk)
|
||||
(setq kk (replace-match "" t t kk)))
|
||||
(setq kk (split-string kk "[, \t\r\n]+"))
|
||||
(while (setq k (pop kk))
|
||||
(or (member k keys)
|
||||
(setq keys (cons k keys)))))))))))
|
||||
(reftex-kill-temporary-buffers)
|
||||
keys))
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue