help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: How to revert buffer from "Save file?" prompt?


From: Sergey Organov
Subject: Re: How to revert buffer from "Save file?" prompt?
Date: Thu, 10 Jun 2021 20:14:56 +0300
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Sergey Organov <sorganov@gmail.com>

[...]

>> As I've asked in another mail: is there a practical way to add
>> keybindings to this prompt? I'd then opt for adding "C-M-g: revert the
>> buffer" and be finally done with it.
>
> See save-some-buffers-action-alist.

Here is customization I came up with:

(nconc
 save-some-buffers-action-alist
 '((?\C-\M-g
    (lambda (buf)
      (with-current-buffer buf
        (revert-buffer)))
    "revert this buffer")))

Seems to work as expected. Does it look correct?

What about all the ,( tricks in the original (that didn't work for me)?
Should I somehow adopt them? See:

(defvar save-some-buffers-action-alist
  `((?\C-r
     ,(lambda (buf)
        (if (not enable-recursive-minibuffers)
            (progn (display-buffer buf)
                   (setq other-window-scroll-buffer buf))
          (view-buffer buf (lambda (_) (exit-recursive-edit)))
          (recursive-edit))
        ;; Return nil to ask about BUF again.
        nil)
     ,(purecopy "view this buffer"))))

Thanks,
-- Sergey Organov



reply via email to

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