unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: emacs-devel@gnu.org
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	[thread overview]
Message-ID: <jwvtuvfnqpb.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <87y2kr1a1l.fsf@gnus.org> (Lars Ingebrigtsen's message of "Wed, 30 Sep 2020 18:52:54 +0200")

>>>     * 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




  reply	other threads:[~2020-09-30 17:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [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 [this message]
2020-09-30 23:46         ` Lars Ingebrigtsen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=jwvtuvfnqpb.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    --cc=larsi@gnus.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).