Add Eldoc support

An advice is necessary because org-eldoc-documentation-function isn't
customizable, but as it's simply a list of OR'ed function calls, a
:before-until advice is elegant enough an alternative.
This commit is contained in:
Henrik Lissner 2022-08-03 18:15:58 +02:00 committed by tecosaur
parent 943d6b9edf
commit 7a18d9d5ea
1 changed files with 15 additions and 0 deletions

View File

@ -2154,5 +2154,20 @@ point will be used."
(insert (format "- %s :: %s" term-str definition) "\n")
(insert "- " term-str "\n")))))
;;; Eldoc
(defun org-glossary--eldoc-function (&rest _)
"Return help-echo output for org-glossary term at point.
This is intended as a :before-until advice for
`org-eldoc-documentation-function'."
(and org-glossary-mode
(eq (get-text-property (point) 'help-echo)
#'org-glossary--help-echo-from-textprop)
(org-glossary--help-echo-from-textprop nil (current-buffer) (point))))
(advice-add 'org-eldoc-documentation-function
:before-until 'org-glossary--eldoc-function)
(provide 'org-glossary)
;;; org-glossary.el ends here