GNU bug report logs - #71117
30.0.50; output of describe-function

Previous Next

Package: emacs;

Reported by: Andreas Röhler <andreas.roehler <at> easy-emacs.de>

Date: Wed, 22 May 2024 13:54:01 UTC

Severity: normal

Found in version 30.0.50

Done: Andrea Corallo <acorallo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #41 received at 71117 <at> debbugs.gnu.org (full text, mbox):

From: Andrea Corallo <acorallo <at> gnu.org>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 71117 <at> debbugs.gnu.org, andreas.roehler <at> easy-emacs.de,
 kevin.legouguec <at> gmail.com
Subject: Re: bug#71117: 30.0.50; output of describe-function
Date: Tue, 28 May 2024 15:42:30 -0400
[Message part 1 (text/plain, inline)]
Eli Zaretskii <eliz <at> gnu.org> writes:

>> From: Andrea Corallo <acorallo <at> gnu.org>
>> Cc: Kévin Le Gouguec <kevin.legouguec <at> gmail.com>,
>>   71117 <at> debbugs.gnu.org,
>>   andreas.roehler <at> easy-emacs.de
>> Date: Tue, 28 May 2024 13:44:33 -0400
>> 
>> >> Were you thinking of a command that specifically targets the symbol from
>> >> a displayed *Help* buffer, so the user would do e.g.
>> >> 
>> >> C-h v VAR RET   ; shows *Help* for VAR
>> >> C-h SOMETHING   ; finds source for VAR
>> >> 
>> >> where C-h SOMETHING's implementation would do (a smarter version of)
>> >> (with-current-buffer "*Help*"
>> >>   (help-view-source))
>> >> 
>> >> ?
>> >
>> > Yes, exactly.
>> 
>> Something like the attached?
>> 
>> It makes C-h z FUNCTION find the source for FUNCTION.
>
> I might be mistaken, but I don't think this is what I had in mind.

You are not.

> My use case is exactly like described above: I type "C-h v" or "C-h
> f", which displays the *Help* buffer in the other window.  Then I want
> to go to the source where the variable or function are defined, but
> without the need to switch to the window showing *Help*.

The attached is my understanding of what we want (still using C-h z).
Kévin's mail make me suspect I've been too naive but anyway 😅...

Thanks

  Andrea

[0001-Add-help-find-source-and-bind-it-to-C-h-z.patch (text/x-diff, inline)]
From 569eb50994cd0841dcfbc970d574d945aa43b064 Mon Sep 17 00:00:00 2001
From: Andrea Corallo <acorallo <at> gnu.org>
Date: Tue, 28 May 2024 21:06:21 +0200
Subject: [PATCH] Add 'help-find-source' and bind it to C-h z

* lisp/help-fns.el (help-find-source): New function.
* lisp/help.el (help-map): Bind 'help-find-source' to C-h z.
(help-for-help): Add 'help-find-source'.
---
 lisp/help-fns.el | 9 +++++++++
 lisp/help.el     | 2 ++
 2 files changed, 11 insertions(+)

diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index a202c2d247e..74760197c8b 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -298,6 +298,15 @@ describe-function
           ;; Return the text we displayed.
           (buffer-string))))))
 
+;;;###autoload
+(defun help-find-source ()
+  "Switch to a buffer visiting the source of what is being described in *Help*."
+  (interactive)
+  (if-let ((help-buffer (get-buffer "*Help*")))
+      (with-current-buffer help-buffer
+          (help-view-source))
+    (error "No *Help* buffer found")))
+
 ;;;###autoload
 (defun describe-command (command)
   "Display the full documentation of COMMAND (a symbol).
diff --git a/lisp/help.el b/lisp/help.el
index 616a45328fd..aa835008358 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -114,6 +114,7 @@ help-map
   "R"    #'info-display-manual
   "s"    #'describe-syntax
   "t"    #'help-with-tutorial
+  "z"    #'help-find-source
   "v"    #'describe-variable
   "w"    #'where-is
   "x"    #'describe-command
@@ -418,6 +419,7 @@ 'help
         "Search documentation of functions, variables, and other items")
        ("describe-command" "Show help for command")
        ("describe-function" "Show help for function")
+       ("help-find-source" "Show the source for what's being described in *Help*")
        ("describe-variable" "Show help for variable")
        ("describe-symbol" "Show help for function or variable"))
       ("Manuals"
-- 
2.34.1


This bug report was last modified 357 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.