GNU bug report logs -
#12170
save-excursion fails boundary case with recenter
Previous Next
Reported by: "Bill Brodie" <wbrodie <at> panix.com>
Date: Fri, 10 Aug 2012 02:01:02 UTC
Severity: normal
Tags: notabug
Done: npostavs <at> users.sourceforge.net
Bug is archived. No further changes may be made.
Full log
Message #47 received at 12170 <at> debbugs.gnu.org (full text, mbox):
> Date: Fri, 10 Aug 2012 16:47:09 +0200
> From: martin rudalics <rudalics <at> gmx.at>
> Cc: 12170 <at> debbugs.gnu.org
>
> (defun f (n)
> (save-this-window-excursion (forward-line (- n)) (recenter 0)))
>
> (let ((buffer (switch-to-buffer "foo"))
> (height (1- (window-height (get-buffer-window "foo")))))
> (insert-char 10 (* height 2))
> (let ((pt (point)))
> (f height)
> (redisplay)
> (message "height %s old %s new %s" height pt (point)))))
>
> so I'd suspect the culprit somewhere in redisplay_window's code
By saying "culprit" you mean you think this is a bug? I think Stefan
explained why it isn't.
> if (w->optional_new_start
>
> w->optional_new_start is 1 from `recenter'
>
> && CHARPOS (startp) >= BEGV
> && CHARPOS (startp) <= ZV)
> {
> w->optional_new_start = 0;
> start_display (&it, w, startp);
> move_it_to (&it, PT, 0, it.last_visible_y, -1,
> MOVE_TO_POS | MOVE_TO_X | MOVE_TO_Y);
> if (IT_CHARPOS (it) == PT)
> w->force_start = 1;
> /* IT may overshoot PT if text at PT is invisible. */
> else if (IT_CHARPOS (it) > PT && CHARPOS (startp) <= PT)
> w->force_start = 1;
>
> w->force_start 1 will cause redisplay to honor the start position set up
> by `recenter'
Only if point will be visible when window is displayed starting at
startp.
> But I don't have the slightest idea how calling
>
> (set-window-start (selected-window) ,start t)
>
> would remedy this. Eli will soon teach us a lesson here.
Not sure there's a lesson here to learn, but set-window-start sets the
w->force_start flag unconditionally, so it will hold even if point is
not in the displayed portion of the window (i.e., point will move).
Does that explain things?
This bug report was last modified 8 years and 121 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.