2

I'm trying to get rid of the annoying prompt at the end of revert-buffer. This prompt would make sense in a lesser text editor where reverting the buffer is an irreversible action (pardon the pun). However, most of the time when I want to revert buffer I actually want it to do that, and do it right away.

One solution I've come up with was to call the non-interactive counterpart of the revert-buffer function

(global-set-key (kbd "C-r") (lambda () (revert-buffer nil t t))

but this for some reason ignores the second optional argument and still prompts me.

1
  • @Drew it does seem to be awfully close to what I want. Oct 12 at 15:48
1

I use this (and in keeping with the MS Windows key for reverting I bind it to <f5>). It's similar to what you're using, but not quite the same. I've been using it for a l o n g t i m e .

(defun revert-buffer-no-confirm ()
  "Revert buffer without confirmation."
  (interactive) (revert-buffer t t))
1

I believe you can set "revert-without-query" to t.

1
  • 1
    Nope. It needs to be set to a regex for files. Also setting it to the aforementioned regex doesn’t seem to work. Oct 12 at 15:47

Not the answer you're looking for? Browse other questions tagged or ask your own question.