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

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

Re: set a "default" directory in a function when asking for a file


From: Niels Giesen
Subject: Re: set a "default" directory in a function when asking for a file
Date: Sun, 16 Nov 2008 16:47:06 +0100
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.2 (gnu/linux)

Niels Felsted Thorsen <nift@maclisp.org> writes:

> Hi
>
> I have a function like this:
>
> (defun testfun (file)
>   (interactive "fFile: ")
>   (message file))
>
> But it will ask for the file based on, as I understand it, the value
> of "default-directory" which is buffer-local.
>
> Is there a way to specify default-directory just for this function? So
> it will always start with fx:
>
> File: ~/foo/bar/
>
> when asking for the file.
>

Define your function as follows:

(defun testfun (file)
  (interactive (list (read-file-name "File: " "~/foo/bar/")))
  (message file))



reply via email to

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