unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
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: Mon, 08 Jan 2018 10:56:59 -0600	[thread overview]
Message-ID: <86o9m4gug4.fsf@stephe-leake.org> (raw)
In-Reply-To: <jwvr2r0ebut.fsf-monnier+Inbox@gnu.org> (Stefan Monnier's message of "Mon, 08 Jan 2018 08:15:18 -0500")

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>> But this is a fairly normal/common need: display a buffer temporarily.
>>> So we should have a "canned" answer.
>>> I'm thinking of something like
>>>
>>>      (let ((x (temporary-display-buffer BUF)))
>>
>> What kind of object would "x" be?
>
> The kind of object that carries the necessary information from
> temporary-display-buffer to temporary-undisplay-buffer so that they
> together DTRT.
>
>>>      (temporary-undisplay-buffer x)
>>> where hopefully this would handle the case where
>>> temporary-display-buffer needs to use a separate frame, as well as the
>>> case where BUF is already displayed somewhere.
>> If "x" is a window, then `quit-restore-window' should know how to deal
>> with it.
>
> If `x` is just a window, how does quit-restore-window know that we want
> to hide BUF (and not some other buffer that happens to be displayed
> in the window once we get to quit-restore-window)?
>
> If `x` is just a window, how does quit-restore-window know whether BUF was
> already displayed in that window before temporary-undisplay-buffer was
> called (in order to decide whether to change the window's buffer or not)?
>
>> So please tell what's missing in `with-temp-buffer-window'.
>
> It forces scoping.  IOW it can't be used when the
> temporary-undisplay-buffer part needs to be done at some arbitrary later
> time (e.g. after the user has run a bunch of commands).

In the context of `copyright-update-year', something like
`save-frame-excursion' is what we want, at least given the current
design.

`with-temp-buffer-window' erases the buffer, and binds
`standard-output' to it, which we certainly do not want.

It uses `quit-restore-window', which looks useful, but I think it would
work best in combination with a different way of displaying the buffer
than `save-excursion pop-to-buffer'. Perhaps a new macro
`with-temp-window' is what we want.

This thread is nominally about patching emacs-26 to fix a bug. The patch
I've posted is a minimal fix; adding code or redesigning to handle frames
better is feature-creep, so it should be done on master.

-- 
-- Stephe



  reply	other threads:[~2018-01-08 16:56 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
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 [this message]
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

  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=86o9m4gug4.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 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).