oc: Allow citations at footnote definition start
* lisp/oc.el (org-cite--allowed-p): Allow citations at footnote definition start. * testing/lisp/test-oc.el (test-org-cite/insert-capability): Add tests.
This commit is contained in:
parent
67b613a115
commit
9b063251cf
|
@ -1436,7 +1436,11 @@ CONTEXT is the element or object at point, as returned by `org-element-context'.
|
|||
(skip-chars-backward " \r\t\n")
|
||||
(if (eq (org-element-class context) 'object) (point)
|
||||
(line-beginning-position 2)))))
|
||||
;; At the start of a list item is fine, as long as the bullet is unaffected.
|
||||
;; At the beginning of a footnote definition, right after the
|
||||
;; label, is OK.
|
||||
((eq type 'footnote-definition) (looking-at (rx space)))
|
||||
;; At the start of a list item is fine, as long as the bullet is
|
||||
;; unaffected.
|
||||
((eq type 'item)
|
||||
(> (point) (+ (org-element-property :begin context)
|
||||
(current-indentation)
|
||||
|
|
|
@ -1792,6 +1792,49 @@ arguments. Replace citation with \"@\" character in the output."
|
|||
(org-cite-register-processor 'foo
|
||||
:insert (lambda (_ _) (throw :exit 'success)))
|
||||
(call-interactively #'org-cite-insert))))
|
||||
;; Allow inserting citations at the beginning of a footnote
|
||||
;; definition, right after the label.
|
||||
(should
|
||||
(eq 'success
|
||||
(catch :exit
|
||||
(org-test-with-temp-text "[fn:1]<point>"
|
||||
(let ((org-cite--processors nil)
|
||||
(org-cite-insert-processor 'foo))
|
||||
(org-cite-register-processor 'foo
|
||||
:insert (lambda (_ _) (throw :exit 'success)))
|
||||
(call-interactively #'org-cite-insert))))))
|
||||
(should
|
||||
(eq 'success
|
||||
(catch :exit
|
||||
(org-test-with-temp-text "[fn:1] <point>"
|
||||
(let ((org-cite--processors nil)
|
||||
(org-cite-insert-processor 'foo))
|
||||
(org-cite-register-processor 'foo
|
||||
:insert (lambda (_ _) (throw :exit 'success)))
|
||||
(call-interactively #'org-cite-insert))))))
|
||||
(should
|
||||
(eq 'success
|
||||
(catch :exit
|
||||
(org-test-with-temp-text "[fn:1]<point>\nParagraph"
|
||||
(let ((org-cite--processors nil)
|
||||
(org-cite-insert-processor 'foo))
|
||||
(org-cite-register-processor 'foo
|
||||
:insert (lambda (_ _) (throw :exit 'success)))
|
||||
(call-interactively #'org-cite-insert))))))
|
||||
(should-error
|
||||
(org-test-with-temp-text "[fn:1<point>]"
|
||||
(let ((org-cite--processors nil)
|
||||
(org-cite-insert-processor 'foo))
|
||||
(org-cite-register-processor 'foo
|
||||
:insert (lambda (_ _) (throw :exit 'success)))
|
||||
(call-interactively #'org-cite-insert))))
|
||||
(should-error
|
||||
(org-test-with-temp-text "<point>[fn:1]"
|
||||
(let ((org-cite--processors nil)
|
||||
(org-cite-insert-processor 'foo))
|
||||
(org-cite-register-processor 'foo
|
||||
:insert (lambda (_ _) (throw :exit 'success)))
|
||||
(call-interactively #'org-cite-insert))))
|
||||
;; Allow inserting citations in captions.
|
||||
(should
|
||||
(eq 'success
|
||||
|
|
Loading…
Reference in New Issue