all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Andrea Corallo <acorallo@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 71117@debbugs.gnu.org, andreas.roehler@easy-emacs.de,
	kevin.legouguec@gmail.com
Subject: bug#71117: 30.0.50; output of describe-function
Date: Tue, 28 May 2024 15:42:30 -0400	[thread overview]
Message-ID: <yp1ttihu3ix.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <86ikyxu7br.fsf@gnu.org> (Eli Zaretskii's message of "Tue, 28 May 2024 21:20:24 +0300")

[-- Attachment #1: Type: text/plain, Size: 1319 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Andrea Corallo <acorallo@gnu.org>
>> Cc: Kévin Le Gouguec <kevin.legouguec@gmail.com>,
>>   71117@debbugs.gnu.org,
>>   andreas.roehler@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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-help-find-source-and-bind-it-to-C-h-z.patch --]
[-- Type: text/x-diff, Size: 1916 bytes --]

From 569eb50994cd0841dcfbc970d574d945aa43b064 Mon Sep 17 00:00:00 2001
From: Andrea Corallo <acorallo@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


  reply	other threads:[~2024-05-28 19:42 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-22 13:53 bug#71117: 30.0.50; output of describe-function Andreas Röhler
2024-05-22 14:10 ` Eli Zaretskii
2024-05-22 17:46 ` Kévin Le Gouguec
2024-05-22 18:24   ` Eli Zaretskii
2024-05-22 22:22     ` Kévin Le Gouguec
2024-05-23  5:25       ` Eli Zaretskii
2024-05-28 17:44         ` Andrea Corallo
2024-05-28 18:20           ` Eli Zaretskii
2024-05-28 19:42             ` Andrea Corallo [this message]
2024-05-28 22:04               ` Kévin Le Gouguec
2024-05-28 22:25                 ` Andrea Corallo
2024-05-29 11:25                   ` Eli Zaretskii
2024-05-29 15:17                     ` Andrea Corallo
2024-05-29 15:54                       ` Eli Zaretskii
2024-05-29 16:04                         ` Andrea Corallo
2024-05-29 11:38                 ` Eli Zaretskii
2024-05-23  6:28   ` Juri Linkov
2024-05-23 11:51     ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-05-23 17:20       ` Juri Linkov
2024-05-23 20:23         ` Eshel Yaron via Bug reports for GNU Emacs, the Swiss army knife of text editors

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yp1ttihu3ix.fsf@fencepost.gnu.org \
    --to=acorallo@gnu.org \
    --cc=71117@debbugs.gnu.org \
    --cc=andreas.roehler@easy-emacs.de \
    --cc=eliz@gnu.org \
    --cc=kevin.legouguec@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.