[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#12253: Restore window start position
From: |
Juri Linkov |
Subject: |
bug#12253: Restore window start position |
Date: |
Thu, 23 Aug 2012 02:38:44 +0300 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (x86_64-pc-linux-gnu) |
> I fully agree with you. But I was curious whether setting the window
> start position should be allowed to override any (goto-char opoint)
> following or preceding it (just in case a window got resized during
> navigation).
I see what you mean - the problem handled by
`set-window-buffer-start-and-point'. Of course,
this function can't be used in Info, but its precautions
of not forcing window-start (the argument NOFORCE
of `set-window-start') and the order of calling
`set-window-start' and `goto-char' afterward
can be applied to Info like in the following patch
(I guess using `set-window-point' instead of `goto-char'
is not applicable to Info):
=== modified file 'lisp/info.el'
--- lisp/info.el 2012-08-21 00:12:42 +0000
+++ lisp/info.el 2012-08-22 23:35:48 +0000
@@ -40,11 +40,11 @@ (defgroup info nil
(defvar Info-history nil
"Stack of Info nodes user has visited.
-Each element of the stack is a list (FILENAME NODENAME BUFFERPOS).")
+Each element of the stack is a list (FILENAME NODENAME BUFFERPOS WINDOWPOS).")
(defvar Info-history-forward nil
"Stack of Info nodes user has visited with `Info-history-back' command.
-Each element of the stack is a list (FILENAME NODENAME BUFFERPOS).")
+Each element of the stack is a list (FILENAME NODENAME BUFFERPOS WINDOWPOS).")
(defvar Info-history-list nil
"List of all Info nodes user has visited.
@@ -922,7 +925,7 @@ (defun Info-find-node (filename nodename
;; Record the node we are leaving, if we were in one.
(and (not no-going-back)
Info-current-file
- (push (list Info-current-file Info-current-node (point))
+ (push (list Info-current-file Info-current-node (point) (window-start))
Info-history))
(Info-find-node-2 filename nodename no-going-back))
@@ -956,7 +959,7 @@ (defun Info-revert-find-node (filename n
(pline (count-lines (point-min) (line-beginning-position)))
(wline (count-lines (point-min) (window-start)))
(new-history (and Info-current-file
- (list Info-current-file Info-current-node (point)))))
+ (list Info-current-file Info-current-node (point)
(window-start)))))
;; When `Info-current-file' is nil, `Info-find-node-2' rereads the file.
(setq Info-current-file nil)
(Info-find-node filename nodename)
@@ -1226,7 +1229,8 @@ (defun Info-find-node-2 (filename nodena
(let ((hist (car Info-history)))
(setq Info-history (cdr Info-history))
(Info-find-node (nth 0 hist) (nth 1 hist) t)
- (goto-char (nth 2 hist))))))
+ (set-window-start (selected-window) (nth 3 hist) t)
+ (goto-char (nth 2 hist))))))
;; Cache the contents of the (virtual) dir file, once we have merged
;; it for the first time, so we can save time subsequently.
@@ -2002,7 +2008,7 @@ (defun Info-search (regexp &optional bou
(equal ofile Info-current-file))
(and isearch-mode isearch-wrapped
(eq opoint (if isearch-forward opoint-min opoint-max)))
- (setq Info-history (cons (list ofile onode opoint)
+ (setq Info-history (cons (list ofile onode opoint ostart)
Info-history))))))
(defun Info-search-case-sensitively ()
@@ -2208,16 +2214,18 @@ (defun Info-history-back ()
(or Info-history
(user-error "This is the first Info node you looked at"))
(let ((history-forward
- (cons (list Info-current-file Info-current-node (point))
+ (cons (list Info-current-file Info-current-node (point) (window-start))
Info-history-forward))
- filename nodename opoint)
+ filename nodename opoint ostart)
(setq filename (car (car Info-history)))
(setq nodename (car (cdr (car Info-history))))
(setq opoint (car (cdr (cdr (car Info-history)))))
+ (setq ostart (car (cdr (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)
+ (set-window-start (selected-window) ostart t)
(goto-char opoint)))
(defalias 'Info-last 'Info-history-back)
@@ -2228,12 +2236,14 @@ (defun Info-history-forward ()
(or Info-history-forward
(user-error "This is the last Info node you looked at"))
(let ((history-forward (cdr Info-history-forward))
- filename nodename opoint)
+ filename nodename opoint ostart)
(setq filename (car (car Info-history-forward)))
(setq nodename (car (cdr (car Info-history-forward))))
(setq opoint (car (cdr (cdr (car Info-history-forward)))))
+ (setq ostart (car (cdr (cdr (cdr (car Info-history-forward))))))
(Info-find-node filename nodename)
(setq Info-history-forward history-forward)
+ (set-window-start (selected-window) ostart t)
(goto-char opoint)))
(add-to-list 'Info-virtual-files
@@ -4307,7 +4317,7 @@ (defun Info-find-emacs-command-nodes (co
(setq where
(cons (list Info-current-file
(match-string-no-properties 2)
- 0)
+ 0 0)
where))
(setq line-number (and (match-beginning 3)
(string-to-number (match-string 3)))))
- bug#12253: Restore window start position, Juri Linkov, 2012/08/21
- bug#12253: Restore window start position, martin rudalics, 2012/08/22
- bug#12253: Restore window start position,
Juri Linkov <=
- bug#12253: Restore window start position, martin rudalics, 2012/08/23
- bug#12253: Restore window start position, Juri Linkov, 2012/08/23
- bug#12253: Restore window start position, martin rudalics, 2012/08/24
- bug#12253: Restore window start position, Juri Linkov, 2012/08/24
- bug#12253: Restore window start position, martin rudalics, 2012/08/25
- bug#12253: Restore window start position, Juri Linkov, 2012/08/25
- bug#12253: Restore window start position, Juri Linkov, 2012/08/28