emacs-devel
[Top][All Lists]
Advanced

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

Re: Changes for emacs 28, Re: Changes for emacs 28


From: Thibaut Verron
Subject: Re: Changes for emacs 28, Re: Changes for emacs 28
Date: Mon, 14 Sep 2020 16:53:07 +0200

Le lun. 14 sept. 2020 à 16:35, Robert Pluim <rpluim@gmail.com> a écrit :
>
> >>>>> On Mon, 14 Sep 2020 14:15:40 +0200, Thibaut Verron 
> >>>>> <thibaut.verron@gmail.com> said:
>
>     Thibaut> Le lun. 14 sept. 2020 à 13:54, Robert Pluim <rpluim@gmail.com> a 
> écrit :
>     >> >>>>> On Mon, 14 Sep 2020 09:53:28 +0200, Thibaut Verron <
>     >> thibaut.verron@gmail.com> said:
>     >> >>
>     >> >> We could set 'kill-buffer-hook' to a querying function in buffers
>     >> >> created via the toolbar.
>     >> >>
>     >>
>     Thibaut> There is already a (buffer-local) variable buffer-offer-save
>     >> which, set to
>     Thibaut> 'always, causes save-some-buffers to query for save the
>     >> corresponding
>     Thibaut> buffer, if non-empty.
>     >>
>     >> Right, but toolbar-save doesnʼt run save-some-buffers. That could be
>     >> added, but it seems people feel toolbar space is precious (here the
>     >> default toolbar uses slightly more than 50% of the available width
>     >> when running -Q)
>     >>
>
>     Thibaut> The save button runs save-buffer, so it should DTRT already, no?
>
> Sorry, yes. The 'new' button forces you to choose a filename for the
> buffer, so saving it works (that will teach me to talk about features
> I donʼt use)

I think that you missed a message in the long thread.

To clarify, currently, the "new" button is "find-file", so it does
expect a file name and a path.
The suggestion is to maybe replace it with a function creating an
anonymous buffer, leaving the choice of a path (if necessary) to the
point of saving.

In essence, something like

> (defun my/new-buffer ()
>   (interactive)
>   (let ((buffer (generate-new-buffer "*unnamed*")))
>     (pop-to-buffer buffer)
>     (setq buffer-offer-save 'always)))

Save-buffer should still work as expected, just as if you were calling
it from a normal non-file buffer, and so should save-some-buffers and
the like.

But kill-buffer will not offer to save, as of now, as you pointed out.

>
>     Thibaut> Restoring them as-is is what notepad++ does (or did when I last 
> used it
>     Thibaut> 10 years ago). I personally did not like this behavior, and I 
> didn't have
>     Thibaut> remotely as many open files in notepad++ as I do in a typical 
> emacs session.
>
> Itʼs a behaviour thatʼs become strongly expected, mainly because
> people have become conditioned to 'restart where I left off' behaviour
> from web browsers, I suspect.

There are packages going in that direction, if you are interested, but
it is really a complicated matter. Anonymous user-generated buffers
are not the biggest problem there. Web-browsers can just reload the
content of most of their "buffers", that's a luxury emacs does not
have.

> The toolbar does not let you create such buffers (I thought it did,
> but it doesnʼt).

That illustrates how confusing the current situation is, I believe. :)



reply via email to

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