mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-09-29 22:37:47 +00:00
footnote: Allow new footnotes in empty cells
* lisp/org-footnote.el (org-footnote--allow-reference-p): allow inserting new footnotes in empty cells. * testing/lisp/test-org-footnote.el (test-org-footnote/new): Add tests. Reported-by: Uwe Brauer <oub@mat.ucm.es> <http://lists.gnu.org/r/emacs-orgmode/2021-05/msg00940.html>
This commit is contained in:
parent
6524301288
commit
13c78a5900
|
@ -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))))))))
|
||||
|
|
|
@ -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=
|
||||
|
|
Loading…
Reference in a new issue