[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: master 0bd221b: Fix problem of having the wrong window selected afte
From: |
Stefan Monnier |
Subject: |
Re: master 0bd221b: Fix problem of having the wrong window selected after saving foo.gpg |
Date: |
Wed, 30 Sep 2020 13:04:17 -0400 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
>>> * lisp/epa.el (epa--select-keys): Restore the window configuration
>>> after selecting the key to use (bug#43703). This also ensures
>>> that the buffer we were editing ends up as the current buffer
>>> after saving it, instead of selecting a different window.
>>> + (let ((conf (current-window-configuration)))
>> [...]
>>> + (set-window-configuration conf)))))
>>
>> I think this is called `save-window-excursion`.
>
> I wasn't sure whether that macro would survive the call to
> recursive-edit, but I guess it would.
It does the same as your code, yes.
>> FWIW, I think `save-window-excursion` is never the right solution
>> because it doesn't take into account the case where `pop-to-buffer`
>> uses another frame.
>>
>> I can never remember which is the function to "undo" a `display-buffer`,
>> but I believe it's something like `quit-window` or `bury-buffer`.
>> We should add a reference to these in the docstring of `display-buffer`
>> and `pop-to-buffer`.
>
> So would a quit-buffer before killing the buffer have fixed the problem
> here?
I'm not sure, to be honest.
I'd use a `save-current-buffer` to be on the safe side.
Stefan