emacseditorelispemacs24

How to auto say Yes when run a command in Emacs?


I had to run the command revert-buffer many times recently and really frustrated to say yes whenever emacs prompts this message Revert buffer from file abc.txt? (yes or no).

Is there anyway to auto say yes in this case?


Solution

  • If it's just for interactive usage, I'd define an alternative function:

    (defun my-revert-buffer-noconfirm ()
      "Call `revert-buffer' with the NOCONFIRM argument set."
      (interactive)
      (revert-buffer nil t))
    

    Alternatively, as the revert-buffer docstring tells you, take a look at the revert-without-query variable, in case that's a nicer solution for you.