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: martin rudalics
Subject: bug#12253: Restore window start position
Date: Sat, 25 Aug 2012 15:40:26 +0200

> 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))

Aha

> 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.

This must have been the inconsistency that troubled my subconsciousness.

> 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.

I agree.  How do you handle the case where *info* is not in the selected
window but some other one?

martin





reply via email to

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