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

Allow removing quotes around links in *Help* buffers

* doc/emacs/help.texi (Help Mode): Document it.
* lisp/help-mode.el (help-clean-buttons): New user option
(help-xref-button): Use it.
This commit is contained in:
Lars Ingebrigtsen 2022-06-20 02:27:00 +02:00
parent ac39c327b5
commit 28bfd4db69
3 changed files with 34 additions and 5 deletions

View File

@ -542,6 +542,11 @@ previous hyperlink. These commands act cyclically; for instance,
typing @key{TAB} at the last hyperlink moves back to the first
hyperlink.
@vindex help-clean-buttons
By default, many links in the help buffer are displayed surrounded
by quote characters. If the @code{help-clean-buttons} user option is
non-@code{nil}, these quote characters are removed from the buffer.
@kindex n @r{(Help mode)}
@kindex p @r{(Help mode)}
@findex help-goto-next-page

View File

@ -581,6 +581,10 @@ or ':scream:'.
** Help
*** New user option 'help-clean-buttons'.
If non-nil, link buttons in *Help* will have any surrounding quotes
removed.
---
*** 'M-x apropos-variable' output now includes values of variables.

View File

@ -543,6 +543,12 @@ Each element has the form (NAME TESTFUN DESCFUN) where:
and a frame), inserts the description of that symbol in the current buffer
and returns that text as well.")
(defcustom help-clean-buttons nil
"If non-nil, remove quotes around link buttons."
:version "29.1"
:type 'boolean
:group 'help)
;;;###autoload
(defun help-make-xrefs (&optional buffer)
"Parse and hyperlink documentation cross-references in the given BUFFER.
@ -691,12 +697,26 @@ that."
MATCH-NUMBER is the subexpression of interest in the last matched
regexp. TYPE is the type of button to use. Any remaining arguments are
passed to the button's help-function when it is invoked.
See `help-make-xrefs'."
See `help-make-xrefs'.
This function heeds the `help-clean-buttons' variable and will
remove quotes surrounding the match if non-nil."
;; Don't mung properties we've added specially in some instances.
(unless (button-at (match-beginning match-number))
(make-text-button (match-beginning match-number)
(match-end match-number)
'type type 'help-args args)))
(let ((beg (match-beginning match-number))
(end (match-end match-number)))
(unless (button-at beg)
(make-text-button beg end 'type type 'help-args args)
(when (and help-clean-buttons
(> beg (point-min))
(save-excursion
(goto-char (1- beg))
(looking-at "['`]"))
(< end (point-max))
(save-excursion
(goto-char end)
(looking-at "[']")))
(delete-region end (1+ end))
(delete-region (1- beg) beg)))))
;;;###autoload
(defun help-insert-xref-button (string type &rest args)