From: Stephen Leake <stephen_leake@stephe-leake.org>
To: emacs-devel <emacs-devel@gnu.org>
Subject: Re: fix for bug#29935 copyright-update inserts year at random places
Date: Wed, 03 Jan 2018 21:21:34 -0600 [thread overview]
Message-ID: <86k1wy48ch.fsf@stephe-leake.org> (raw)
In-Reply-To: <jwvr2r64f4t.fsf-monnier+gmane.emacs.devel@gnu.org> (Stefan Monnier's message of "Wed, 03 Jan 2018 20:01:55 -0500")
Stefan Monnier <monnier@iro.umontreal.ca> writes:
>>> Why does this need to use save-window-excursion?
>> 'switch-to-buffer' can pop up a new frame, or use a different window,
>> depending on various settings, so save-window-excursion is needed.
>
> Indeed, but note that if it pops up a new frame, save-window-excursion
> will be of no help to "undo" this effect (which really can't be undone
> in general, since to pop up that frame, the user may have had to place
> the new frame).
Right. I changed copyright-update-year to use pop-to-buffer, and set
pop-up-frames to t; update-copyright-year popped up a new frame, which
was not minimized or closed.
Using pop-to-buffer-same-window did not pop up a new frame, which is
preferable here, I think, even for people who normally have
pop-up-frames t.
I think there are still situations where pop-to-buffer-same-window can
change the window configuration (if it is invoked from a dedicated
window, for example), so save-window-excursion is still needed.
> Also switch-to-buffer is kind of ambiguous: do you really want to only
> affect the currently selected window, or do you really want to display
> the specified buffer (sometimes switch-to-buffer has to choose between
> those two options and it doesn't know what the caller wanted). I think
> here we care more about displaying the specified buffer than about only
> affecting the selected window, so we should probably use
> `pop-to-buffer(-same-window)` instead.
pop-to-buffer-same-window works, and is a lower-level function, so it
makes sense here.
--
-- Stephe
next prev parent reply other threads:[~2018-01-04 3:21 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-01 23:29 fix for bug#29935 copyright-update inserts year at random places Stephen Leake
2018-01-02 9:21 ` Lele Gaifax
2018-01-02 16:03 ` Eli Zaretskii
2018-01-03 22:52 ` Stephen Leake
2018-01-04 1:01 ` Stefan Monnier
2018-01-04 3:21 ` Stephen Leake [this message]
2018-01-04 5:34 ` Stefan Monnier
2018-01-04 12:47 ` Stephen Leake
2018-01-04 18:23 ` Stefan Monnier
2018-01-07 16:08 ` martin rudalics
2018-01-07 17:34 ` Stefan Monnier
2018-01-08 9:53 ` martin rudalics
2018-01-08 13:15 ` Stefan Monnier
2018-01-08 16:56 ` Stephen Leake
2018-01-08 18:37 ` martin rudalics
2018-01-08 19:05 ` Eli Zaretskii
2018-01-11 16:48 ` Stephen Leake
2018-01-08 18:18 ` martin rudalics
2018-01-08 22:18 ` Stefan Monnier
2018-01-09 9:42 ` martin rudalics
2018-01-09 13:07 ` Stefan Monnier
2018-01-10 10:19 ` martin rudalics
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=86k1wy48ch.fsf@stephe-leake.org \
--to=stephen_leake@stephe-leake.org \
--cc=emacs-devel@gnu.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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.