From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Drew Adams Newsgroups: gmane.emacs.help Subject: RE: How to write (interactive) with user-selection from predefined enumeration? (was Re: (interactive "rP") valid?) Date: Tue, 28 May 2013 10:27:44 -0700 (PDT) Message-ID: <061d4281-1056-4df6-993d-9c4a845bbe50@default> References: <87mwrfe4oy.fsf@gmail.com> <51A4972C.5000903@easy-emacs.de> <87ip23e3ev.fsf@gmail.com> <87a9nfdvdz.fsf@gmail.com> <6cc8e9f1-e7ce-4646-b7ac-be2a57b84ab2@default> <87fvx7cayr.fsf_-_@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1369762088 25566 80.91.229.3 (28 May 2013 17:28:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 28 May 2013 17:28:08 +0000 (UTC) To: Thorsten Jolitz , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue May 28 19:28:06 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UhNgn-0003ZW-Sb for geh-help-gnu-emacs@m.gmane.org; Tue, 28 May 2013 19:28:01 +0200 Original-Received: from localhost ([::1]:51576 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhNgn-00061L-3c for geh-help-gnu-emacs@m.gmane.org; Tue, 28 May 2013 13:28:01 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:48033) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhNgd-00061A-RA for help-gnu-emacs@gnu.org; Tue, 28 May 2013 13:27:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UhNgb-0006ix-K6 for help-gnu-emacs@gnu.org; Tue, 28 May 2013 13:27:51 -0400 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:39068) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UhNgb-0006hT-B8 for help-gnu-emacs@gnu.org; Tue, 28 May 2013 13:27:49 -0400 Original-Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by aserp1040.oracle.com (Sentrion-MTA-4.3.1/Sentrion-MTA-4.3.1) with ESMTP id r4SHRkGM014060 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 28 May 2013 17:27:47 GMT Original-Received: from userz7021.oracle.com (userz7021.oracle.com [156.151.31.85]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r4SHRjAY016836 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Tue, 28 May 2013 17:27:45 GMT Original-Received: from abhmt116.oracle.com (abhmt116.oracle.com [141.146.116.68]) by userz7021.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id r4SHRiiE012632; Tue, 28 May 2013 17:27:45 GMT In-Reply-To: <87fvx7cayr.fsf_-_@gmail.com> X-Priority: 3 X-Mailer: Oracle Beehive Extensions for Outlook 2.0.1.7 (607090) [OL 12.0.6668.5000 (x86)] X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:91107 Archived-At: > OK, I did read the 'interactive' section of the manual again, but I did > not find the answer to this question (although it is most likely there, > somehere): Hm. "Most likely there somewhere". Does that mean that you did not spend time looking for it or you did spend time and couldn't find it? If the latter, use `M-x report-emacs-bug', to let Emacs Dev know what's missing - say just how you looked and what you think would have made your search easier. Emacs Dev is usually open to improvement suggestions, such as adding index entries or clarifying the text. If the former, I have only a little sympathy. Sure, it might seem easier to write a question here (and again, there is nothing wrong with that). But learning to take advantage of the Emacs doc and help system (`C-h f interactive') yourself is a win for everyone, especially you. > How to write an interactive function and let the user choose from a list > (an enumeration) of possible solutions as input (like: Item1 | Item2 | > Item3)? Wrt the original question, (elisp) `Using Interactive' (the first target re= ached from `i interactive') gives two examples using \n, and it says: "It may be a string; its contents are a sequence of elements separated by newlines, one for each argument(1)." And that node cross-references node `Interactive Codes', which explains mor= e. As to your new question, what is each ItemN? Just any old name, or the nam= e of a particular kind of Emacs object? Node `Interactive Codes' explains about code chars that allow for completio= n (of choices). It says that you get this for choosing the name of a functio= n, buffer, command, directory, file, user option, or coding system. Beyond that, node `Using Interactive' explains that the `interactive' spec = can be a Lisp sexp that returns a list of args to be passed to the command. Yo= u really cannot get more general than that: you can do pretty much anything h= ere. `Using Interactive' explains how to code such a list. As one example, you = can use `completing-read' to read a user choice among any kind of completion candidates (not just names of functions, buffers, commands, directories, fi= les, options, and coding systems). What more do you need? The manual is your friend.