emacs-devel
[Top][All Lists]
Advanced

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

Re: interactive?


From: alin.s
Subject: Re: interactive?
Date: Mon, 18 Jan 2010 06:10:28 -0800 (PST)



Tomas Zerolo wrote:
> 
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> On Mon, Jan 18, 2010 at 05:32:02AM -0800, alin.s wrote:
>> 
>> I do not understand the use of (interactive )
>> 
>> (defun x (n)
>>   (interactive "P")
>>   n)
> 
> (See also Andreas' reply)
> 
> One way to look at it is that an interactive function is also a
> "command": you, as a user get help to call such a function. For example,
> you can call "query-replace-regexp" with M-x query-replace-regexp and
> get help with tab-expansion and with parameters (just try), because it
> was declared "interactive" (note that the call for interactive has
> specifications about how to prompt for the different arguments).
> 
> 
> 

This happens because execute-extended-command calls Fcompleting_read with
the predicate Qcommandp, in order to limit the results. Only interactive
forms are returned:

  function = Fcompleting_read (build_string (buf),
                               Vobarray, Qcommandp,
                               Qt, Qnil, Qextended_command_history, Qnil,
                               Qnil);

You need to declare a function interactive if you want to bind it to a
menu or key.

Yes, due to the call of commandp inside Fcompleting_read.


Besides that, it will still behave as a normal function.

Yes, because (interactive) returns null all the time.


Now I understand, thank you all.




Alin

-- 
View this message in context: 
http://old.nabble.com/interactive--tp27210523p27210996.html
Sent from the Emacs - Dev mailing list archive at Nabble.com.





reply via email to

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