GNU bug report logs - #33532
26.1; set-window-configuration does not restore display start

Previous Next

Package: emacs;

Reported by: Markus Triska <triska <at> metalevel.at>

Date: Tue, 27 Nov 2018 22:12:02 UTC

Severity: normal

Merged with 33533

Found in version 26.1

Full log


View this message in rfc822 format

From: Eli Zaretskii <eliz <at> gnu.org>
To: Markus Triska <triska <at> metalevel.at>
Cc: 33532 <at> debbugs.gnu.org
Subject: bug#33532: 26.1; set-window-configuration does not restore display start
Date: Wed, 28 Nov 2018 08:41:57 +0200
> From: Markus Triska <triska <at> metalevel.at>
> Date: Tue, 27 Nov 2018 23:11:21 +0100
> 
>     (let ((buf (get-buffer-create "buf")))
>       (switch-to-buffer buf)
>       (erase-buffer)
>       (dotimes (x 10)
>         (insert (format "x is %s\n" x)))
>       (recenter 3)
>       (sit-for 1)
>       (let ((conf (current-window-configuration))
>             (ws (window-start))
>             (str (with-current-buffer buf (buffer-string))))
>         (with-current-buffer buf
>           (erase-buffer)
>           (insert str))
>         (set-window-configuration conf)
>         (sit-for 1)
>         (message "window-start: %s vs. %s" ws (window-start))))
> 
> This shows that after set-window-configuration, even though the buffer
> content is the same as at the time the configuration was obtained, the
> value of (window-start) differs from before: After the window
> configuration is set, (window-start) is 1. I expect it to be 50 (i.e.,
> the value at the time the configuration was obtained), because the
> documentation of current-window-configuration states:

The window-start point is a marker, and is saved as such.  Your code
replaces the entire text of the buffer with something new, so all the
markers are invalidated.

How important is the use case of replacing buffer text with identical
text?  Because replacing with a different text will make preserving
window-start position based on its numerical value not really a
sensible thing, would it?  It could even be impossible, e.g. if the
same position happens to be in the middle of a sequence of composed
characters.




This bug report was last modified 6 years and 174 days ago.

Previous Next


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