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

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

bug#70949: display-buffer-choose-some-window


From: Juri Linkov
Subject: bug#70949: display-buffer-choose-some-window
Date: Sun, 02 Jun 2024 09:39:32 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50 (x86_64-pc-linux-gnu)

>> Not a variable, but a window parameter.  A buffer-local variable
>> can't be used because for example 'vc-diff-internal' uses such
>> call sequence:
>>
>>    (set-buffer buffer)
>>    (pop-to-buffer (current-buffer))
>>
>> so 'display-buffer' is called from 'pop-to-buffer' in the wrong buffer.
>
> So what we want to do here is to make 'vc-diff' work in the context of
> 'vc-dir'.  There you have a set of "interesting" files you want to
> compare with their base versions.  'vc-diff' calls 'vc-deduce-fileset'
> to find the set of files to compare.  If that function returns a single
> file or a single-file list, we continue as usual.  But if that function
> returns a list of files, 'vc-diff' knows that it is in or enters a mode
> where it should use one and the same window to show a sequence of diffs.

But display-buffer displays buffers, not files.

> In that latter case, 'vc-diff' could pass an extra optional argument to
> 'vc-diff-internal', telling it that it has to call 'pop-to-buffer' with
> a 'display-buffer-in-previous-window' action and a 'previous-window'
> alist entry whose value is 'vc-diff'.  That's all 'vc-diff' can do.

This doesn't look like a nice design to require changing the signatures
of vc functions.

> 'display-buffer-in-previous-window' could now try to find a window whose
> 'previous-window' parameter is (or includes the value) 'vc-diff'.  If it
> finds such a window, it displays the diff there.  Otherwise, it has to
> display the diff in the usual manner - just as if the 'previous-window'
> entry didn't exist.  In either case 'display-buffer' would set (or add)
> a '(previous-window . vc-diff) parameter for the window used.
>
> 'quit-window' would eventually remove that 'previous-window' parameter
> or entry provided the buffer shown in the window is a vc-diff buffer.
>
> Note: I don't know how 'vc-deduce-fileset' gets the next file in a set
> of files to diff.  I simply assume that it does TRT here.

I think such design looks overly complicated.  I hoped for something
much simpler by adding just a few lines to window.el.





reply via email to

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