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

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

Re: A question about interactive


From: C K Kashyap
Subject: Re: A question about interactive
Date: Fri, 22 Mar 2013 12:29:31 +0530

Thanks a lot Drew ... using read-file-name worked for me 

(defun f ()
  (interactive)
  (setq fn (read-file-name "Enter filename" "C:/"))
  (insert fn)
)

I did not have to do the let-binding of default-directory - actually I do not know how to do it either. It'll be great if you could show me what you meant.

Regards,
Kashyap



On Thu, Mar 21, 2013 at 6:54 PM, Drew Adams <drew.adams@oracle.com> wrote:
> Here's what I want to do  - I'd like to write utility
> functions in different el files and store them in a
> particular directory. then write a function in .emacs
> - say - my-script-load ... What I'd like it to do is
> this: (interactive "fEnter script name: ")
>
> Now, the problem is that  the ineractive "f" seems to
> use the current buffer location as the starting point.
> How can I change that?

In the `interactive' spec, let-bind `default-directory' and then read the file
name with `read-file-name'.  See the doc for `interactive'.



reply via email to

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