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.
This commit is contained in:
parent
7ea9099725
commit
c839849aba
|
@ -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))))))))
|
||||
|
|
|
@ -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=
|
||||
|
|
Loading…
Reference in New Issue