* using save-some-buffers-default-predicate
@ 2017-11-06 12:46 João Távora
0 siblings, 0 replies; only message in thread
From: João Távora @ 2017-11-06 12:46 UTC (permalink / raw)
To: emacs-devel
Hi all,
Apologies if I'm late to the discussion and this particular question has
been answered before, but let me first explain what I've always wanted
save-some-buffers to do: ask me about unsaved buffers *in the project
I'm working on*.
So, shouldn't save-some-buffers include some kind of provision for this,
like binding a special variable to the current project that the argless
save-some-buffers-default-predicate can use? Currently I have this in my
.emacs, which takes care of M-x compile, M-x tex-compile and probably
other calls to save-some-buffers for this kind of operations.
(defvar save-some-buffers-project nil
"The current project when `save-some-buffers' is called.")
(defun a-good-default-pred ()
(if (null save-some-buffers-project)
t
(and buffer-file-name
(eq (project-current)
save-some-buffers-project))))
(setq save-some-buffers-default-predicate 'a-good-default-pred)
(defun wrap-in-good-save-buffers-predicate (oldfun &rest args)
(let ((save-some-buffers-project (project-current)))
(apply oldfun args)))
(advice-add 'save-some-buffer :around 'wrap-in-good-save-buffers-predicate)
I'm not saying we should change the default of
save-some-buffers-default-predicate (yet), but shouldn't something like
this be easier to do?
João
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2017-11-06 12:46 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-11-06 12:46 using save-some-buffers-default-predicate João Távora
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).