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

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

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


From: Eli Zaretskii
Subject: Re: Prefix-Arg (non-interactive!) in Info
Date: Fri, 13 Aug 2010 18:17:31 +0300

> From: Memnon Anon <gegendosenfleisch@googlemail.com>
> Date: Fri, 13 Aug 2010 16:37:04 +0200
> 
> So, I thought this should be easy to find in the Info documentation and 
> started looking through the relevant documentation via the indices, and
> plain repeated `C-s' for things like C-u, universal argument etc.
> 
> But it was surprisingly difficult to find an answer to a simple
> question: How do I non-interactively! pass a prefix argument to a
> function?

This information is usually in the doc string of the function you want
to invoke.  For example:

    rename-buffer is an interactive built-in function in `C source code'.

    (rename-buffer NEWNAME &optional UNIQUE)

    Change current buffer's name to NEWNAME (a string).
    If second arg UNIQUE is nil or omitted, it is an error if a
    buffer named NEWNAME already exists.
    If UNIQUE is non-nil, come up with a new name using
    `generate-new-buffer-name'.
    Interactively, you can set UNIQUE with a prefix argument.
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

IOW, the prefix argument is normally one of the function's arguments,
so if you want to call the function non-interactively, just put there
the value you want to pass it.

The reason why you didn't find this in the Info manual is twofold:

  . You were looking for some general way of doing this, while the
    "normal" way is not general, but specific to each function --
    exactly which argument is mapped to the prefix argument is
    something each function determines for itself.

  . Since every function has a different argument mapped to the prefix
    arg, the manual doesn't have any discussions of this, except when
    it describes each and every function.



reply via email to

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