emacs-devel
[Top][All Lists]
Advanced

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

Re: show-enclosing-scopes


From: Stefan Monnier
Subject: Re: show-enclosing-scopes
Date: Thu, 17 May 2018 10:31:44 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

> (progn (scroll-up 1) (beginning-of-buffer))

So you have here an ambiguous specification: on the one hand you
specified the window-start via scroll-up, on the other you specified
point with beginning-of-buffer.  Since point needs to be within the
visible part of the buffer, the redisplay engine has to choose which of
the two requests to override.

Now the question is why does your package end up in situations with such
ambiguous specifications?

Assuming you don't have any control over the scroll-up part and you want
to override it via beginning-of-buffer, there is indeed currently no
easy way to get that, AFAICT: this is controlled by the `force_start`
field in the window which will have been set by scroll-up (and can be
set via set-window-start) but can't be "unset" directly.
Maybe you can try

    (defun my-unset-window-force-start ()
      (cl-assert (eq (current-buffer) (window-buffer)))
      (save-excursion
        (let ((buf (current-buffer)))
          (with-temp-buffer
            (set-window-buffer (selected-window) (current-buffer) 'keep-margins)
            (set-window-buffer (selected-window) buf 'keep-margins)))))

since it seems that set-window-buffer does unset `force-start`.
It will also cause undesirable side-effects, but maybe in your case they
will be less annoying than those of `redisplay`.


        Stefan




reply via email to

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