From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Pascal Bourguignon Newsgroups: gmane.emacs.help Subject: Re: using variable names as args to interactive functions Date: Sat, 12 Jan 2008 03:09:04 +0100 Organization: Informatimago Message-ID: <87ejcn6bi7.fsf@thalassa.informatimago.com> References: <96f5c9ae-3f50-4f54-9537-92a27cd618e8@f47g2000hsd.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1200105632 3734 80.91.229.12 (12 Jan 2008 02:40:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 12 Jan 2008 02:40:32 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jan 12 03:40:54 2008 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.50) id 1JDWIo-0006TL-28 for geh-help-gnu-emacs@m.gmane.org; Sat, 12 Jan 2008 03:40:54 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JDWIQ-0003sq-Ap for geh-help-gnu-emacs@m.gmane.org; Fri, 11 Jan 2008 21:40:30 -0500 Original-Path: shelby.stanford.edu!headwall.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 37 Original-X-Trace: individual.net 1/8dwumuzl4L85hztdq2kwqDPJems+OY7NItbhWdAAyxAS5J45 Cancel-Lock: sha1:YmU0YzQyNzc5MzM2NTY0ZmUzMmJjODE0YTAwMDQ0NDIwMjMyMjVlNQ== sha1:HKKhjsKiQsZlFTZ7jX02o7tqRIM= Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwAQMAAABtzGvEAAAABlBMVEUAAAD///+l2Z/dAAAA oElEQVR4nK3OsRHCMAwF0O8YQufUNIQRGIAja9CxSA55AxZgFO4coMgYrEDDQZWPIlNAjwq9 033pbOBPtbXuB6PKNBn5gZkhGa86Z4x2wE67O+06WxGD/HCOGR0deY3f9Ijwwt7rNGNf6Oac l/GuZTF1wFGKiYYHKSFAkjIo1b6sCYS1sVmFhhhahKQssRjRT90ITWUk6vvK3RsPGs+M1RuR mV+hO/VvFAAAAABJRU5ErkJggg== X-Accept-Language: fr, es, en X-Disabled: X-No-Archive: no User-Agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.1.50 (gnu/linux) Original-Xref: shelby.stanford.edu gnu.emacs.help:155258 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:50674 Archived-At: Stuart writes: > I have some variables which I set at startup with setq. There are a > bunch of variables that get set. Each is a string representing a > directory path. I want a function which I can just type the variable > name and it opens dired with that directory. > > However, this doesn't work because the interactive option "v" doesn't > include the variables set with setq because this requires that: "A > variable declared to be a user option (i.e., satisfying the predicate > user-variable-p)." > > Any ideas? Thanks. > > (defun find-my-special-dir (dir) > (interactive "vSpecial dir: ") > (find-file dir)) Ask for a random expression: (defun test (dir) (interactive "XExpression: ") (message (format "Got %S" dir))) M-x test RET (concat (first load-path) "/toto") RET Gives: Got "/home/pjb/src/public/emacs//toto" (my (first load-path) is "/home/pjb/src/public/emacs/"). -- __Pascal Bourguignon__ http://www.informatimago.com/ "Debugging? Klingons do not debug! Our software does not coddle the weak."