help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using variable names as args to interactive functions


From: Pascal Bourguignon
Subject: Re: using variable names as args to interactive functions
Date: Sat, 12 Jan 2008 03:09:04 +0100
User-agent: Gnus/5.1008 (Gnus v5.10.8) Emacs/22.1.50 (gnu/linux)

Stuart <address@hidden> 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."


reply via email to

[Prev in Thread] Current Thread [Next in Thread]