unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "Daniel Martín" <mardani29@yahoo.es>
To: Sergey Organov <sorganov@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Tweaking save-some-buffers-action-alist
Date: Thu, 17 Jun 2021 23:55:54 +0200	[thread overview]
Message-ID: <m1bl84i2ad.fsf@yahoo.es> (raw)
In-Reply-To: <87y2b879ni.fsf@osv.gnss.ru> (Sergey Organov's message of "Thu, 17 Jun 2021 19:12:17 +0300")

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	other threads:[~2021-06-17 21:55 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-17 16:12 Tweaking save-some-buffers-action-alist Sergey Organov
2021-06-17 21:55 ` Daniel Martín [this message]
2021-06-18 19:16   ` Sergey Organov
2021-06-18 23:02     ` Stefan Monnier
2021-06-19 12:31       ` Sergey Organov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m1bl84i2ad.fsf@yahoo.es \
    --to=mardani29@yahoo.es \
    --cc=emacs-devel@gnu.org \
    --cc=sorganov@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).