[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Another lisp question

From: Klaus Jantzen
Subject: Re: Another lisp question
Date: Fri, 16 Apr 2010 11:40:08 +0200
User-agent: Mozilla-Thunderbird (X11/20090707)

Drew Adams wrote:
(interactive  "sEnter number: ")
Consider using `read-number':

(interactive (list (read-number "Number: " 42)))

When hitting <Enter> without entering anything, emacs comes 
back to the input request. How can I find out, that nothing
has been entered so that I can use e.g. a default value?
I don't understand how that happens to you.
It should just return the empty string, "".

M-: (defun foo (arg) (interactive "sNum: ") (message "%S" arg))
M-x foo RET RET

That returns "" for me.

Here is my function

(defun mytest (n)
  " Test"
  ; (interactive "nEnter number: ")
  (interactive (list (read-number "Enter number: ")))
  (message "%d was entered" n)

With both versions of the interactive statement I have the same effect: the prompt comes back
as long as I do not enter anything.

I am running emacs22 on Debian lenny.
Do I need a special setting to achive what I want?


reply via email to

[Prev in Thread] Current Thread [Next in Thread]