Function: org-cite-basic-activate
org-cite-basic-activate is a byte-compiled function defined in
oc-basic.el.gz.
Signature
(org-cite-basic-activate CITATION)
Documentation
Set various text properties on CITATION object.
Fontify whole citation with org-cite face. Fontify key with error face
when it does not belong to known keys. Otherwise, use org-cite-key face.
Moreover, when mouse is on a known key, display the corresponding bibliography. On a wrong key, suggest a list of possible keys, and offer to substitute one of them with a mouse click.
Source Code
;; Defined in /usr/src/emacs/lisp/org/oc-basic.el.gz
(defun org-cite-basic-activate (citation)
"Set various text properties on CITATION object.
Fontify whole citation with `org-cite' face. Fontify key with `error' face
when it does not belong to known keys. Otherwise, use `org-cite-key' face.
Moreover, when mouse is on a known key, display the corresponding bibliography.
On a wrong key, suggest a list of possible keys, and offer to substitute one of
them with a mouse click."
(pcase-let ((`(,beg . ,end) (org-cite-boundaries citation))
(keys (org-cite-basic--all-keys)))
(put-text-property beg end 'font-lock-multiline t)
(add-face-text-property beg end 'org-cite)
(dolist (reference (org-cite-get-references citation))
(pcase-let* ((`(,beg . ,end) (org-cite-key-boundaries reference))
(key (org-element-property :key reference)))
;; Highlight key on mouse over.
(put-text-property beg end
'mouse-face
org-cite-basic-mouse-over-key-face)
(if (member key keys)
;; Activate a correct key. Face is `org-cite-key' and
;; `help-echo' displays bibliography entry, for reference.
;; <mouse-1> calls `org-open-at-point'.
(let* ((entry (org-cite-basic--get-entry key))
(bibliography-entry
(org-element-interpret-data
(org-cite-basic--print-entry entry "plain"))))
(add-face-text-property beg end 'org-cite-key)
(put-text-property beg end 'help-echo bibliography-entry)
(org-cite-basic--set-keymap beg end nil))
;; Activate a wrong key. Face is `error', `help-echo'
;; displays possible suggestions.
(add-face-text-property beg end 'error)
(let ((close-keys (org-cite-basic--close-keys key keys)))
(when close-keys
(put-text-property beg end 'help-echo
(concat "Suggestions (mouse-1 to substitute): "
(mapconcat #'identity close-keys " "))))
;; When the are close know keys, <mouse-1> provides
;; completion to fix the current one. Otherwise, call
;; `org-cite-insert'.
(org-cite-basic--set-keymap beg end (or close-keys 'all))))))))