unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: "alin.s" <alinsoar@voila.fr>
To: Emacs-devel@gnu.org
Subject: Re: interactive?
Date: Mon, 18 Jan 2010 06:10:28 -0800 (PST)	[thread overview]
Message-ID: <27210996.post@talk.nabble.com> (raw)
In-Reply-To: <20100118140048.GA26135@tomas>




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	other threads:[~2010-01-18 14:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-18 13:32 interactive? alin.s
2010-01-18 13:44 ` interactive? Andreas Schwab
2010-01-18 14:03   ` interactive? alin.s
2010-01-18 14:00 ` interactive? tomas
2010-01-18 14:10   ` alin.s [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=27210996.post@talk.nabble.com \
    --to=alinsoar@voila.fr \
    --cc=Emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).