[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: |
Mon, 26 Jan 2009 10:15:50 -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':
>
> This is not even needed!
> You only have to type C-x C-f, that's all. By default it is in the
> default-directory, which is a buffer local variable, so if your
> current buffer is in the right directory, you've got nothing more to
> do.
>
> So the answer, and you won't say you've not been warned, is not to
> kill your old buffers! Just leave them alone in emacs. Thus, with
> your old buffer in the right directory, you just type C-x C-f and the
> other file name.
>
> If you really need to kill your buffer before opening another file,
> you could open a directory buffer:
> C-x C-f \\server\dir\long_sub_dir\subdir\ RET
>
> Note that in this directory buffer you may just click (or type RET) on
> a file to open it.
>
> Also, you could use some more sophisticated package such as speedbar,
> but it would be overkill...
All of what Pascal says is true and pertinent.
FYI, you can also just use Emacs (yes, Emacs) command `cd' to change the
`default-directory' at any time. No need to open a Dired buffer.
- build a macro that opens a directory and prompts for file name, Norm, 2009/01/24
- Re: build a macro that opens a directory and prompts for file name, Chris McMahan, 2009/01/23
- Re: build a macro that opens a directory and prompts for file name, Norm, 2009/01/24
- RE: build a macro that opens a directory and prompts for file name, Drew Adams, 2009/01/24
- Message not available
- Re: build a macro that opens a directory and prompts for file name, Pascal J. Bourguignon, 2009/01/26
- RE: build a macro that opens a directory and prompts for file name,
Drew Adams <=
- Message not available
- Re: build a macro that opens a directory and prompts for file name, Stefan Kamphausen, 2009/01/27
- Re: build a macro that opens a directory and prompts for file name, roodwriter, 2009/01/27
- Re: build a macro that opens a directory and prompts for file name, Kevin Rodgers, 2009/01/28
Re: build a macro that opens a directory and prompts for file name, Sebastian Tennant, 2009/01/29