emacs-devel
[Top][All Lists]
Advanced

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

Re: Tweaking save-some-buffers-action-alist


From: Daniel Martín
Subject: Re: Tweaking save-some-buffers-action-alist
Date: Thu, 17 Jun 2021 23:55:54 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (darwin)

Sergey Organov <sorganov@gmail.com> writes:

>
> #+BEGIN_SRC emacs-lisp
> (nconc
>  save-some-buffers-action-alist
>  '((?\C-\M-g
>     (lambda (buf)
>       (with-current-buffer buf
>         (revert-buffer)))
>     "revert this buffer")))
> #+END_SRC
>
> I'm concerned as I use `nconc` that sounds unsafe, and then original
> definition has some ",(" and ",(purecopy" tricks that I dunno if I need
> to follow, and if so, how?

Purecopy is a no-op except while Emacs is being built and dumped, so
user customizations can omit it.  Evaluate (info "(elisp) Pure Storage")
in Emacs to read more about this.

Backquoting the alist will instruct the Elisp interpreter to not
evaluate KEY, but evaluate the lambda FUNC.  Evaluating lambda
expressions is generally a good idea because that enables
byte-compilation and all its benefits: Faster code, less memory usage,
some static checks, specially under lexical scope, etc.

>
> And to finally justify posting to 'emacs-devel', does it make sense to
> add this capability to the default value of
> `save-some-buffers-action-alist`?
>

I think reverting a buffer when compiling is not a very common need.
More importantly, the prompt already has a lot of options and adding one
more will make it more complex and difficult to understand.  At some
point you have to draw the line between what should be a customization
and what should be included in Emacs and I think your suggestion can
perfectly be a personal customization.


reply via email to

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