From: Lars Ingebrigtsen Date: Sun, 6 Sep 2020 12:15:41 +0000 (+0200) Subject: Make C-h S in Customize buffers work more reliably X-Git-Tag: emacs-28.0.90~6221 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d5c399b4d41f48193bdef9571ef04d9a0531b905;p=emacs.git 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). --- diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index 7153ba40e13..3557dce5854 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -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." diff --git a/lisp/info-look.el b/lisp/info-look.el index 4e379cadef1..40f7f6003e7 100644 --- a/lisp/info-look.el +++ b/lisp/info-look.el @@ -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