How do I automatically say yes when I run a command in Emacs?

I had to run the command several times revert-bufferand was very upset to say yes when emacs asks for this message Revert buffer from file abc.txt? (yes or no).

In any case, to say yes to the car ?

+4
source share
5 answers

If it's just for interactive use, I would define an alternative function:

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

Alternatively, as revert-bufferdocstring tells you , look at the variable revert-without-queryif you get a nicer solution.

+6
source

.emacs, ( y n):

(defalias 'yes-or-no-p 'y-or-n-p)
+3

, , @phils, nil IGNORE-AUTO arg:

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

<f5>, , , MS Windows.

, () , . revert-without-query, () .. revert-buffer (, , ) . , .

+2

revert-without-query .

0

Although, as pointed out by other answers, it is preferable to override a function revert-bufferor key binding, you can automatically answer “yes” to any function with yes-or-no-por, for that matter, y-or-n-pas follows:

(defalias 'yes-or-no-p '(lambda (a &rest b) t))

This can be very damaging to your data, so use as you see fit.

0
source

All Articles