From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: martin rudalics Newsgroups: gmane.emacs.bugs Subject: bug#36767: 26.1; request: add more quick keys to the *Help* buffer Date: Sat, 19 Jun 2021 11:08:52 +0200 Message-ID: References: <87mtrrq7t7.fsf@gnus.org> <87eed0nsez.fsf@mail.linkov.net> <83bl83zp5h.fsf@gnu.org> <874kdv63ml.fsf@gmail.com> <8335tfzbfr.fsf@gnu.org> <87wnqrgs5k.fsf@gmx.net> <83o8c3xmdi.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------E49004CBAC22A2EA3B19A066" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="13165"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 36767@debbugs.gnu.org, rpluim@gmail.com, emacsuser@freemail.hu, larsi@gnus.org, juri@linkov.net To: Eli Zaretskii , Stephen Berman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jun 19 11:10:24 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1luWzf-0003H1-Tu for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Jun 2021 11:10:24 +0200 Original-Received: from localhost ([::1]:35036 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1luWze-0006sR-1X for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 19 Jun 2021 05:10:22 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:36378) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1luWzK-0006sI-SL for bug-gnu-emacs@gnu.org; Sat, 19 Jun 2021 05:10:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:47016) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1luWzK-0008TI-KR for bug-gnu-emacs@gnu.org; Sat, 19 Jun 2021 05:10:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1luWzK-0007uF-EF for bug-gnu-emacs@gnu.org; Sat, 19 Jun 2021 05:10:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: martin rudalics Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 19 Jun 2021 09:10:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 36767 X-GNU-PR-Package: emacs Original-Received: via spool by 36767-submit@debbugs.gnu.org id=B36767.162409375530331 (code B ref 36767); Sat, 19 Jun 2021 09:10:02 +0000 Original-Received: (at 36767) by debbugs.gnu.org; 19 Jun 2021 09:09:15 +0000 Original-Received: from localhost ([127.0.0.1]:58562 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1luWyY-0007t9-JP for submit@debbugs.gnu.org; Sat, 19 Jun 2021 05:09:14 -0400 Original-Received: from mout.gmx.net ([212.227.15.15]:59729) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1luWyW-0007su-Px for 36767@debbugs.gnu.org; Sat, 19 Jun 2021 05:09:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1624093734; bh=CS8okpD36MazjMh/1ut84/Bk9zaY18U0HxmS/ZrFZHU=; h=X-UI-Sender-Class:Subject:To:Cc:References:From:Date:In-Reply-To; b=TWDHVLwf4je9Mq09cxYD98K+Aag2G1g3Sya4wcwfN350aJEFiw/bYfn4UMPBUBd4g j/G0r+nl6evFF6nwdCAlTKHqfRsYmAb/sh9wVg8GvFjzhcoyzCvkb7NG7QpF6oG93E Xpfv/Hrmf6HBs+01ZBtssryhX1MD+OMfkMeOhGrY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [192.168.1.101] ([46.125.249.14]) by mail.gmx.net (mrgmx005 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MAfYw-1m16XW0pQG-00B0ht; Sat, 19 Jun 2021 11:08:54 +0200 In-Reply-To: <83o8c3xmdi.fsf@gnu.org> Content-Language: en-US X-Provags-ID: V03:K1:yq49PL6cS+Xb5hrjXok3IVrFiQ8Nz7xWIHV0/GaGv6pgoHHpsNG b0dcUMve9JIv5gB5aHfyOt8dhWREe2KZh/8Az8bHAGtVRLVs+S3C32CQ8mJFkdwIlqZdz3O UOCfogxNrMzfYytwuZYSEa6t0+TcmXO/5DI1UhomVth2iW66+/jK95RW6u7NsNKqQODXWyW lxi6U1DYb+EcFHwlKHfEg== X-UI-Out-Filterresults: notjunk:1;V03:K0:flYcRH4hr8g=:OkLHHzeG/N7xidRQpNGkLM WG5WwTlh2D2PBXk5vPW3+EuKlTikmZM8S7GIDYDyohVlb5kp9HZBq5pPxIf7JY2MtLTYwO7Vr VXh8FlU//yUSSw8CraaRmJp3WsVHuiI+5lAcKwZhfrZLNiVs16M33MiX3U0StYgmhis//4bew OnxGP3NmY3PlVBa4N+yXzZiRYudRlUMuEEzH6WbcmqTcPaHe+/7FIXhnUkZ8mXDBZt4bvuzJt EtSt64gTABXw7sgBwcSaBGYOR95V/rV9xajVxW2TRNIxkNcnsNBMP+I2VRuvDVtGL1sNRKyoQ aoSFqd546xmcbmbrfrTkBHlhoA+2smyLsfKDZGsL13zgMhvxeu+JrqXneSSJmBA/LsdeKE4yf jSqYH8O2TQp5lWAZSsJgmAA2+jbJsDiKEJNmZ/rNhQkZqk1ACqIjtWd8iYFCVb8onoHy8FUDS TXibFEG3IXk3Cf9YC3cyCGvN1Zu4nXcHazaiaaaliHtQsHh/q191yhn31hK4clTLQ6gZ9LcxY 6bqi1DhoGY7gLnxiFpvxkp9244HqKFDeK4BGSRFJnR5ofogXafPsJB0QMHb132W4XhzrXbcTL EyfPCEceFePI1KcW9FGvJk3Raoq+37m86+KZtRdwEZGSLjEGnAzBn8iR/2+ud0GbRSK29hSTW W7oXwSVdkfCmDjebBn0TbR8wFcycz9u3YpLhkWYflUnEVLNsMmgbBo2Qrr6fSpUEWowWmP5WW Wivj9wM77R4ogOzqdoB+QqQUYvj58wi/woyOz49G1FZI7xnDFo4SUaxutAP9hBuRwbTec+FD X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:208711 Archived-At: This is a multi-part message in MIME format. --------------E49004CBAC22A2EA3B19A066 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit > 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 --------------E49004CBAC22A2EA3B19A066 Content-Type: text/x-patch; name="help-mode.diff" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="help-mode.diff" =2D-- 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 --------------E49004CBAC22A2EA3B19A066--