unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* question about optional arguments
@ 2004-01-08  5:36 leo
  2004-01-08  6:29 ` David Kastrup
  0 siblings, 1 reply; 4+ messages in thread
From: leo @ 2004-01-08  5:36 UTC (permalink / raw)


hi there

the function dired-get-marked-files  has two optinal arguments, so its
definition looks like

    dired-get-marked-files (&optional localp arg)

now i want to call dired-get-marked-files with the specific value 1 for
secend argument arg but without a value for the first argument localp,
because the function behaves differently, whether call with an optinal
localp or not.

calling it with true for localp like

    (dired-get-marked-files t 1)

obiviously doesn't do the job. so,what can i do?
thanks a lot, leo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: question about optional arguments
  2004-01-08  5:36 question about optional arguments leo
@ 2004-01-08  6:29 ` David Kastrup
  2004-01-08 22:25   ` leo
  0 siblings, 1 reply; 4+ messages in thread
From: David Kastrup @ 2004-01-08  6:29 UTC (permalink / raw)


"leo" <halloleo@noospaam.myrealbox.com> writes:

> the function dired-get-marked-files  has two optinal arguments, so its
> definition looks like
> 
>     dired-get-marked-files (&optional localp arg)
> 
> now i want to call dired-get-marked-files with the specific value 1 for
> secend argument arg but without a value for the first argument localp,
> because the function behaves differently, whether call with an optinal
> localp or not.
> 
> calling it with true for localp like
> 
>     (dired-get-marked-files t 1)
> 
> obiviously doesn't do the job. so,what can i do?

Is that a trick question?

(dired-get-marked-files nil 1)

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: question about optional arguments
  2004-01-08  6:29 ` David Kastrup
@ 2004-01-08 22:25   ` leo
  2004-01-08 22:51     ` David Kastrup
  0 siblings, 1 reply; 4+ messages in thread
From: leo @ 2004-01-08 22:25 UTC (permalink / raw)



"David Kastrup" <dak@gnu.org> wrote in message
news:x57k03c5rm.fsf@lola.goethe.zz...
> "leo" <halloleo@noospaam.myrealbox.com> writes:
>
> > i want to call dired-get-marked-files with the specific value 1 for
> > secend argument arg but without a value for the first argument localp,
>
> Is that a trick question?

no, probably just a stupid question, sorry.

> (dired-get-marked-files nil 1)

thanks david, i didn't know that nil is as good as no argument.

cheers, leo

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: question about optional arguments
  2004-01-08 22:25   ` leo
@ 2004-01-08 22:51     ` David Kastrup
  0 siblings, 0 replies; 4+ messages in thread
From: David Kastrup @ 2004-01-08 22:51 UTC (permalink / raw)


"leo" <halloleo@noospaam.myrealbox.com> writes:

> "David Kastrup" <dak@gnu.org> wrote in message
> news:x57k03c5rm.fsf@lola.goethe.zz...
> > "leo" <halloleo@noospaam.myrealbox.com> writes:
> >
> > > i want to call dired-get-marked-files with the specific value 1 for
> > > secend argument arg but without a value for the first argument localp,
> >
> > Is that a trick question?
> 
> no, probably just a stupid question, sorry.
> 
> > (dired-get-marked-files nil 1)
> 
> thanks david, i didn't know that nil is as good as no argument.

Then it would not have done harm to look up argument lists in the
manual:

   A call to the function requires one actual argument for each of the
REQUIRED-VARS.  There may be actual arguments for zero or more of the
OPTIONAL-VARS, and there cannot be any actual arguments beyond that
unless the lambda list uses `&rest'.  In that case, there may be any
number of extra actual arguments.

   If actual arguments for the optional and rest variables are omitted,
then they always default to `nil'.  There is no way for the function to
distinguish between an explicit argument of `nil' and an omitted
argument.  However, the body of the function is free to consider `nil'
an abbreviation for some other meaningful value.  This is what
`substring' does; `nil' as the third argument to `substring' means to
use the length of the string supplied.

-- 
David Kastrup, Kriemhildstr. 15, 44793 Bochum

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2004-01-08 22:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-01-08  5:36 question about optional arguments leo
2004-01-08  6:29 ` David Kastrup
2004-01-08 22:25   ` leo
2004-01-08 22:51     ` David Kastrup

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).