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?

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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