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

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

bug#35860: Delayed window positioning after buffer display


From: Juri Linkov
Subject: bug#35860: Delayed window positioning after buffer display
Date: Wed, 19 Jun 2019 00:02:42 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu)

>> +(defvar delayed-window-point nil
>
> Name space conventions would recommend 'window-delayed-point'.

Then 'window-delayed-start' would be too ambiguous.  Maybe then
'window-start-delayed' and 'window-point-delayed'.

>> +  "Marker to override default `window-point' in all windows.
>
> Why "marker" and why "all windows"?  As for the former, I think it
> makes sense because then one can specify an insertion type as well.
> But IIRC you earlier wanted to allow plain integers here too?

Yes, plain integers should be allowed as well.

>> +`delayed-window-point' is a buffer-local marker you can move to a valid
>> +position of the buffer shown in the window in order to override the standard
>> +positioning mechanism (`point-min') chosen by window displaying functions.")
>
> IIUC there is no such "mechanism" except for buffers just created.
> And what about 'switch-to-buffer-preserve-window-point'?  "window ???
> displaying functions" implicitly hints at the fact that the mechanism
> works only when the buffer is shown by 'display-buffer'.  But are we
> sure that this restriction always applies?

Maybe the same should be allowed for 'switch-to-buffer' as well,
and even for buffers displayed by set-window-configuration.

>> I see no reason to use macros here.
>> We need to replace these macros with the elegant solution that we already
>> have of using action alists.
>
> Macros are useful in as much as they allow to specify the evaluation
> order of their arguments.  Action alists are dumb in this regard.

The problem is that currently the whole cycle of buffer displaying
doesn't allow executing arbitrary code at different stages:
there are no pre-display-buffer and post-display-buffer hooks.

Adding such hooks would allow to get rid of macros easily.
For example, instead of using two variables 'window-point-delayed'
and 'window-start-delayed', a pre-display hook in 'view-lossage'
will be able just to set a buffer-local run-once post-display hook
that will adjust the window positions after the buffer is displayed
in the window.

Another candidate that can be placed into such post-display hook is
fit-window-to-buffer for cases when adding an action alist
as an arg of display-buffer call is not possible.

And vice versa, pre/post-display actions could be specified
in an action alist of display-buffer, when using hooks is not possible.





reply via email to

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