* bug#37184: Browser-like Info-history button menu
@ 2019-08-25 20:50 Juri Linkov
2019-08-26 6:28 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2019-08-25 20:50 UTC (permalink / raw)
To: 37184
[-- Attachment #1: Type: text/plain, Size: 248 bytes --]
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:
[-- Attachment #2: Info-history-menu.patch --]
[-- Type: text/x-diff, Size: 2097 bytes --]
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).
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#37184: Browser-like Info-history button menu
2019-08-25 20:50 bug#37184: Browser-like Info-history button menu Juri Linkov
@ 2019-08-26 6:28 ` Eli Zaretskii
2019-08-26 22:27 ` Juri Linkov
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2019-08-26 6:28 UTC (permalink / raw)
To: Juri Linkov; +Cc: 37184
> From: Juri Linkov <juri@linkov.net>
> Date: Sun, 25 Aug 2019 23:50:28 +0300
>
> 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:
Thanks, but please always accompany such changes with the relevant
documentation: NEWS and possibly the manual.
^ permalink raw reply [flat|nested] 5+ messages in thread
* bug#37184: Browser-like Info-history button menu
2019-08-26 6:28 ` Eli Zaretskii
@ 2019-08-26 22:27 ` Juri Linkov
2019-08-27 6:11 ` Eli Zaretskii
0 siblings, 1 reply; 5+ messages in thread
From: Juri Linkov @ 2019-08-26 22:27 UTC (permalink / raw)
To: Eli Zaretskii; +Cc: 37184
[-- Attachment #1: Type: text/plain, Size: 402 bytes --]
>> 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:
>
> 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:
[-- Attachment #2: 37184_2.patch --]
[-- Type: text/x-diff, Size: 3441 bytes --]
diff --git a/doc/misc/info.texi b/doc/misc/info.texi
index cbdeaff50c..077e83e3c9 100644
--- a/doc/misc/info.texi
+++ b/doc/misc/info.texi
@@ -886,6 +886,14 @@ Help-Int
to revisit nodes in the history list in the forward direction, so that
@kbd{r} will return you to the node you came from by typing @kbd{l}.
+@cindex using tool-bar to navigate history
+ Clicking the mouse on the left arrow icon in the tool-bar while
+holding down the @key{CTRL} key in Emacs opens a menu of previously
+visited nodes: the same nodes that you can revisit by
+@code{Info-history-back}. Selecting a node after clicking on the
+right arrow icon revisits the same nodes as available by
+@code{Info-history-forward}.
+
@kindex L @r{(Info mode)}
@findex Info-history
@cindex history list of visited nodes
diff --git a/etc/NEWS b/etc/NEWS
index a03e2027a9..954ef2c146 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -953,6 +953,11 @@ early init file.
** Info
++++
+*** Clicking on the left/right arrow icon in the Info tool-bar while
+holding the Ctrl key pops up a menu of previously visited Info nodes
+where you can select a node to go back (like in browsers).
+
---
*** Info can now follow 'file://' protocol URLs.
The 'file://' URLs in Info documents can now be followed by passing
diff --git a/lisp/info.el b/lisp/info.el
index 17a2d63e6d..e22466af87 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).
^ permalink raw reply related [flat|nested] 5+ messages in thread
* bug#37184: Browser-like Info-history button menu
2019-08-26 22:27 ` Juri Linkov
@ 2019-08-27 6:11 ` Eli Zaretskii
2019-08-27 20:49 ` Juri Linkov
0 siblings, 1 reply; 5+ messages in thread
From: Eli Zaretskii @ 2019-08-27 6:11 UTC (permalink / raw)
To: Juri Linkov; +Cc: 37184
> From: Juri Linkov <juri@linkov.net>
> Cc: 37184@debbugs.gnu.org
> Date: Tue, 27 Aug 2019 01:27:37 +0300
>
> > 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.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-08-27 20:49 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-25 20:50 bug#37184: Browser-like Info-history button menu Juri Linkov
2019-08-26 6:28 ` Eli Zaretskii
2019-08-26 22:27 ` Juri Linkov
2019-08-27 6:11 ` Eli Zaretskii
2019-08-27 20:49 ` Juri Linkov
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).