Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

For some reason, emacs functions which use the interactive form don't work for me on Mac OS x. The emacs I am using is from, which up until now has worked flawlessly. An example of such a function that uses interactive (taken from here) is:

(defun multiply-by-seven (number)       ; Interactive version.
   "Multiply NUMBER by seven."
   (interactive "p")
   (message "The result is %d" (* 7 number)))

I run it in scratch with C-x C-e, but I'm not able to enter a number and get anything out.

share|improve this question
How are you attempting to enter the number? What is the error you're getting? – Darren Hall Jan 6 '10 at 2:28
up vote 5 down vote accepted

I am a little worried by:

I run it in scratch with C-x C-e

This does not run the function, it just evaluates it. To call the function you can evaluate:

(multiply-by-seven 10)
  => "The result is 70"

with C-x C-e or call it interactivly:

M-x multiply-by-seven
  => "The result is 7"

and call it with an argument

C-u M-x multiply-by-seven
  => "The result is 28"


C-u 7 M-x multiply-by-seven
  => "The result is 49"

as (interactive "p") uses the numeric prefix argument, Emacs Manual

share|improve this answer
+1 for "This does not run the function, it just evaluates it." – Doug Harris Jan 6 '10 at 19:39
+1 Yup, I noticed this myself after digging in a bit more. My emacs fu is very weak. Thanks for the comprehensive answer. – Rob Jan 7 '10 at 6:26

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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