🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.help
Article #189710

Re: Wierdness with command argument?

#189710
From: Piet van Oostrum
Date: Tue, 04 Dec 1990 14:23
18 lines
1474 bytes
>>>>> In message <JMERRILL.90Nov29194325@fenris.claremont.edu>, jmerrill@jarthur.claremont.edu (Generic User) (JM) writes:

JM> -----copied from *scratch*-----
JM> (defun test (arg)
JM>   "Echoes arg.  If no arg, echoes nil."
JM>   (interactive "p")
JM>   (if (null arg)
JM>       (message "arg is nil")
JM>     (message "arg is %d" arg)))

JM> Shouldn't a command called with no prefix have a null argument, rather
JM> than 1?  Typing M-x test gives me the same result.

"p" means prefix argument as numeric. null is not numeric. Most commands
that use a numeric prefix argument use it as some kind of count (e.g.
number of times to do a basic operation), and want the default to be 1.
-- 
Piet van Oostrum <piet@cs.ruu.nl>
Technical Details
Message-ID: <4453@ruuinf.cs.ruu.nl>
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!hp4nl!ruuinf!piet
References: <JMERRILL.90Nov29194325@fenris.claremont.edu>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 103b8b,e3dd406c1062efca
X-Google-Attributes: gid103b8b,public
X-Google-ArrivalTime: 1990-12-04 08:59:48 PST
Path: arc1-ca.pugleaf.net!gmdzi!unido!mcsun!hp4nl!ruuinf!piet
From: piet@cs.ruu.nl (Piet van Oostrum)
Newsgroups: gnu.emacs.help
Subject: Re: Wierdness with command argument?
Message-ID: <4453@ruuinf.cs.ruu.nl>
Date: 4 Dec 90 14:23:31 GMT
References: <JMERRILL.90Nov29194325@fenris.claremont.edu>
Sender: news@ruuinf.cs.ruu.nl
Reply-To: piet@cs.ruu.nl (Piet van Oostrum)
Distribution: gnu
Organization: Dept of Computer Science, Utrecht University, The Netherlands
Lines: 18
Posted: Tue Dec  4 15:23:31 1990
In-reply-to: jmerrill@jarthur.claremont.edu (Generic User)