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.

2 Answers2

1

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

joncgoodwin
  • 697
  • 6
  • 3
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))
Drew
  • 75,699
  • 9
  • 109
  • 225