mirror of
https://git.savannah.gnu.org/git/emacs/org-mode.git
synced 2024-11-22 07:09:47 +00:00
oc: Allow inserting citations in table cells (part 2)
* lisp/oc.el (org-cite--allowed-p): Allow inserting a citation after two or more spaces at the end of a table cell. * testing/lisp/test-oc.el (test-org-cite/insert-capability): Add tests.
This commit is contained in:
parent
78c450247b
commit
7ea9099725
@ -1421,7 +1421,8 @@ ARG is the prefix argument received when calling `org-open-at-point', or nil."
|
||||
((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)))))))
|
||||
|
@ -1774,6 +1774,34 @@ arguments. Replace citation with \"@\" character in the output."
|
||||
(eq 'success
|
||||
(catch :exit
|
||||
(org-test-with-temp-text "#+caption: <point>\n| table |"
|
||||
(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 table cells.
|
||||
(should
|
||||
(eq 'success
|
||||
(catch :exit
|
||||
(org-test-with-temp-text "| <point>table |"
|
||||
(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 "| table<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 "| table <point> |"
|
||||
(let ((org-cite--processors nil)
|
||||
(org-cite-insert-processor 'foo))
|
||||
(org-cite-register-processor 'foo
|
||||
|
Loading…
Reference in New Issue
Block a user