How to find the path a help-mode cross-reference points to (without visiting it)?

74 views Asked by At

Some Emacs *Help* buffers include active cross-references that point to file system paths. One can visit the associated files by following the xref in the usual way, but I want to know how to determine the path that the xref points to without visiting the associated file (i.e. without following the cross-reference).

How can I do this?

IMPORTANT: I want to to do this while using Emacs in text-mode. (IOW, no mouse, no menus, etc.)

PS1: It occurs to me that one simple way to get the information I want is to view the source code underlying the *Help* buffer. (By this I mean the mark-up that identifies the cross-referenced items, and holds their targets.) I have not been able to find how to do this either.

PS2: Somewhere in the docs I found that running M-x visible-mode may display the information I'm after, but when I try it I see no additional information anywhere. Ditto with fiddling with the variable Info-hide-note-references.

1

There are 1 answers

0
abo-abo On BEST ANSWER

When the point in on the appropriate button:

(cadr (button-get (button-at (point)) 'help-args))

You can use this to collect all buttons:

(defun ali--help-collect-references ()
  "Collect the positions of visible links in the current `help-mode' buffer."
  (let ((skip (text-property-any (point-min) (point-max)
                                 'button nil))
        candidates)
    (save-excursion
      (while (setq skip (text-property-not-all skip (point-max)
                                               'button nil))
        (goto-char skip)
        (push skip candidates)
        (setq skip (text-property-any (point) (point-max)
                                      'button nil))))
    (nreverse candidates)))