[Top][All Lists]

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

RE: Prefix-Arg (non-interactive!) in Info

From: Drew Adams
Subject: RE: Prefix-Arg (non-interactive!) in Info
Date: Fri, 13 Aug 2010 09:21:48 -0700

> Let's try a different approach: which function would you like to call
> non-interactively, passing it some value of the prefix arg?  (Please
> don't say "it's not important which function": my point is _precisely_
> that it _is_ important, because the answer to your question is
> specific to the function you want to invoke.)
> > What I did not find, was, how to pass this argument non 
> > interactively - i.e. without `C-u' or M-4 - to a function.
> It depends on the function.

Eli's answers to you have been exactly correct.  His point is that it is the
definition of the particular function that determines which argument is (or
uses) the prefix argument, and how.  Any function can use the prefix argument
anyway it likes. 

Consequently, if you want to pass a prefix arg to a function non-interactively
then you must know how that function definition handles the value you pass.
Does it look only at whether or not a raw prefix arg is present (nil vs
non-nil)?  Does it look at the numeric value of the argument?  Does it
distinguish a cons such as (4) from a numeric value such as 4?  It is the
function that decides.

But perhaps you are writing your own function (that was not clear), and you want
to know how you can access the prefix argument and handle its possible values?

In any case, the relevant doc is node `Prefix Command Arguments' of the Elisp
manual.  You can find it easily via `i prefix argument RET' (that is, using the
manual's index).

There you will find not only a complete description of the possible values but
also the variable `current-prefix-arg' and the function `prefix-numeric-value',
both of which can be useful in handling prefix-arg values.

reply via email to

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