0

I'm trying to write some Emacs Lisp. But I stumble on one thing. The code is structured as following:

(defun foo ()
    (interactive)
    (if (yes-or-no-p "Do you want to call the function bar?")
        (progn 
            'bar
            ))
            )


(defun bar (string)
  (interactive "sType your input here? ")
  (message string))

Okay, when the user confirms the question, the function bar will be called. But nothing happens when I press y.

When reading the Elisp cookbooks and tutorials, they all says that yes-or-no-p functions returns a true when the user confirmed it. And the if is structured as following:

COND THEN ELSE

So the second argument should be calling since yes-or-no-p evaluates to true. Since this seems not the case, I'm missing something?

1
  • (progn 'bar) does not invoke function bar. C-h i, choose Emacs Lisp Intro.
    – Drew
    Aug 17, 2015 at 14:19

1 Answer 1

2

To call bar, use (bar "string") or (call-interactively 'bar) depending on how you want to specify the argument of bar.

0

Your Answer

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

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