I have the following lines in my config file:

(fset 'yes-or-no-p 'y-or-n-p)
(setq confirm-kill-emacs ‘yes-or-no-p)

The latter line is what's throwing the error. I would like to be able to use 'y-or-n-p for some commands, like confirm-kill-emacs.

  • 2
    Always look closely at the error message. It's referring to a variable named ‘yes-or-no-p. Note the quotation mark, , that is part of the variable name.
    – Drew
    Jun 29, 2019 at 14:42

2 Answers 2


Put your cursor over the character on the line (setq confirm-kill-emacs ‘yes-or-no-p) and press C-x =.

Char: ‘ (8216, #o20030, #x2018, file ...) point=698 of 698 (100%) column=0

That's the left quotation mark (with C-u C-x = you can see its Unicode name: LEFT SINGLE QUOTATION MARK). This character has no special meaning to Emacs.

You need to use the ASCII apostrophe/single-quote character instead:

(setq confirm-kill-emacs 'yes-or-no-p)

(Leaving aside why you'd use yes-or-no-p here since you've aliased it to y-or-n-p.)

  • I knew it was something stupid. On your aside, could you elaborate as to how would I go about setting some commands to require "yes" while having the default just requiring "y"?
    – alecvn
    Jun 29, 2019 at 15:06
  • 1
    @skepticscript I don't think there's a universal recipe. Some commands have an ad hoc option (e.g. confirm-kill-emacs). Others hard-code the call to yes-or-n-p or to y-or-n-p. For hard-coded cases, see e.g. emacs.stackexchange.com/q/19077 and emacs.stackexchange.com/q/22569 . Jun 29, 2019 at 15:38

As @Gilles mentioned, once you have fset (aka aliased) the call to y-or-n-p, yes-or-no-p has been effectively overwritten. Based on the link in his comment, it seems the best way to do things is to specifically set y-or-n-p on certain prompts, and that it likely isn't possible to have y-or-n-p as a default and override certain prompts with yes-or-no-p, at least not without writing a really convoluted implementation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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