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

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

[elpa] externals/org c839849 2/2: footnote: Allow inserting footnotes at


From: ELPA Syncer
Subject: [elpa] externals/org c839849 2/2: footnote: Allow inserting footnotes at the end of table cells
Date: Thu, 29 Jul 2021 15:57:18 -0400 (EDT)

branch: externals/org
commit c839849abad51c41570a091dd063ef140589a1cb
Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Commit: Nicolas Goaziou <mail@nicolasgoaziou.fr>

    footnote: Allow inserting footnotes at the end of table cells
    
    * lisp/org-footnote.el (org-footnote--allow-reference-p): Allow
    inserting footnotes at the end of table cells.
    * testing/lisp/test-org-footnote.el (test-org-footnote/new): Add test.
---
 lisp/org-footnote.el              | 3 ++-
 testing/lisp/test-org-footnote.el | 8 +++++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el
index 729a4a9..c8c4dae 100644
--- a/lisp/org-footnote.el
+++ b/lisp/org-footnote.el
@@ -291,7 +291,8 @@ otherwise."
        ((eq type 'table-cell)
         ;; :contents-begin is not reliable on empty cells, so special
         ;; case it.
-        (<= (point) (org-element-property :contents-end context)))
+        (<= (save-excursion (skip-chars-backward " \t") (point))
+            (org-element-property :contents-end context)))
        ((let ((cbeg (org-element-property :contents-begin context))
              (cend (org-element-property :contents-end context)))
          (and cbeg (>= (point) cbeg) (<= (point) cend))))))))
diff --git a/testing/lisp/test-org-footnote.el 
b/testing/lisp/test-org-footnote.el
index 4ce5b34..6d8ba2f 100644
--- a/testing/lisp/test-org-footnote.el
+++ b/testing/lisp/test-org-footnote.el
@@ -90,7 +90,7 @@
     (org-test-with-temp-text " *bold*<point>"
       (let ((org-footnote-auto-label t)) (org-footnote-new))
       (buffer-string))))
-  ;; Arrow new footnotes in empty cells.
+  ;; Arrow new footnotes in table cells.
   (should
    (string-match-p
     " \\[fn:1\\]"
@@ -109,6 +109,12 @@
     (org-test-with-temp-text "| <point>|"
       (let ((org-footnote-auto-label t)) (org-footnote-new))
       (buffer-string))))
+  (should
+   (string-match-p
+    " \\[fn:1\\]"
+    (org-test-with-temp-text "| contents   <point>|"
+      (let ((org-footnote-auto-label t)) (org-footnote-new))
+      (buffer-string))))
   ;; When creating a new footnote, move to its definition.
   (should
    (string=



reply via email to

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