Make C-h S in Customize buffers work more reliably

* lisp/cus-edit.el (custom-unlispify-menu-entry): Put a property
on the returned string so that we can determine what the symbol
was after the fact.

* lisp/info-look.el (info-lookup-guess-default*): Allow lambda
forms as rules.
(:mode): Use the stored symbol.
(info-lookup-guess-custom-symbol): No longer used; mark as
obsolete (bug#41905).
This commit is contained in:
Lars Ingebrigtsen 2020-09-06 14:15:41 +02:00
parent 92bec37d56
commit d5c399b4d4
2 changed files with 6 additions and 3 deletions

View file

@ -561,7 +561,7 @@ value unless you are sure you know what it does."
(unless no-suffix
(goto-char (point-max))
(insert "..."))
(buffer-string)))))
(propertize (buffer-string) 'custom-data symbol)))))
(defcustom custom-unlispify-tag-names t
"Display tag names as words instead of symbols if non-nil."

View file

@ -557,7 +557,7 @@ Return nil if there is nothing appropriate in the buffer near point."
(info-lookup->regexp topic mode)))
(start (point)) end regexp subexp result)
(save-excursion
(if (symbolp rule)
(if (functionp rule)
(setq result (funcall rule))
(if (consp rule)
(setq regexp (car rule)
@ -610,6 +610,7 @@ Return nil if there is nothing appropriate in the buffer near point."
(defun info-lookup-guess-custom-symbol ()
"Get symbol at point in custom buffers."
(declare (obsolete nil "28.1"))
(condition-case nil
(save-excursion
(let ((case-fold-search t)
@ -1065,7 +1066,9 @@ Return nil if there is nothing appropriate in the buffer near point."
:mode 'Custom-mode
:ignore-case t
:regexp "[^][()`',:\" \t\n]+"
:parse-rule 'info-lookup-guess-custom-symbol
:parse-rule (lambda ()
(when-let ((symbol (get-text-property (point) 'custom-data)))
(symbol-name symbol)))
:other-modes '(emacs-lisp-mode))
(info-lookup-maybe-add-help