emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/org af67fa1 3/3: Merge branch 'bugfix'


From: ELPA Syncer
Subject: [elpa] externals/org af67fa1 3/3: Merge branch 'bugfix'
Date: Wed, 6 Oct 2021 08:57:21 -0400 (EDT)

branch: externals/org
commit af67fa1ebe0778e475463fc3ff0cf59d22dd9e0c
Merge: 1b56c28 94b410b
Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Commit: Nicolas Goaziou <mail@nicolasgoaziou.fr>

    Merge branch 'bugfix'
---
 lisp/org-footnote.el              |  5 ++++-
 testing/lisp/test-org-footnote.el | 29 ++++++++++++++++++++++++++++-
 2 files changed, 32 insertions(+), 2 deletions(-)

diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el
index c8c4dae..fcc7579 100644
--- a/lisp/org-footnote.el
+++ b/lisp/org-footnote.el
@@ -281,7 +281,10 @@ otherwise."
            (save-excursion (goto-char (org-element-property :end context))
                            (skip-chars-backward " \r\t\n")
                            (if (eq (org-element-class context) 'object) (point)
-                             (1+ (line-beginning-position 2))))))
+                             (line-beginning-position 2)))))
+       ;; At the beginning of a footnote definition, right after the
+       ;; label, is OK.
+       ((eq type 'footnote-definition) (looking-at (rx space)))
        ;; Other elements are invalid.
        ((eq (org-element-class context) 'element) nil)
        ;; Just before object is fine.
diff --git a/testing/lisp/test-org-footnote.el 
b/testing/lisp/test-org-footnote.el
index 6d8ba2f..8751dc8 100644
--- a/testing/lisp/test-org-footnote.el
+++ b/testing/lisp/test-org-footnote.el
@@ -90,7 +90,34 @@
     (org-test-with-temp-text " *bold*<point>"
       (let ((org-footnote-auto-label t)) (org-footnote-new))
       (buffer-string))))
-  ;; Arrow new footnotes in table cells.
+  ;; Allow new footnotes at the start of a footnote definition.
+  (should
+   (string-match-p
+    "\\[fn:1\\]\\[fn:2\\]"
+    (org-test-with-temp-text "[fn:1]<point>"
+      (let ((org-footnote-auto-label t)) (org-footnote-new))
+      (buffer-string))))
+  (should
+   (string-match-p
+    "\\[fn:1\\] \\[fn:2\\]"
+    (org-test-with-temp-text "[fn:1] <point>"
+      (let ((org-footnote-auto-label t)) (org-footnote-new))
+      (buffer-string))))
+  (should
+   (string-match-p
+    "\\[fn:1\\]\\[fn:2\\]"
+    (org-test-with-temp-text "[fn:1]<point> \nParagraph"
+      (let ((org-footnote-auto-label t)) (org-footnote-new))
+      (buffer-string))))
+  (should-error
+   (org-test-with-temp-text "[fn:<point>1]"
+     (let ((org-footnote-auto-label t)) (org-footnote-new))
+     (buffer-string)))
+  (should-error
+   (org-test-with-temp-text "<point>[fn:1]"
+     (let ((org-footnote-auto-label t)) (org-footnote-new))
+     (buffer-string)))
+  ;; Allow new footnotes in table cells.
   (should
    (string-match-p
     " \\[fn:1\\]"



reply via email to

[Prev in Thread] Current Thread [Next in Thread]