[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 Felsted Thorsen |
Subject: |
Re: set a "default" directory in a function when asking for a file |
Date: |
Sun, 16 Nov 2008 19:06:40 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) |
Niels Giesen <niels.giesen@gmail.com> writes:
> 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))
Thank you :)