From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.devel Subject: Info-history-forward Date: Tue, 28 Dec 2004 04:28:45 +0200 Organization: JURTA Message-ID: <87vfancde2.fsf@jurta.org> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1104205061 22897 80.91.229.6 (28 Dec 2004 03:37:41 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 28 Dec 2004 03:37:41 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Dec 28 04:37:35 2004 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1Cj8Aw-0008Je-00 for ; Tue, 28 Dec 2004 04:37:35 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Cj8Lm-0000TF-CI for ged-emacs-devel@m.gmane.org; Mon, 27 Dec 2004 22:48:46 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.33) id 1Cj8LP-0000Ql-LX for emacs-devel@gnu.org; Mon, 27 Dec 2004 22:48:23 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.33) id 1Cj8LM-0000OO-FW for emacs-devel@gnu.org; Mon, 27 Dec 2004 22:48:21 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.33) id 1Cj8LL-0000Ni-Ma for emacs-devel@gnu.org; Mon, 27 Dec 2004 22:48:19 -0500 Original-Received: from [194.126.101.98] (helo=MXR-1.estpak.ee) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Cj87V-0005CV-H4 for emacs-devel@gnu.org; Mon, 27 Dec 2004 22:34:01 -0500 Original-Received: from mail.neti.ee (80-235-41-238-dsl.mus.estpak.ee [80.235.41.238]) by MXR-1.estpak.ee (Postfix) with ESMTP id A1CD61445C3 for ; Tue, 28 Dec 2004 05:33:56 +0200 (EET) Original-To: emacs-devel@gnu.org User-Agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux) X-Virus-Scanned: by amavisd-new-2.2.1 (20041222) (Debian) at neti.ee X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:31502 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:31502 I'd like to provide an enhancement that people have requested for a long time. Info has the `l' command which moves one step back through the history. But there is no symmetric command to move forward. Here is a simple implementation. It works like `Forward' button in web browsers. There is a free key binding "r" in Info-mode-map suitable for `Info-history-forward'. It has several mnemonics like "return", or even "right" whereas opposite "l" would mean "left" representing imaginable direction of moving through the Info history. Index: lisp/info.el =================================================================== RCS file: /cvsroot/emacs/emacs/lisp/info.el,v retrieving revision 1.413 diff -u -r1.413 info.el --- lisp/info.el 13 Dec 2004 19:31:32 -0000 1.413 +++ lisp/info.el 28 Dec 2004 02:17:19 -0000 @@ -47,6 +47,10 @@ "Stack of info nodes user has visited. Each element of list is a list (FILENAME NODENAME BUFFERPOS).") +(defvar Info-history-forward nil + "Stack of info nodes user has visited with `Info-last' command. +Each element of list is a list (FILENAME NODENAME BUFFERPOS).") + (defvar Info-history-list nil "List of all info nodes user has visited. Each element of list is a list (FILENAME NODENAME).") @@ -1295,7 +1308,8 @@ ;; Add a new unique history item to full history list (let ((new-history (list Info-current-file Info-current-node))) (setq Info-history-list - (cons new-history (delete new-history Info-history-list)))) + (cons new-history (delete new-history Info-history-list))) + (setq Info-history-forward nil)) (if (not (eq Info-fontify-maximum-menu-size nil)) (Info-fontify-node)) (Info-display-images-node) @@ -1736,13 +1751,31 @@ (interactive) (or Info-history (error "This is the first Info node you looked at")) - (let (filename nodename opoint) + (let ((history-forward + (cons (list Info-current-file Info-current-node (point)) + Info-history-forward)) + filename nodename opoint) (setq filename (car (car Info-history))) (setq nodename (car (cdr (car Info-history)))) (setq opoint (car (cdr (cdr (car Info-history))))) (setq Info-history (cdr Info-history)) (Info-find-node filename nodename) (setq Info-history (cdr Info-history)) + (setq Info-history-forward history-forward) + (goto-char opoint))) + +(defun Info-history-forward () + "Go forward in the history of visited nodes." + (interactive) + (or Info-history-forward + (error "This is the last Info node you looked at")) + (let ((history-forward (cdr Info-history-forward)) + filename nodename opoint) + (setq filename (car (car Info-history-forward))) + (setq nodename (car (cdr (car Info-history-forward)))) + (setq opoint (car (cdr (cdr (car Info-history-forward))))) + (Info-find-node filename nodename) + (setq Info-history-forward history-forward) (goto-char opoint))) ;;;###autoload @@ -2900,6 +2933,7 @@ (define-key Info-mode-map "n" 'Info-next) (define-key Info-mode-map "p" 'Info-prev) (define-key Info-mode-map "q" 'Info-exit) + (define-key Info-mode-map "r" 'Info-history-forward) (define-key Info-mode-map "s" 'Info-search) (define-key Info-mode-map "S" 'Info-search-case-sensitively) ;; For consistency with Rmail. @@ -2951,8 +2985,10 @@ :help "Search for another occurrence of regular expression"] ["Go to Node..." Info-goto-node :help "Go to a named node"] - ["Last" Info-last :active Info-history + ["Back history (last)" Info-last :active Info-history :help "Go to the last node you were at"] + ["Forward history" Info-history-forward :active Info-history-forward + :help "Go to the previous node left with Info-last"] ["History" Info-history :active Info-history-list :help "Go to menu of visited nodes"] ["Table of Contents" Info-toc @@ -3101,6 +3137,7 @@ \\[Info-directory] Go to the Info directory node. \\[Info-follow-reference] Follow a cross reference. Reads name of reference. \\[Info-last] Move to the last node you were at. +\\[Info-history-forward] Move to the previous node left with Info-last. \\[Info-history] Go to menu of visited nodes. \\[Info-toc] Go to table of contents of the current Info file. \\[Info-top-node] Go to the Top node of this file. @@ -3157,6 +3194,7 @@ (make-local-variable 'Info-tag-table-buffer) (setq Info-tag-table-buffer nil) (make-local-variable 'Info-history) + (make-local-variable 'Info-history-forward) (make-local-variable 'Info-index-alternatives) (setq header-line-format (if Info-use-header-line -- Juri Linkov http://www.jurta.org/emacs/