In emacs how does the "hyperlink" in the *Help* buffer work?
I'm trying to figure out how the "hyperlink" works in the *Help*
buffer (so that I can implement something similar in the output of M-x compile). Here is a more detailed descript开发者_如何学Goion of the behaviour I want to imitate:
M-x describe-function find-file
opens up a *Help*
buffer. The first line of this buffer (for me) shows: find-file is an interactive Lisp function in files.el.
files.el is underlined and clicking (or hitting enter when point is there) opens a new buffer with files.el and the point positioned at the definition of find-file
. Doing a describe-key for says invokes push-button in button.el, which tells me Perform the action specified by a button at location pos
- but how do I define a button and associate an action with that button in my own buffer?
The major mode of the *Help*
buffers is help-mode
. In its source code (help-mode.el
), you find function help-make-xrefs
that "Parse[s] and hyperlink[s] documentation cross-references in the given BUFFER". You may check it how it was implemented.
Otherwise, I'd suggest using org-mode
instead, which uses the simple form [[URI][caption]]
to mark hyperlinks.
精彩评论