Browse Source

oc: Ensure activation returns a non-nil value

* lisp/oc.el (org-cite-activate): Return a non-nil value when
successful, even if citation processor doesn't.
Nicolas Goaziou 3 years ago
parent
commit
308f4cb570
1 changed files with 14 additions and 10 deletions
  1. 14 10
      lisp/oc.el

+ 14 - 10
lisp/oc.el

@@ -1163,16 +1163,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 ((activate
-           (or (and name
-                    (org-cite-processor-has-capability-p name 'activate)
-                    (org-cite-processor-activate (org-cite--get-processor name)))
-               #'org-cite-fontify-default)))
-      (while (re-search-forward org-element-citation-prefix-re limit t)
-        (let ((cite (org-with-point-at (match-beginning 0)
-                      (org-element-citation-parser))))
-          (when cite (save-excursion (funcall activate cite))))))))
+  (let* ((name org-cite-activate-processor)
+         (activate
+          (or (and name
+                   (org-cite-processor-has-capability-p name 'activate)
+                   (org-cite-processor-activate (org-cite--get-processor name)))
+              #'org-cite-fontify-default)))
+    (when (re-search-forward org-element-citation-prefix-re limit t)
+      (let ((cite (org-with-point-at (match-beginning 0)
+                    (org-element-citation-parser))))
+        (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)