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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#34038: 26.1; set-window-start sometimes fails to set window start


From: Markus Triska
Subject: bug#34038: 26.1; set-window-start sometimes fails to set window start
Date: Sun, 13 Jan 2019 08:32:44 +0100
User-agent: Emacs/24.5

Hi Alan,

thank you for looking into this, I greatly appreciate it!

Alan Mackenzie <acm@muc.de> writes:

> .  This is pure speculation, but perhaps because the entire buffer is
> currently off the screen, with point being on the empty last line,

This indeed seems to be a critical factor: an empty last line that
appears as the first line of the window.

The reason I think that is because if you add for example just a single
space to the line, everything works exactly as expected:

    (progn
      (goto-char (point-max))
      (insert "\n")
      (dotimes (x (window-height))
        (insert (format "%s\n" x)))
      (insert " ")
      (backward-char 1)
      (let ((b (buffer-string))
            (p (point)))
        (redisplay)
        (set-window-start nil p)
        (let ((wp (window-point)))
          (read-key (format "Step 1 at %s wp is %s. Please press a key to 
continue." (point) wp))
          (dotimes (x (round (/ (window-height) 2)))
            (insert (format "more lines ... %s\n" x)))
          (read-key (format "Step 2 at %s wp is %s. Please press a key to 
continue." (point) wp))
          (erase-buffer)
          (insert b)
          (set-window-point nil wp)
          (set-window-start nil p))))

Please note the (insert " "). I am using (backward-char 1) to show that
the position of point by itself is not enough to trigger the phenomenon.

Thank you and all the best!
Markus





reply via email to

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