* Re: master 0bd221b: Fix problem of having the wrong window selected after saving foo.gpg
[not found] ` <20200930153652.925A9209AC@vcs0.savannah.gnu.org>
@ 2020-09-30 16:46 ` Stefan Monnier
2020-09-30 16:52 ` Lars Ingebrigtsen
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2020-09-30 16:46 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: emacs-devel
> * 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`.
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`.
Stefan
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: master 0bd221b: Fix problem of having the wrong window selected after saving foo.gpg
2020-09-30 16:46 ` master 0bd221b: Fix problem of having the wrong window selected after saving foo.gpg Stefan Monnier
@ 2020-09-30 16:52 ` Lars Ingebrigtsen
2020-09-30 17:04 ` Stefan Monnier
0 siblings, 1 reply; 4+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-30 16:52 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> * 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.
> 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?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: master 0bd221b: Fix problem of having the wrong window selected after saving foo.gpg
2020-09-30 16:52 ` Lars Ingebrigtsen
@ 2020-09-30 17:04 ` Stefan Monnier
2020-09-30 23:46 ` Lars Ingebrigtsen
0 siblings, 1 reply; 4+ messages in thread
From: Stefan Monnier @ 2020-09-30 17:04 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: emacs-devel
>>> * 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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: master 0bd221b: Fix problem of having the wrong window selected after saving foo.gpg
2020-09-30 17:04 ` Stefan Monnier
@ 2020-09-30 23:46 ` Lars Ingebrigtsen
0 siblings, 0 replies; 4+ messages in thread
From: Lars Ingebrigtsen @ 2020-09-30 23:46 UTC (permalink / raw)
To: Stefan Monnier; +Cc: emacs-devel
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>> 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.
Well, quit-buffer doesn't exist, but bury-buffer did (and didn't help
much here). Both it and quit-window has the problem that the buffer in
question may be killed at this point, and the user has just exited the
recursive-edit by other means, so using either entails some checking,
and doesn't really... help that much?
So I just changed it to a save-window-excursion.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-09-30 23:46 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20200930153650.16819.40412@vcs0.savannah.gnu.org>
[not found] ` <20200930153652.925A9209AC@vcs0.savannah.gnu.org>
2020-09-30 16:46 ` master 0bd221b: Fix problem of having the wrong window selected after saving foo.gpg Stefan Monnier
2020-09-30 16:52 ` Lars Ingebrigtsen
2020-09-30 17:04 ` Stefan Monnier
2020-09-30 23:46 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).