From 072512414efa80a680d9380ad8b7c9d1e2a1c1a6 Mon Sep 17 00:00:00 2001 From: Lars Ingebrigtsen Date: Mon, 19 Jul 2021 18:35:09 +0200 Subject: [PATCH] Make the `s' command in *Help* work for Lisp variables defined in C * lisp/help-fns.el (describe-variable): Store the type. * lisp/help-mode.el (help-view-source): Use the type. This fixes the problem when looking for a variable defined in a C file. --- lisp/help-fns.el | 4 +++- lisp/help-mode.el | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 81d7f23fe3c..7641774615d 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -1078,6 +1078,7 @@ it is displayed along with the global value." (with-current-buffer standard-output (setq help-mode--current-data (list :symbol variable + :type 'variable :file file-name)) (save-excursion (re-search-backward (substitute-command-keys @@ -1089,7 +1090,8 @@ it is displayed along with the global value." "It is void as a variable." "Its ")) (with-current-buffer standard-output - (setq help-mode--current-data (list :symbol variable))) + (setq help-mode--current-data (list :symbol variable + :type 'variable))) (if valvoid " is void as a variable." (substitute-command-keys "'s "))))) diff --git a/lisp/help-mode.el b/lisp/help-mode.el index 4e73551cfb3..3976a9ac4e5 100644 --- a/lisp/help-mode.el +++ b/lisp/help-mode.el @@ -738,8 +738,10 @@ See `help-make-xrefs'." (interactive nil help-mode) (unless (plist-get help-mode--current-data :file) (error "Source file for the current help item is not defined")) - (help-function-def--button-function (plist-get help-mode--current-data :symbol) - (plist-get help-mode--current-data :file))) + (help-function-def--button-function + (plist-get help-mode--current-data :symbol) + (plist-get help-mode--current-data :file) + (plist-get help-mode--current-data :type))) (defun help-goto-info () "View the *info* node of the current help item." -- 2.39.2