Generic property injection into help hooks
Heime <[email protected]>
| Newsgroups | gmane.emacs.help |
|---|---|
| Message-ID | <nnBzSp3yTZDL6ENe5bjdPPj7hUhO4EsQqXlwVvr66Pab4Wajvv7IrB1B2e_dzqRkbF0aQJp5Cj6Hfops8udJws4iWcUjWNCt5qjg7NQG7fo=@protonmail.com> |
------------------------------------------------------------------------
I want to add text to the `help-fns-describe-function-functions` hook
using a generic property.
The problem is that `help-fns-describe-function-functions` only accepts
the function symbol as argument.
How Can I make the function specify the property without breaking the
requirement of the `help-fns-describe-function-functions` hook?
(defun ripo-insert-property (fn property)
"Add property text into the `*Help*' buffer during `describe-function'
for functions where PROPERTY is set to their symbol.
(add-hook 'help-fns-describe-function-functions #'ripo-insert-property)
Enhance the `*Help*' buffer by adding the property value to the
`help-fns-describe-function-functions' hook."
;; Retrieve and insert the property value if present
;; Conditional let construct binds variable VALR and runs body when
;; binding is non‑nil.
(when-let* ((valr (get fn property)))
(insert (format "%s\n\n" valr))))