* Re: set a "default" directory in a function when asking for a file
[not found] <mailman.513.1226848810.26697.help-gnu-emacs@gnu.org>
@ 2008-11-16 15:47 ` Niels Giesen
2008-11-16 18:06 ` Niels Felsted Thorsen
0 siblings, 1 reply; 3+ messages in thread
From: Niels Giesen @ 2008-11-16 15:47 UTC (permalink / raw)
To: help-gnu-emacs
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))
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: set a "default" directory in a function when asking for a file
2008-11-16 15:47 ` set a "default" directory in a function when asking for a file Niels Giesen
@ 2008-11-16 18:06 ` Niels Felsted Thorsen
0 siblings, 0 replies; 3+ messages in thread
From: Niels Felsted Thorsen @ 2008-11-16 18:06 UTC (permalink / raw)
To: help-gnu-emacs
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 :)
^ permalink raw reply [flat|nested] 3+ messages in thread
* set a "default" directory in a function when asking for a file
@ 2008-11-16 13:39 Niels Felsted Thorsen
0 siblings, 0 replies; 3+ messages in thread
From: Niels Felsted Thorsen @ 2008-11-16 13:39 UTC (permalink / raw)
To: help-gnu-emacs
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2008-11-16 18:06 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <mailman.513.1226848810.26697.help-gnu-emacs@gnu.org>
2008-11-16 15:47 ` set a "default" directory in a function when asking for a file Niels Giesen
2008-11-16 18:06 ` Niels Felsted Thorsen
2008-11-16 13:39 Niels Felsted Thorsen
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).