I'm new to Emacs and am trying to write a few Emacs Lisp functions.
I'd like to write a function that takes two parameters and can handle being interactive. However, one of the parameters is a boolean — it'd be perfect if I could use (y-or-no-p)
, but (interactive)
doesn't seem to have a character code for that.
Any ideas?
Update: I'm using GNU Emacs 23.
Also, here's what my function looks like so far:
(defun foo (str bool)
(interactive "sSome text: \nsDo the thing?")
(some-func str)
(if bool (some-other-func str)))
Ah, found it.
(defun foo (str bool)
(interactive
(list (read-string "Some text: ")
(y-or-n-p "Do the thing? ")))
(some-func str)
(if bool (some-other-func str)))
Not quite sure what you're asking, but I can't find a function called y-or-no-p. Did you mean yes-or-no-p?
That seems to do what I would expect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With