1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2024-11-25 07:28:20 +00:00

Fix xref links in `C-h o'

* lisp/help-fns.el (describe-symbol): Make xref links happen in
all sections (bug#49587).

* lisp/help-fns.el (describe-symbol): Add back/forward links.

* lisp/help-mode.el (help-make-xrefs): Factor out links from
here...
(help-xref--navigation-buttons): To here.
This commit is contained in:
Lars Ingebrigtsen 2022-07-16 14:57:58 +02:00
parent 71b58ade86
commit 9b5eb661bf
2 changed files with 23 additions and 16 deletions

View File

@ -1800,8 +1800,10 @@ current buffer and the selected frame, respectively."
(when (funcall testfn symbol)
;; Don't record the current entry in the stack.
(setq help-xref-stack-item nil)
(cons name
(funcall descfn symbol buffer frame))))
(let ((help-xref-stack nil)
(help-xref-forward-stack nil))
(funcall descfn symbol buffer frame))
(cons name (buffer-string))))
describe-symbol-backends))))
(single (null (cdr docs))))
(while (cdr docs)
@ -1822,6 +1824,8 @@ current buffer and the selected frame, respectively."
;; Don't record the `describe-variable' item in the stack.
(setq help-xref-stack-item nil)
(help-setup-xref (list #'describe-symbol symbol) nil))
(goto-char (point-max))
(help-xref--navigation-buttons)
(goto-char (point-min))))))
;;;###autoload

View File

@ -673,22 +673,25 @@ that."
(while (and (not (bobp)) (bolp))
(delete-char -1))
(insert "\n")
(when (or help-xref-stack help-xref-forward-stack)
(insert "\n"))
;; Make a back-reference in this buffer if appropriate.
(when help-xref-stack
(help-insert-xref-button help-back-label 'help-back
(current-buffer)))
;; Make a forward-reference in this buffer if appropriate.
(when help-xref-forward-stack
(when help-xref-stack
(insert "\t"))
(help-insert-xref-button help-forward-label 'help-forward
(current-buffer)))
(when (or help-xref-stack help-xref-forward-stack)
(insert "\n")))
(help-xref--navigation-buttons))
(set-buffer-modified-p old-modified)))))
(defun help-xref--navigation-buttons ()
(let ((inhibit-read-only t))
;; Make a back-reference in this buffer if appropriate.
(when help-xref-stack
(ensure-empty-lines 1)
(help-insert-xref-button help-back-label 'help-back
(current-buffer)))
;; Make a forward-reference in this buffer if appropriate.
(when help-xref-forward-stack
(when help-xref-stack
(insert "\t"))
(help-insert-xref-button help-forward-label 'help-forward
(current-buffer)))
(unless (bolp)
(insert "\n"))))
;;;###autoload
(defun help-xref-button (match-number type &rest args)
"Make a hyperlink for cross-reference text previously matched.