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: Fri, 11 Jan 2019 16:10:45 +0100

> I agree. However, that is not what I was requesting. What I need for my
> use case is to reliably restore a configuration that I know is possible
> to display on the grounds that it has already been displayed before. Is
> there any way to do this, or could this please be provided?

From you snippet I guess the following should do that.

    (progn
      (goto-char (point-max))
      (insert "\n")
      (dotimes (x (window-height))
        (insert (format "%s\n" x)))
      (redisplay)
      (let ((scroll-margin 1)
            (b (buffer-string))
            (s (window-start))
            (p (point)))
        (read-key "Please press a key to continue.")
        (erase-buffer)
        (insert b)
        (set-window-point nil p)
        (set-window-start nil s)))

The crucial idiom is provided by the last two forms.  Restore window's
point first and then its start position (although any order should do
in your case).

martin





reply via email to

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