Elisp: yes or no assignment in interactive commands

I am new to Emacs and trying to write some Emacs Lisp functions.

I would like to write a function that takes two parameters and can handle interactivity. However, one of the parameters is logical - it would be ideal if I could use (y-or-no-p) , but (interactive) doesn't seem to have character code for this.

Any ideas?

Update: I am using GNU Emacs 23.

Also, here is what my function looks like:

 (defun foo (str bool) (interactive "sSome text: \nsDo the thing?") (some-func str) (if bool (some-other-func str))) 
+6
emacs lisp elisp
source share
2 answers

Ah, found him.

 (defun foo (str bool) (interactive (list (read-string "Some text: ") (y-or-np "Do the thing? "))) (some-func str) (if bool (some-other-func str))) 
+10
source share

Not quite sure what you are asking, but I cannot find a function called y-or-no-p. Did you mean yes-or-no-p?

This is similar to what I expect.

+1
source share

All Articles