oc: Allow citations following an item bullet

* lisp/oc.el (org-cite--allowed-p): Expand the allowed cases to include
"item", which lets one insert a citation following a bullet, e.g. "- ".
We just have to check to make sure the citation actually is at least one
character away from the bullet, or five if a checkbox is present.
This commit is contained in:
TEC 2021-08-31 19:03:19 +08:00
parent 6600dc096d
commit b02f1eae19
Signed by: tec
GPG Key ID: 779591AFDB81F06C
1 changed files with 6 additions and 0 deletions

View File

@ -1420,6 +1420,12 @@ ARG is the prefix argument received when calling `org-open-at-point', or nil."
(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.
((eq type 'item)
(> (point) (+ (org-element-property :begin context)
(org-get-indentation)
(if (org-element-property :checkbox context)
5 1))))
;; Other elements are invalid.
((eq (org-element-class context) 'element) nil)
;; Just before object is fine.