From: martin rudalics <rudalics@gmx.at>
To: Eli Zaretskii <eliz@gnu.org>, Stephen Berman <stephen.berman@gmx.net>
Cc: 36767@debbugs.gnu.org, rpluim@gmail.com, emacsuser@freemail.hu,
larsi@gnus.org, juri@linkov.net
Subject: bug#36767: 26.1; request: add more quick keys to the *Help* buffer
Date: Sat, 19 Jun 2021 11:08:52 +0200 [thread overview]
Message-ID: <d66f261b-0c94-ecd3-4e3a-588b324e91e2@gmx.at> (raw)
In-Reply-To: <83o8c3xmdi.fsf@gnu.org>
[-- Attachment #1: Type: text/plain, Size: 558 bytes --]
> Thanks. But what I'd like to have is not a way of burying the Help
> window, because I frequently need to consult it for quite some time.
> What I'd like to have is a way of using its buttons without going to
> that other window first. For example, I'd love a command, bound to a
> key globally, that would display the source of the function in the
> same window as the Help window, then allow me to go back to the Help
> window.
The attached is an attempt to do that. Buggy and the nomenclature is
immature but I hope you get the idea.
martin
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: help-mode.diff --]
[-- Type: text/x-patch; name="help-mode.diff", Size: 3230 bytes --]
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -200,6 +200,66 @@ 'help-customize-face
(customize-face v))
'help-echo (purecopy "mouse-2, RET: customize face"))
+(defvar help-function-def-same-window nil)
+(defvar help-function-def-window nil)
+(defvar help-function-def-buffer nil)
+(defvar help-function-def-quit-restore nil)
+
+(defun help-forward-same-window ()
+ "Go to link following point of help window in that window."
+ (interactive)
+ (let* ((buffer (get-buffer "*Help*"))
+ (window (and buffer (get-buffer-window buffer))))
+ (if window
+ (with-selected-window window
+ (save-excursion
+ (let ((button (forward-button (point-min)))
+ (help-function-def-same-window t))
+ (if button
+ (progn
+ (setq help-function-def-window window)
+ (setq help-function-def-buffer buffer)
+ (setq help-function-def-quit-restore
+ (window-parameter window 'quit-restore))
+ (button-activate button))
+ (message "No link found")))))
+ (message "No help window found"))))
+
+(defun help-backward-same-window ()
+ "Go back to help window."
+ (interactive)
+ (if (and (window-live-p help-function-def-window)
+ (buffer-live-p help-function-def-buffer))
+ (let ((buffer (window-buffer help-function-def-window)))
+ (set-window-buffer
+ help-function-def-window help-function-def-buffer)
+ (when help-function-def-quit-restore
+ ;; Pretend that window's buffer was never display in window.
+ (set-window-prev-buffers
+ help-function-def-window
+ (assq-delete-all
+ buffer (window-prev-buffers help-function-def-window)))
+ (set-window-parameter
+ help-function-def-window 'quit-restore
+ help-function-def-quit-restore))
+ (setq help-function-def-window nil)
+ (setq help-function-def-buffer nil)
+ (setq help-function-def-quit-restore nil))
+ (message "Cannot find help window or its buffer")))
+
+(defun help-window-quit ()
+ "Quit any help window found."
+ (interactive)
+ (let* ((buffer (get-buffer "*Help*"))
+ (window (and buffer (get-buffer-window buffer))))
+ (if window
+ (quit-restore-window window)
+ (message "No help window found"))))
+
+(define-key goto-map "f" 'help-forward-same-window)
+(define-key goto-map "b" 'help-backward-same-window)
+(define-key goto-map "q" 'help-window-quit)
+
(defun help-function-def--button-function (fun &optional file type)
(or file
(setq file (find-lisp-object-file-name fun type)))
@@ -214,7 +274,9 @@ help-function-def--button-function
(let* ((location
(find-function-search-for-symbol fun type file))
(position (cdr location)))
- (pop-to-buffer (car location))
+ (if help-function-def-same-window
+ (pop-to-buffer-same-window (car location))
+ (pop-to-buffer (car location)))
(run-hooks 'find-function-after-hook)
(if position
(progn
next prev parent reply other threads:[~2021-06-19 9:08 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-22 19:53 bug#36767: 26.1; request: add more quick keys to the *Help* buffer ndame
2019-07-22 20:49 ` Drew Adams
2019-07-28 0:10 ` Basil L. Contovounesios
2021-06-15 18:52 ` Lars Ingebrigtsen
2021-06-17 20:34 ` Juri Linkov
2021-06-18 6:02 ` Eli Zaretskii
2021-06-18 7:20 ` Robert Pluim
2021-06-18 10:58 ` Eli Zaretskii
2021-06-18 14:21 ` bug#36767: [External] : " Drew Adams
2021-06-18 14:32 ` Stephen Berman
2021-06-18 14:45 ` Eli Zaretskii
2021-06-18 16:02 ` Stephen Berman
2021-06-18 18:25 ` Eli Zaretskii
2021-06-19 9:08 ` martin rudalics [this message]
2021-06-19 9:27 ` Eli Zaretskii
2021-06-20 9:21 ` martin rudalics
2021-06-18 16:21 ` bug#36767: [External] : " Drew Adams
2021-06-18 14:12 ` Drew Adams
2021-06-18 19:14 ` Juri Linkov
2021-06-18 19:21 ` Eli Zaretskii
2021-06-19 23:15 ` Juri Linkov
[not found] ` <AM9PR09MB49779C8B93EFFB329EB8E5A596A29@AM9PR09MB4977.eurprd09.prod.outlook.com>
[not found] ` <83y27nvnb4.fsf@gnu.org>
[not found] ` <AM9PR09MB497767EDF180DE0C3EE15F4396A39@AM9PR09MB4977.eurprd09.prod.outlook.com>
[not found] ` <83ilyrvgda.fsf@gnu.org>
[not found] ` <AM9PR09MB497720FA603D3B7FC4D4739196A39@AM9PR09MB4977.eurprd09.prod.outlook.com>
2021-09-23 20:54 ` Lars Ingebrigtsen
[not found] ` <83h7ebv39d.fsf@gnu.org>
[not found] ` <AM9PR09MB49771D1ECD11701DEFB77C7A96A39@AM9PR09MB4977.eurprd09.prod.outlook.com>
[not found] ` <838rznusle.fsf@gnu.org>
2021-09-24 7:16 ` Arthur Miller
2021-09-24 15:31 ` Juri Linkov
2021-09-24 16:12 ` Eli Zaretskii
2021-09-24 19:36 ` Arthur Miller
2021-09-24 19:39 ` Arthur Miller
2021-09-24 19:57 ` Arthur Miller
2021-09-25 6:09 ` Eli Zaretskii
2021-09-25 14:41 ` Arthur Miller
2021-09-25 14:59 ` Eli Zaretskii
2021-09-25 16:22 ` Arthur Miller
2021-09-25 16:26 ` Eli Zaretskii
2021-09-25 17:08 ` Arthur Miller
2021-09-25 17:20 ` Eli Zaretskii
2021-09-25 20:15 ` Arthur Miller
2021-09-26 21:52 ` Arthur Miller
2021-09-26 9:11 ` martin rudalics
2021-09-26 16:11 ` Arthur Miller
2021-09-26 16:54 ` [External] : " Drew Adams
2021-09-26 21:51 ` Arthur Miller
2021-09-26 22:38 ` Drew Adams
2021-09-26 22:46 ` Arthur Miller
2021-09-26 17:51 ` martin rudalics
2021-09-26 21:48 ` Arthur Miller
2021-09-27 11:07 ` Exec help commands from other buffer (was bug#36767: 26.1; request: add more quick keys to the *Help* buffer) Arthur Miller
2021-09-27 19:59 ` Arthur Miller
2021-09-24 18:34 ` [External] : Re: bug#36767: 26.1; request: add more quick keys to the *Help* buffer Drew Adams
2021-09-24 19:34 ` Arthur Miller
2021-09-24 20:20 ` Arthur Miller
2021-09-24 20:33 ` Arthur Miller
2021-09-25 18:46 ` Juri Linkov
2021-06-19 11:58 ` Lars Ingebrigtsen
2021-06-19 12:22 ` Eli Zaretskii
2021-06-19 23:15 ` Juri Linkov
[not found] ` <AM9PR09MB4977DAFB86D88A4714C1C64196A29@AM9PR09MB4977.eurprd09.prod.outlook.com>
[not found] ` <87pmt0qomh.fsf@gnus.org>
[not found] ` <AM9PR09MB4977CCFA194C77F1ADF0015C96A29@AM9PR09MB4977.eurprd09.prod.outlook.com>
2021-09-23 20:42 ` Lars Ingebrigtsen
2021-09-23 23:09 ` bug#36767: [External] : " Drew Adams
[not found] ` <AM9PR09MB49770845B0C1B7CBB331E68A96A39@AM9PR09MB4977.eurprd09.prod.outlook.com>
2021-09-23 20:52 ` Lars Ingebrigtsen
2021-09-23 22:18 ` Arthur Miller
2021-09-26 9:11 ` martin rudalics
2021-09-26 9:40 ` Lars Ingebrigtsen
2021-09-26 9:55 ` Eli Zaretskii
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=d66f261b-0c94-ecd3-4e3a-588b324e91e2@gmx.at \
--to=rudalics@gmx.at \
--cc=36767@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=emacsuser@freemail.hu \
--cc=juri@linkov.net \
--cc=larsi@gnus.org \
--cc=rpluim@gmail.com \
--cc=stephen.berman@gmx.net \
/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.