GNU bug report logs - #12253
Restore window start position

Previous Next

Package: emacs;

Reported by: Juri Linkov <juri <at> jurta.org>

Date: Tue, 21 Aug 2012 22:23:01 UTC

Severity: normal

Full log


Message #26 received at 12253 <at> debbugs.gnu.org (full text, mbox):

From: martin rudalics <rudalics <at> gmx.at>
To: Juri Linkov <juri <at> jurta.org>
Cc: 12253 <at> debbugs.gnu.org
Subject: Re: 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




This bug report was last modified 1 year and 154 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.