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

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

RE: build a macro that opens a directory and prompts for file name


From: Drew Adams
Subject: RE: build a macro that opens a directory and prompts for file name
Date: Fri, 23 Jan 2009 23:16:47 -0800

> > > I have been googleing and reading the docs trying to figure out a
> > > solution to this. I spend the majority of my time working 
> > > in a single directory on a CIFS server and I am always doing a 
> > > C-x C-f \\server\dir\long_sub_dir\subdir\filename
> >
> > > In the spirit of emacs I'd like to automate it so that 
> > > when I do C-co it knows the directory and simply prompts me for
> > > the file to be opened or if I leave it blank and press RET it
> > > lists the directory.
> >
> > I use bookmarks to take me to the directories themselves.
>
> Thanks Chris. That is exactly what I need. Wonderful.

I too use and recommend using bookmarks.

But from your description, all you want is a command that reads a file name in
some predefined directory. You can do that just by binding `default-directory'
to the directory and calling `find-file':

(defun foo ()
  "Visit a file in my favorite directory."
  (interactive)
  (let ((default-directory "/my.server.somewhere:/dir/longsubdir/subdir/"))
    (call-interactively 'find-file)))





reply via email to

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