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: martin rudalics
Subject: bug#34038: 26.1; set-window-start sometimes fails to set window start
Date: Sat, 12 Jan 2019 15:12:31 +0100

>      (progn
>        (goto-char (point-max))
>        (insert "\n")
>        (dotimes (x (window-height))
>          (insert (format "%s\n" x)))
>        (let ((b (buffer-string))
>              (p (point)))
>          (redisplay)
>          (set-window-start nil p)
>          (let ((wp (window-point)))
>            (read-key "Step 1. Please press a key to continue.")
>            (dotimes (x (round (/ (window-height) 2)))
>              (insert (format "more lines ... %s\n" x)))
>            (read-key "Step 2. Please press a key to continue.")
>            (erase-buffer)
>            (insert b)
>            (set-window-point nil wp)
>            (set-window-start nil p))))
>
> In this snippet, I try to restore the exact same configuration that you
> see when "Step 1 ..." is displayed, i.e., window-start is set so that
> point is on the very first line, which is blank. When you press a key at

I think you mean on the very _last_ line here.  Right?

> this point, then a few more lines of text are inserted. Then, please
> press another key when "Step 2 ..." is displayed.
>
> What I observe after these forms is that point is unexpectedly placed
> vertically centered in the window instead of at the topmost line.
>
> Please note that I am now using set-window-point, and also
> set-window-start with third argument (implicitly) nil. I get the exact
> same result when I use t for the third argument of set-window-start.
>
> Can you reproduce this? Is there a way to reliably restore this?

I see a centering but I'm not sure whether I see the same thing
happening as you do.  Evaluating

(progn
  (goto-char (point-max))
  (insert "\n")
  (dotimes (x (window-height))
    (insert (format "%s\n" x)))
  (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))))

in an empty *scratch* buffer here gives 97..97 and 393..97 for (point)
and wp.  Do you see that?

If so then does (setq scroll-conservatively 101) fix it?

martin





reply via email to

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