[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/org 9b06325 1/3: oc: Allow citations at footnote defini
From: |
ELPA Syncer |
Subject: |
[elpa] externals/org 9b06325 1/3: oc: Allow citations at footnote definition start |
Date: |
Wed, 6 Oct 2021 08:57:21 -0400 (EDT) |
branch: externals/org
commit 9b063251cf8afa51e208db6eebebcc167de319e4
Author: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Commit: Nicolas Goaziou <mail@nicolasgoaziou.fr>
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.
---
lisp/oc.el | 6 +++++-
testing/lisp/test-oc.el | 43 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 48 insertions(+), 1 deletion(-)
diff --git a/lisp/oc.el b/lisp/oc.el
index 17b5775..85e1b68 100644
--- a/lisp/oc.el
+++ b/lisp/oc.el
@@ -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)
diff --git a/testing/lisp/test-oc.el b/testing/lisp/test-oc.el
index 995559b..80d74be 100644
--- a/testing/lisp/test-oc.el
+++ b/testing/lisp/test-oc.el
@@ -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