From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: jdx2172 Newsgroups: gmane.emacs.help Subject: Re: a function more than interactive.. Date: Wed, 12 May 2010 14:45:48 -0700 (PDT) Organization: http://groups.google.com Message-ID: <1c693c4d-4c6d-42f4-82d1-37187e605630@i10g2000yqh.googlegroups.com> References: <98189c61-6637-4e08-949b-a591904f9271@b7g2000yqk.googlegroups.com> <87k4raxd0y.fsf@rapttech.com.au> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1291929271 2040 80.91.229.12 (9 Dec 2010 21:14:31 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 9 Dec 2010 21:14:31 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Dec 09 22:14:27 2010 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PQnoi-0007YL-9P for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 22:14:20 +0100 Original-Received: from localhost ([127.0.0.1]:45092 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PQngy-0003jY-SK for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Dec 2010 16:06:20 -0500 Original-Path: usenet.stanford.edu!postnews.google.com!i10g2000yqh.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 96 Original-NNTP-Posting-Host: 99.91.198.104 Original-X-Trace: posting.google.com 1273700748 17399 127.0.0.1 (12 May 2010 21:45:48 GMT) Original-X-Complaints-To: groups-abuse@google.com Original-NNTP-Posting-Date: Wed, 12 May 2010 21:45:48 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: i10g2000yqh.googlegroups.com; posting-host=99.91.198.104; posting-account=ljoAGgoAAAAkz6_SBYuEugXufNJmL2BB User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.9) Gecko/20100401 Ubuntu/9.10 (karmic) Firefox/3.5.9,gzip(gfe) Original-Xref: usenet.stanford.edu gnu.emacs.help:178170 X-Mailman-Approved-At: Thu, 09 Dec 2010 16:00:58 -0500 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:77070 Archived-At: On May 11, 6:57=A0pm, Tim X wrote: > jdx2172 writes: > > [Dont know what to call this functionality in emacs.. hence the > > subject "more than interactive..."] > > > How do I write a function that when executed prompts the user to enter > > a value at a prompt, asks another value and so on.. until all the > > arguments are provided returns a result. > > Just use multiple argument specifiers in your call to interactive > > ,----[ C-h f interactive RET ] > | interactive is a special form in `C source code'. > | > | (interactive &optional ARGS) > | > | Specify a way of parsing arguments for interactive use of a function. > | For example, write > | =A0(defun foo (arg buf) "Doc string" (interactive "P\nbbuffer: ") .... = ) > | =A0to make ARG be the raw prefix argument, and set BUF to an existing b= uffer, > | =A0when `foo' is called as a command. > | The "call" to `interactive' is actually a declaration rather than a fun= ction; > | =A0it tells `call-interactively' how to read arguments > | =A0to pass to the function. > | When actually called, `interactive' just returns nil. > | > | Usually the argument of `interactive' is a string containing a code let= ter > | =A0followed optionally by a prompt. =A0(Some code letters do not use I/= O to get > | =A0the argument and do not use prompts.) =A0To get several arguments, c= oncatenate > | =A0the individual strings, separating them by newline characters. > | Prompts are passed to format, and may use % escapes to print the > | =A0arguments that have already been read. > | If the argument is not a string, it is evaluated to get a list of > | =A0arguments to pass to the function. > | Just `(interactive)' means pass no args when calling interactively. > | > | Code letters available are: > | a -- Function name: symbol with a function definition. > | b -- Name of existing buffer. > | B -- Name of buffer, possibly nonexistent. > | c -- Character (no input method is used). > | C -- Command name: symbol with interactive function definition. > | d -- Value of point as number. =A0Does not do I/O. > | D -- Directory name. > | e -- Parametrized event (i.e., one that's a list) that invoked this com= mand. > | =A0 =A0 =A0If used more than once, the Nth `e' returns the Nth paramete= rized event. > | =A0 =A0 =A0This skips events that are integers or symbols. > | f -- Existing file name. > | F -- Possibly nonexistent file name. > | G -- Possibly nonexistent file name, defaulting to just directory name. > | i -- Ignored, i.e. always nil. =A0Does not do I/O. > | k -- Key sequence (downcase the last event if needed to get a definitio= n). > | K -- Key sequence to be redefined (do not downcase the last event). > | m -- Value of mark as number. =A0Does not do I/O. > | M -- Any string. =A0Inherits the current input method. > | n -- Number read using minibuffer. > | N -- Numeric prefix arg, or if none, do like code `n'. > | p -- Prefix arg converted to number. =A0Does not do I/O. > | P -- Prefix arg in raw form. =A0Does not do I/O. > | r -- Region: point and mark as 2 numeric args, smallest first. =A0Does = no I/O. > | s -- Any string. =A0Does not inherit the current input method. > | S -- Any symbol. > | U -- Mouse up event discarded by a previous k or K argument. > | v -- Variable name: symbol that is user-variable-p. > | x -- Lisp expression read but not evaluated. > | X -- Lisp expression read and evaluated. > | z -- Coding system. > | Z -- Coding system, nil if no prefix arg. > | > | In addition, if the string begins with `*', an error is signaled if > | =A0 the buffer is read-only. > | If the string begins with `@', Emacs searches the key sequence which > | =A0invoked the command for its first mouse click (or any other event > | =A0which specifies a window). > | If the string begins with `^' and `shift-select-mode' is non-nil, > | =A0Emacs first calls the function `handle-shift-selection'. > | You may use `@', `*', and `^' together. =A0They are processed in the > | =A0order that they appear, before reading any arguments. > `---- > > -- > tcross (at) rapttech dot com dot au thanks everyone for all the help. read-from-minibuffer was the exactly the interactivity I was looking for.