emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fix for bug#29935 copyright-update inserts year at random places


From: Stephen Leake
Subject: Re: fix for bug#29935 copyright-update inserts year at random places
Date: Mon, 08 Jan 2018 10:56:59 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.90 (windows-nt)

Stefan Monnier <address@hidden> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]