mirror of
https://git.savannah.gnu.org/git/emacs.git
synced 2024-11-28 07:45:00 +00:00
Allow inhibiting linkification in *Help* buffers
* doc/lispref/help.texi (Keys in Documentation): Document it. lisp/help-mode.el (help-make-xrefs): Implement a new \+ syntax to inhibit buttonification.
This commit is contained in:
parent
e13744780f
commit
ea58276462
@ -362,6 +362,10 @@ depending on the value of @code{text-quoting-style}.
|
||||
quotes the following character and is discarded; thus, @samp{\=`} puts
|
||||
@samp{`} into the output, @samp{\=\[} puts @samp{\[} into the output,
|
||||
and @samp{\=\=} puts @samp{\=} into the output.
|
||||
|
||||
@item \+
|
||||
This indicates that the symbol directly following should not be marked
|
||||
as link in the @file{*Help*} buffer.
|
||||
@end table
|
||||
|
||||
@strong{Please note:} Each @samp{\} must be doubled when written in a
|
||||
|
9
etc/NEWS
9
etc/NEWS
@ -461,6 +461,15 @@ This allows you to enter emoji using short strings, eg :face_palm: or
|
||||
|
||||
** Help
|
||||
|
||||
+++
|
||||
*** New doc string syntax to indicate that symbols shouldn't be links.
|
||||
When displaying doc strings in *Help* buffers, strings that are
|
||||
"`like-this'" are made into links (if they point to a bound
|
||||
function/variable). This can lead to false positives when talking
|
||||
about values that are symbols that happen to have the same names as
|
||||
functions/variables. To inhibit this buttonification, the new
|
||||
"\\+`like-this'" syntax can be used.
|
||||
|
||||
+++
|
||||
*** New user option 'help-window-keep-selected'.
|
||||
If non-nil, commands to show the info manual and the source will reuse
|
||||
|
@ -452,6 +452,7 @@ Commands:
|
||||
"\\(symbol\\|program\\|property\\)\\|" ; Don't link
|
||||
"\\(source \\(?:code \\)?\\(?:of\\|for\\)\\)\\)"
|
||||
"[ \t\n]+\\)?"
|
||||
"\\(\\\\\\+\\)?"
|
||||
"['`‘]\\(\\(?:\\sw\\|\\s_\\)+\\|`\\)['’]"))
|
||||
"Regexp matching doc string references to symbols.
|
||||
|
||||
@ -628,27 +629,28 @@ that."
|
||||
;; Quoted symbols
|
||||
(save-excursion
|
||||
(while (re-search-forward help-xref-symbol-regexp nil t)
|
||||
(let* ((data (match-string 8))
|
||||
(sym (intern-soft data)))
|
||||
(if sym
|
||||
(cond
|
||||
((match-string 3) ; `variable' &c
|
||||
(and (or (boundp sym) ; `variable' doesn't ensure
|
||||
(when-let ((sym (intern-soft (match-string 9))))
|
||||
(if (match-string 8)
|
||||
(delete-region (match-beginning 8)
|
||||
(match-end 8))
|
||||
(cond
|
||||
((match-string 3) ; `variable' &c
|
||||
(and (or (boundp sym) ; `variable' doesn't ensure
|
||||
; it's actually bound
|
||||
(get sym 'variable-documentation))
|
||||
(help-xref-button 8 'help-variable sym)))
|
||||
((match-string 4) ; `function' &c
|
||||
(and (fboundp sym) ; similarly
|
||||
(help-xref-button 8 'help-function sym)))
|
||||
((match-string 5) ; `face'
|
||||
(and (facep sym)
|
||||
(help-xref-button 8 'help-face sym)))
|
||||
((match-string 6)) ; nothing for `symbol'
|
||||
((match-string 7)
|
||||
(help-xref-button 8 'help-function-def sym))
|
||||
((cl-some (lambda (x) (funcall (nth 1 x) sym))
|
||||
describe-symbol-backends)
|
||||
(help-xref-button 8 'help-symbol sym)))))))
|
||||
(get sym 'variable-documentation))
|
||||
(help-xref-button 9 'help-variable sym)))
|
||||
((match-string 4) ; `function' &c
|
||||
(and (fboundp sym) ; similarly
|
||||
(help-xref-button 9 'help-function sym)))
|
||||
((match-string 5) ; `face'
|
||||
(and (facep sym)
|
||||
(help-xref-button 9 'help-face sym)))
|
||||
((match-string 6)) ; nothing for `symbol'
|
||||
((match-string 7)
|
||||
(help-xref-button 9 'help-function-def sym))
|
||||
((cl-some (lambda (x) (funcall (nth 1 x) sym))
|
||||
describe-symbol-backends)
|
||||
(help-xref-button 9 'help-symbol sym)))))))
|
||||
;; An obvious case of a key substitution:
|
||||
(save-excursion
|
||||
(while (re-search-forward
|
||||
|
@ -81,7 +81,7 @@ Lisp concepts such as car, cdr, cons cell and list.")
|
||||
(insert (format fmt fn))
|
||||
(goto-char (point-min))
|
||||
(re-search-forward help-xref-symbol-regexp)
|
||||
(help-xref-button 8 'help-function)
|
||||
(help-xref-button 9 'help-function)
|
||||
(should-not (button-at (1- beg)))
|
||||
(should-not (button-at (+ beg (length (symbol-name fn)))))
|
||||
(should (eq (button-type (button-at beg)) 'help-function))))))
|
||||
|
Loading…
Reference in New Issue
Block a user