* Option for saving all buffers always?
@ 2019-08-05 10:51 Lars Ingebrigtsen
2019-08-05 13:16 ` Søren Pilgård
` (3 more replies)
0 siblings, 4 replies; 15+ messages in thread
From: Lars Ingebrigtsen @ 2019-08-05 10:51 UTC (permalink / raw)
To: emacs-devel
I just realised that I have never in the history of ever said "n" to the
question "Save file ...?" So I wondered whether there was any easy way
to make `save-some-buffers' always save everything. (The question is
especially annoying when compiling/grepping for stuff.)
But there doesn't seem to be. I could add an advice to the function to
pass in the always-save parameter, but this strikes me as something that
I think other users will want, too.
Does this seem like a useful addition? If so, what would this variable
be called? `save-all-buffers-without-query'?
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Option for saving all buffers always?
2019-08-05 10:51 Option for saving all buffers always? Lars Ingebrigtsen
@ 2019-08-05 13:16 ` Søren Pilgård
2019-08-05 13:44 ` Lars Ingebrigtsen
2019-08-05 15:46 ` Eric Abrahamsen
` (2 subsequent siblings)
3 siblings, 1 reply; 15+ messages in thread
From: Søren Pilgård @ 2019-08-05 13:16 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: Emacs developers
Look into save-some-buffers-default-predicate
On Mon, Aug 5, 2019 at 12:52 PM Lars Ingebrigtsen <larsi@gnus.org> wrote:
>
> I just realised that I have never in the history of ever said "n" to the
> question "Save file ...?" So I wondered whether there was any easy way
> to make `save-some-buffers' always save everything. (The question is
> especially annoying when compiling/grepping for stuff.)
>
> But there doesn't seem to be. I could add an advice to the function to
> pass in the always-save parameter, but this strikes me as something that
> I think other users will want, too.
>
> Does this seem like a useful addition? If so, what would this variable
> be called? `save-all-buffers-without-query'?
>
> --
> (domestic pets only, the antidote for overdose, milk.)
> bloggy blog: http://lars.ingebrigtsen.no
>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Option for saving all buffers always?
2019-08-05 13:16 ` Søren Pilgård
@ 2019-08-05 13:44 ` Lars Ingebrigtsen
2019-08-05 13:50 ` Noam Postavsky
0 siblings, 1 reply; 15+ messages in thread
From: Lars Ingebrigtsen @ 2019-08-05 13:44 UTC (permalink / raw)
To: Søren Pilgård; +Cc: Emacs developers
Søren Pilgård <fiskomaten@gmail.com> writes:
> Look into save-some-buffers-default-predicate
That variable is just to make `save-some-buffers' skip some buffers
altogether when saving -- it's not about prompting.
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Option for saving all buffers always?
2019-08-05 13:44 ` Lars Ingebrigtsen
@ 2019-08-05 13:50 ` Noam Postavsky
2019-08-05 13:52 ` Lars Ingebrigtsen
0 siblings, 1 reply; 15+ messages in thread
From: Noam Postavsky @ 2019-08-05 13:50 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: Søren Pilgård, Emacs developers
On Mon, 5 Aug 2019 at 09:44, Lars Ingebrigtsen <larsi@gnus.org> wrote:
>
> Søren Pilgård <fiskomaten@gmail.com> writes:
>
> > Look into save-some-buffers-default-predicate
>
> That variable is just to make `save-some-buffers' skip some buffers
> altogether when saving -- it's not about prompting.
I guess (setq-default buffer-save-without-query t) might work though.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Option for saving all buffers always?
2019-08-05 13:50 ` Noam Postavsky
@ 2019-08-05 13:52 ` Lars Ingebrigtsen
2019-08-05 14:25 ` Noam Postavsky
0 siblings, 1 reply; 15+ messages in thread
From: Lars Ingebrigtsen @ 2019-08-05 13:52 UTC (permalink / raw)
To: Noam Postavsky; +Cc: Søren Pilgård, Emacs developers
Noam Postavsky <npostavs@gmail.com> writes:
> I guess (setq-default buffer-save-without-query t) might work though.
That will make Emacs offer to save even the buffers that aren't
connected to files. :-)
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Option for saving all buffers always?
2019-08-05 13:52 ` Lars Ingebrigtsen
@ 2019-08-05 14:25 ` Noam Postavsky
2019-08-05 15:02 ` Andreas Schwab
0 siblings, 1 reply; 15+ messages in thread
From: Noam Postavsky @ 2019-08-05 14:25 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: Søren Pilgård, Emacs developers
On Mon, 5 Aug 2019 at 09:53, Lars Ingebrigtsen <larsi@gnus.org> wrote:
>
> Noam Postavsky <npostavs@gmail.com> writes:
>
> > I guess (setq-default buffer-save-without-query t) might work though.
>
> That will make Emacs offer to save even the buffers that aren't
> connected to files. :-)
Hah, you're right. Maybe
(add-hook 'find-file-hook (lambda () (setq buffer-save-without-query t)))
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Option for saving all buffers always?
2019-08-05 14:25 ` Noam Postavsky
@ 2019-08-05 15:02 ` Andreas Schwab
0 siblings, 0 replies; 15+ messages in thread
From: Andreas Schwab @ 2019-08-05 15:02 UTC (permalink / raw)
To: Noam Postavsky
Cc: Søren Pilgård, Lars Ingebrigtsen, Emacs developers
On Aug 05 2019, Noam Postavsky <npostavs@gmail.com> wrote:
> On Mon, 5 Aug 2019 at 09:53, Lars Ingebrigtsen <larsi@gnus.org> wrote:
>>
>> Noam Postavsky <npostavs@gmail.com> writes:
>>
>> > I guess (setq-default buffer-save-without-query t) might work though.
>>
>> That will make Emacs offer to save even the buffers that aren't
>> connected to files. :-)
>
> Hah, you're right. Maybe
>
> (add-hook 'find-file-hook (lambda () (setq buffer-save-without-query t)))
buffer-file-name can change any time.
It's probably easiest to advice save-some-buffers and make arg always be
non-nil.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Option for saving all buffers always?
2019-08-05 10:51 Option for saving all buffers always? Lars Ingebrigtsen
2019-08-05 13:16 ` Søren Pilgård
@ 2019-08-05 15:46 ` Eric Abrahamsen
2019-08-07 18:29 ` Lars Ingebrigtsen
2019-08-07 15:07 ` Marcin Borkowski
2019-08-10 19:40 ` Clément Pit-Claudel
3 siblings, 1 reply; 15+ messages in thread
From: Eric Abrahamsen @ 2019-08-05 15:46 UTC (permalink / raw)
To: emacs-devel
Lars Ingebrigtsen <larsi@gnus.org> writes:
> I just realised that I have never in the history of ever said "n" to the
> question "Save file ...?" So I wondered whether there was any easy way
> to make `save-some-buffers' always save everything. (The question is
> especially annoying when compiling/grepping for stuff.)
You can just "!" to approve all saves -- that doesn't seem that annoying.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Option for saving all buffers always?
2019-08-05 10:51 Option for saving all buffers always? Lars Ingebrigtsen
2019-08-05 13:16 ` Søren Pilgård
2019-08-05 15:46 ` Eric Abrahamsen
@ 2019-08-07 15:07 ` Marcin Borkowski
2019-08-10 19:40 ` Clément Pit-Claudel
3 siblings, 0 replies; 15+ messages in thread
From: Marcin Borkowski @ 2019-08-07 15:07 UTC (permalink / raw)
To: Lars Ingebrigtsen; +Cc: emacs-devel
On 2019-08-05, at 12:51, Lars Ingebrigtsen <larsi@gnus.org> wrote:
> I just realised that I have never in the history of ever said "n" to the
> question "Save file ...?" So I wondered whether there was any easy way
> to make `save-some-buffers' always save everything. (The question is
> especially annoying when compiling/grepping for stuff.)
FWIW, while I agree with you, I say `n' relatively often (say, a few
time a week). Maybe 1% of the cases, but still. (Doesn't make your
request any less reasonable, of course.)
Just a datapoint.
--
Marcin Borkowski
http://mbork.pl
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Option for saving all buffers always?
2019-08-05 15:46 ` Eric Abrahamsen
@ 2019-08-07 18:29 ` Lars Ingebrigtsen
2019-08-10 18:54 ` Stephen Leake
0 siblings, 1 reply; 15+ messages in thread
From: Lars Ingebrigtsen @ 2019-08-07 18:29 UTC (permalink / raw)
To: Eric Abrahamsen; +Cc: emacs-devel
Eric Abrahamsen <eric@ericabrahamsen.net> writes:
> Lars Ingebrigtsen <larsi@gnus.org> writes:
>
>> I just realised that I have never in the history of ever said "n" to the
>> question "Save file ...?" So I wondered whether there was any easy way
>> to make `save-some-buffers' always save everything. (The question is
>> especially annoying when compiling/grepping for stuff.)
>
> You can just "!" to approve all saves -- that doesn't seem that annoying.
It's annoying to me. :-)
But there didn't seem to be a general clamouring for this functionality,
so I just went with advice instead. For future duckduckgoing, here's
the necessary incantation:
(advice-add 'save-some-buffers :around
(lambda (oldfun &optional arg pred)
(funcall oldfun t pred)))
--
(domestic pets only, the antidote for overdose, milk.)
bloggy blog: http://lars.ingebrigtsen.no
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Option for saving all buffers always?
2019-08-07 18:29 ` Lars Ingebrigtsen
@ 2019-08-10 18:54 ` Stephen Leake
[not found] ` <CADoYgq-np68aTT=XekhoYOWS_wyi7YH7t8gJuiMOoHwNOe5iog@mail.gmail.com>
0 siblings, 1 reply; 15+ messages in thread
From: Stephen Leake @ 2019-08-10 18:54 UTC (permalink / raw)
To: emacs-devel
Lars Ingebrigtsen <larsi@gnus.org> writes:
> Eric Abrahamsen <eric@ericabrahamsen.net> writes:
>
>> Lars Ingebrigtsen <larsi@gnus.org> writes:
>>
>>> I just realised that I have never in the history of ever said "n" to the
>>> question "Save file ...?" So I wondered whether there was any easy way
>>> to make `save-some-buffers' always save everything. (The question is
>>> especially annoying when compiling/grepping for stuff.)
>>
>> You can just "!" to approve all saves -- that doesn't seem that annoying.
>
> It's annoying to me. :-)
>
> But there didn't seem to be a general clamouring for this functionality,
> so I just went with advice instead. For future duckduckgoing, here's
> the necessary incantation:
>
> (advice-add 'save-some-buffers :around
> (lambda (oldfun &optional arg pred)
> (funcall oldfun t pred)))
I did the same thing many moons ago. It's easy enough to do, and a good
skill to have; i don't think we need yet another global setting for this.
--
-- Stephe
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Option for saving all buffers always?
2019-08-05 10:51 Option for saving all buffers always? Lars Ingebrigtsen
` (2 preceding siblings ...)
2019-08-07 15:07 ` Marcin Borkowski
@ 2019-08-10 19:40 ` Clément Pit-Claudel
2019-08-10 20:57 ` Óscar Fuentes
2019-08-10 23:12 ` Stefan Monnier
3 siblings, 2 replies; 15+ messages in thread
From: Clément Pit-Claudel @ 2019-08-10 19:40 UTC (permalink / raw)
To: emacs-devel
On 2019-08-05 06:51, Lars Ingebrigtsen wrote:
> (The question is
> especially annoying when compiling/grepping for stuff.)
Patching M-x compile and M-x rgrep to only prompt about files within the current directory or its descendants has been on my TODO-list for a long time.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Option for saving all buffers always?
2019-08-10 19:40 ` Clément Pit-Claudel
@ 2019-08-10 20:57 ` Óscar Fuentes
2019-08-10 23:12 ` Stefan Monnier
1 sibling, 0 replies; 15+ messages in thread
From: Óscar Fuentes @ 2019-08-10 20:57 UTC (permalink / raw)
To: emacs-devel
Clément Pit-Claudel <cpitclaudel@gmail.com> writes:
> On 2019-08-05 06:51, Lars Ingebrigtsen wrote:
>> (The question is
>> especially annoying when compiling/grepping for stuff.)
>
> Patching M-x compile and M-x rgrep to only prompt about files within
> the current directory or its descendants has been on my TODO-list for
> a long time.
+1
I actually used a patched Magit to do this, until they added the feature
(or I submitted it, dunno).
Actually, as it is common to have multi-level source trees and the build
can be invoked from anywhere, the feature needs a method to determine
the root directory. Assuming that the interesting buffers are on the
current directory or its descendants is ok for rgrep, but not for
compile.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Option for saving all buffers always?
2019-08-10 19:40 ` Clément Pit-Claudel
2019-08-10 20:57 ` Óscar Fuentes
@ 2019-08-10 23:12 ` Stefan Monnier
1 sibling, 0 replies; 15+ messages in thread
From: Stefan Monnier @ 2019-08-10 23:12 UTC (permalink / raw)
To: Clément Pit-Claudel; +Cc: emacs-devel
>> (The question is
>> especially annoying when compiling/grepping for stuff.)
>
> Patching M-x compile and M-x rgrep to only prompt about files within the
> current directory or its descendants has been on my TODO-list for
> a long time.
You can take inspiration from pcl-cvs (for which I extended the
argument of save-some-buffer).
Stefan
^ permalink raw reply [flat|nested] 15+ messages in thread
* Fwd: Option for saving all buffers always?
[not found] ` <CADoYgq-np68aTT=XekhoYOWS_wyi7YH7t8gJuiMOoHwNOe5iog@mail.gmail.com>
@ 2019-08-11 4:35 ` Bob Newell
0 siblings, 0 replies; 15+ messages in thread
From: Bob Newell @ 2019-08-11 4:35 UTC (permalink / raw)
To: emacs-devel
> > (advice-add 'save-some-buffers :around
> > (lambda (oldfun &optional arg pred)
> > (funcall oldfun t pred)))
I never thought of this; it's rather good and efficient. I've been
doing something different:
(define-key global-map "\C-x\C-c" 'rjn-kill-emacs-quietly)
and in the function 'rjn-kill-emacs-quietly I have a number of things including
(save-some-buffers 1 t)
as well as things to close out gnus cleanly, and finally
(kill-emacs)
I guess the big difference is that M-x kill-emacs won't alter default
exit behavior while C-x C-c will now ensure buffers are saved, etc.
--
Bob Newell
Honolulu, Hawai`i
Via Linux/Emacs/Gnus/BBDB.
--
Bob Newell
Honolulu, Hawai`i
Via Linux/Emacs/Gnus/BBDB.
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2019-08-11 4:35 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-08-05 10:51 Option for saving all buffers always? Lars Ingebrigtsen
2019-08-05 13:16 ` Søren Pilgård
2019-08-05 13:44 ` Lars Ingebrigtsen
2019-08-05 13:50 ` Noam Postavsky
2019-08-05 13:52 ` Lars Ingebrigtsen
2019-08-05 14:25 ` Noam Postavsky
2019-08-05 15:02 ` Andreas Schwab
2019-08-05 15:46 ` Eric Abrahamsen
2019-08-07 18:29 ` Lars Ingebrigtsen
2019-08-10 18:54 ` Stephen Leake
[not found] ` <CADoYgq-np68aTT=XekhoYOWS_wyi7YH7t8gJuiMOoHwNOe5iog@mail.gmail.com>
2019-08-11 4:35 ` Fwd: " Bob Newell
2019-08-07 15:07 ` Marcin Borkowski
2019-08-10 19:40 ` Clément Pit-Claudel
2019-08-10 20:57 ` Óscar Fuentes
2019-08-10 23:12 ` Stefan Monnier
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.