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

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

Re: what does (interactive "P") do?


From: Oliver Scholz
Subject: Re: what does (interactive "P") do?
Date: Thu, 21 Nov 2002 00:40:01 +0100
User-agent: Gnus/5.090008 (Oort Gnus v0.08) Emacs/21.2 (i386-msvc-nt5.1.2600)

seberino@spawar.navy.mil writes:

> I just saw (interactive "P") in a .emacs and
> wondered what it did.  I assume (interactive)
> lets a user run a function v. just being
> run from another function.

It declares that the function is a command. That is, a user may run it
via M-x and it may be bound to a keystroke.

> What extra functiononality does the "P" give you?

With "P" in the spec string of `interactive' the prefix (`C-u ...') is
passed in raw form as an argument to the function. It is typically
used in forms like

(my-fancy-function (prefix)
  (interactive "P")
  ...
  (if (prefix)
      (do-something)
    (do-something-different))
   ...)

See `C-h f interactive RET' for a complete list of code letters for
`interactive'.

    Oliver
-- 
1 Frimaire an 211 de la Révolution
Liberté, Egalité, Fraternité!


reply via email to

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