summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2021-05-20 15:45:45 +0200
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2021-05-20 15:45:45 +0200
commitdce8b3f254e174b9b79858d70858056c248fb6a3 (patch)
treeb9b2ef5e9e3465d55db3f099e4c679ad24854da7
parent507cf71de2699703276df39e4c0d78f45dfba97f (diff)
parent13c78a590001d7966a63c2ac35ce803a7a54fc26 (diff)
downloadorg-mode-dce8b3f254e174b9b79858d70858056c248fb6a3.tar.gz
Merge branch 'maint'
-rw-r--r--lisp/org-footnote.el4
-rw-r--r--testing/lisp/test-org-footnote.el19
2 files changed, 23 insertions, 0 deletions
diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el
index f59b861..729a4a9 100644
--- a/lisp/org-footnote.el
+++ b/lisp/org-footnote.el
@@ -288,6 +288,10 @@ otherwise."
((= (point) (org-element-property :begin context)))
;; Within recursive object too, but not in a link.
((eq type 'link) nil)
+ ((eq type 'table-cell)
+ ;; :contents-begin is not reliable on empty cells, so special
+ ;; case it.
+ (<= (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 9f23076..4ce5b34 100644
--- a/testing/lisp/test-org-footnote.el
+++ b/testing/lisp/test-org-footnote.el
@@ -90,6 +90,25 @@
(org-test-with-temp-text " *bold*<point>"
(let ((org-footnote-auto-label t)) (org-footnote-new))
(buffer-string))))
+ ;; Arrow new footnotes in empty cells.
+ (should
+ (string-match-p
+ " \\[fn:1\\]"
+ (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 "|<point> |"
+ (let ((org-footnote-auto-label t)) (org-footnote-new))
+ (buffer-string))))
+ (should
+ (string-match-p
+ " \\[fn:1\\]"
+ (org-test-with-temp-text "| <point>|"
+ (let ((org-footnote-auto-label t)) (org-footnote-new))
+ (buffer-string))))
;; When creating a new footnote, move to its definition.
(should
(string=