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

[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: Sat, 25 Aug 2012 03:29:39 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.2.50 (x86_64-pc-linux-gnu)

> (set-window-point (window-in-direction 'below) (point-max))
>
> with the upper window selected, the lower window shows the (narrowed)
> end of *info* and
>
> (with-selected-window (window-in-direction 'below)
>   (goto-char (point-max)))
>
> does the same.  So I still miss you.

These functions might be used non-interactively,
where the *info* buffer is not displayed in any window,
e.g.:

  (with-current-buffer "*info*"
    (Info-history-back))

so in this case `goto-char' should be used instead of `set-window-point'
in `Info-history-back' and other similar functions.

It is true that in the latest patch, `set-window-start'
is not guarded against this use case.  To guarantee that the
function operates on the window that displays the current buffer,
we could add the following condition (this patch is based on the
previous patch that adds `set-window-start'):

=== modified file 'lisp/info.el'
--- lisp/info.el        2012-08-22 23:45:47 +0000
+++ lisp/info.el        2012-08-25 00:28:00 +0000
@@ -2225,7 +2225,8 @@ (defun Info-history-back ()
     (Info-find-node filename nodename)
     (setq Info-history (cdr Info-history))
     (setq Info-history-forward history-forward)
-    (set-window-start (selected-window) ostart t)
+    (when (eq (window-buffer) (current-buffer))
+      (set-window-start (selected-window) ostart t))
     (goto-char opoint)))
 
If you agree that this is the right thing to do
then other places could be changed accordingly as well.





reply via email to

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