Merge branch 'bugfix'

This commit is contained in:
Nicolas Goaziou 2021-11-24 22:51:41 +01:00
commit b3cc2f793b
1 changed files with 22 additions and 21 deletions

View File

@ -1141,17 +1141,14 @@ and must return either a string, an object, or a secondary string."
;;; Internal interface with fontification (activate capability) ;;; Internal interface with fontification (activate capability)
(defun org-cite-fontify-default (datum) (defun org-cite-fontify-default (cite)
"Fontify DATUM with `org-cite' and `org-cite-key' face. "Fontify CITE with `org-cite' and `org-cite-key' faces.
DATUM is a citation object, or a citation reference. In any case, apply CITE is a citation object. The function applies `org-cite' face
`org-cite' face on the whole citation, and `org-cite-key' face on each key." on the whole citation, and `org-cite-key' face on each key."
(let* ((cite (if (eq 'citation-reference (org-element-type datum)) (let ((beg (org-element-property :begin cite))
(org-element-property :parent datum) (end (org-with-point-at (org-element-property :end cite)
datum)) (skip-chars-backward " \t")
(beg (org-element-property :begin cite)) (point))))
(end (org-with-point-at (org-element-property :end cite)
(skip-chars-backward " \t")
(point))))
(add-text-properties beg end '(font-lock-multiline t)) (add-text-properties beg end '(font-lock-multiline t))
(add-face-text-property beg end 'org-cite) (add-face-text-property beg end 'org-cite)
(dolist (reference (org-cite-get-references cite)) (dolist (reference (org-cite-get-references cite))
@ -1163,16 +1160,20 @@ DATUM is a citation object, or a citation reference. In any case, apply
"Activate citations from up to LIMIT buffer position. "Activate citations from up to LIMIT buffer position.
Each citation encountered is activated using the appropriate function Each citation encountered is activated using the appropriate function
from the processor set in `org-cite-activate-processor'." from the processor set in `org-cite-activate-processor'."
(let ((name org-cite-activate-processor)) (let* ((name org-cite-activate-processor)
(let ((activate (activate
(or (and name (or (and name
(org-cite-processor-has-capability-p name 'activate) (org-cite-processor-has-capability-p name 'activate)
(org-cite-processor-activate (org-cite--get-processor name))) (org-cite-processor-activate (org-cite--get-processor name)))
#'org-cite-fontify-default))) #'org-cite-fontify-default)))
(while (re-search-forward org-element-citation-prefix-re limit t) (when (re-search-forward org-element-citation-prefix-re limit t)
(let ((cite (org-with-point-at (match-beginning 0) (let ((cite (org-with-point-at (match-beginning 0)
(org-element-citation-parser)))) (org-element-citation-parser))))
(when cite (save-excursion (funcall activate cite)))))))) (when cite
(funcall activate cite)
;; Move after cite object and make sure to return
;; a non-nil value.
(goto-char (org-element-property :end cite)))))))
;;; Internal interface with Org Export library (export capability) ;;; Internal interface with Org Export library (export capability)