emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#37184: closed (Browser-like Info-history button me


From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#37184: closed (Browser-like Info-history button menu)
Date: Tue, 27 Aug 2019 20:50:02 +0000

Your message dated Tue, 27 Aug 2019 23:49:24 +0300
with message-id <address@hidden>
and subject line Re: bug#37184: Browser-like Info-history button menu
has caused the debbugs.gnu.org bug report #37184,
regarding Browser-like Info-history button menu
to be marked as done.

(If you believe you have received this mail in error, please contact
address@hidden.)


-- 
37184: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=37184
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: Browser-like Info-history button menu Date: Sun, 25 Aug 2019 23:50:28 +0300 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)
Severity: wishlist
Tags: patch

Clicking on the history back button with mouse-3 or holding mouse-1
in web browsers displays a menu with a list of previous/next visited pages.

The following patch implements the same in the tool-bar of Info-mode:

diff --git a/lisp/info.el b/lisp/info.el
index 17a2d63e6d..b914e2a813 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -4059,6 +4059,8 @@ Info-mode-map
     (define-key map [follow-link] 'mouse-face)
     (define-key map [XF86Back] 'Info-history-back)
     (define-key map [XF86Forward] 'Info-history-forward)
+    (define-key map [tool-bar C-Back\ in\ history] 'Info-history-back-menu)
+    (define-key map [tool-bar C-Forward\ in\ history] 
'Info-history-forward-menu)
     map)
   "Keymap containing Info commands.")
 
@@ -4151,6 +4153,36 @@ info-tool-bar-map
                                   :vert-only t)
     map))
 
+(defun Info-history-menu (e name history command)
+  (let* ((i (length history))
+         (map (make-sparse-keymap name)))
+    (mapc (lambda (history)
+            (let ((file (nth 0 history))
+                  (node (nth 1 history)))
+              (when (stringp file)
+               (setq file (file-name-sans-extension
+                           (file-name-nondirectory file))))
+              (define-key map (vector (intern (format "history-%i" i)))
+                `(menu-item ,(format "(%s) %s" file node)
+                            (lambda ()
+                              (interactive)
+                              (dotimes (_ ,i) (call-interactively 
',command))))))
+            (setq i (1- i)))
+          (reverse history))
+    (let* ((selection (x-popup-menu e map))
+          (binding (and selection (lookup-key map (vector (car selection))))))
+      (if binding (call-interactively binding)))))
+
+(defun Info-history-back-menu (e)
+  "Pop up the menu with a list of previously visited Info nodes."
+  (interactive "e")
+  (Info-history-menu e "Back in history" Info-history 'Info-history-back))
+
+(defun Info-history-forward-menu (e)
+  "Pop up the menu with a list of Info nodes visited with ‘Info-history-back’."
+  (interactive "e")
+  (Info-history-menu e "Forward in history" Info-history-forward 
'Info-history-forward))
+
 (defvar Info-menu-last-node nil)
 ;; Last node the menu was created for.
 ;; Value is a list, (FILE-NAME NODE-NAME).

--- End Message ---
--- Begin Message --- Subject: Re: bug#37184: Browser-like Info-history button menu Date: Tue, 27 Aug 2019 23:49:24 +0300 User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)
>> > Thanks, but please always accompany such changes with the relevant
>> > documentation: NEWS and possibly the manual.
>> 
>> Please see the documentation updates in the new patch:
>
> LGTM, thanks.

Pushed to master.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]