I'm trying to create *Help*
buffers in Emacs, documenting functions defined in other languages.
I can create a simple help buffer easily:
(defun wh/help-hello-world ()
(interactive)
(with-help-window (help-buffer)
(princ "foo_bar is a function.\n\nIt does stuff.")))
However, I want to add a clickable link in my *Help*
buffer, which Emacs seems to call a button. I can see describe-function-1
calls help-xref-button
which creates a button.
However, if I call insert-text-button
the same way help-xref-button
creates buttons, then 'help-args
seems to expect an elisp function and path.
(defun wh/help-hello-world-button ()
(interactive)
(let ((buf (help-buffer)))
(with-help-window buf
(princ "foo_bar is a function.\n\nIt does stuff."))
(with-current-buffer buf
(let ((inhibit-read-only t))
(insert-text-button
"example.txt"
'type 'help-function-def
'help-args '(button-type-subtype-p "/usr/share/emacs/24.5/lisp/button.el.gz"))))))
How can I create an Emacs button pointing to an arbitrary line in an arbitrary file?