From: Kevin Rodgers <kevin.d.rodgers@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: using variable names as args to interactive functions
Date: Tue, 15 Jan 2008 20:01:05 -0700 [thread overview]
Message-ID: <fmjs1h$b7$2@ger.gmane.org> (raw)
In-Reply-To: <7623c908-28e8-4116-acc3-1a7196bb0c3e@e32g2000prn.googlegroups.com>
Stuart wrote:
> Here's what I ended up doing:
>
> First I changed all the my script to generate the variables as
> defvar's instead of setq's:
> (defvar my-special-dir-a "/path/to/my/special/dir" "*Special
> directory `a'.")
>
> This allows the "*" to make it a user variable so it can be read by
> the interactive prompt.
>
> Now my definition looks like this:
>
> (defun find-my-special-dir (dir)
> (interactive "vSpecial Directory: ")
> (find-file (symbol-value (symbol-value 'dir))))
>
> symbol-value 'dir returns the name of the variable the user types at
> the prompt (i.e., my-special-dir-a)
> Then the symbol-value on top of that returns the string "/path/to/my/
> special/dir" and now it works!
(find-file (symbol-value dir)) ; dir should be renamed dir-sym
--
Kevin Rodgers
Denver, Colorado, USA
prev parent reply other threads:[~2008-01-16 3:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-12 0:53 using variable names as args to interactive functions Stuart
2008-01-12 2:09 ` Pascal Bourguignon
2008-01-12 3:28 ` Daniel Pittman
2008-01-13 8:40 ` Mathias Dahl
2008-01-15 3:17 ` Kevin Rodgers
2008-01-16 1:42 ` Stuart
2008-01-16 3:01 ` Kevin Rodgers [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='fmjs1h$b7$2@ger.gmane.org' \
--to=kevin.d.rodgers@gmail.com \
--cc=help-gnu-emacs@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.
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).