help-gnu-emacs
[Top][All Lists]
Advanced

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

Make optional argument equal to 0


From: weber
Subject: Make optional argument equal to 0
Date: 9 Feb 2007 03:16:54 -0800
User-agent: G2/1.0

Hello.
I'd like to set 'arg' to zero when nothing is passed as argument.
Here is a test function:

(defun try-arg (&optional arg)
  "Show which arg is passed."
  (interactive "p")
  (or arg (setq arg 0))
  (message "arg = %d" arg))

If I just call it with M-x try-arg, shouldn't I be geting a 0  ?
I'm getting a 1! :)

Thanks in advance,
weber



reply via email to

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