Subject: Re: bug#49869: Revert buffer? Yes/No/Maybe

From: Gregory Heytings <[email-masked]>
Date: Wed, 04 Aug 2021 12:22:09 +0000

>> There is a new short keybinding to revert the current buffer - just 3 
>> keys: 'C-x x g'.  But then it asks for a confirmation with 4 keys: 'y e 
>> s RET' that is even longer than the command keys. This defeats the 
>> purpose of having the short key sequence. Does 'C-x x g' really need a 
>> confirmation?
>
> It's quite a drastic measure, so I think it does need a confirmation. 
> E.g., if the changes you revert exceed the value of undo-limit, you 
> could really lose your edits.
>
> Since we now have the use-short-answers option, why is it a problem to 
> have to confirm, if you could make it a single key?
>

I had forgotten about use-short-answers, it makes the proposed solution 
even shorter:

(defun revert-buffer-short-answer (&optional args)
   (interactive (list (not current-prefix-arg)))
   (let ((use-short-answers t))
     (revert-buffer args)))

(global-set-key (kbd "C-x x g") 'revert-buffer-short-answer)