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

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

RE: Working with different projects in Emacs


From: Drew Adams
Subject: RE: Working with different projects in Emacs
Date: Wed, 8 Apr 2009 11:44:08 -0700

 

> > If all of the files for a given project are in or under the 
> > same directory, then moving (e.g. `cd') to that directory
> > should let you complete file names there.
> > IOW, `M-x cd', which sets `default-directory', which is the 
> > directory, by default, for file-name completion.
> >
> > And you can easily write a command that takes you directly 
> > to your project directory, so you don't have to enter it each time.
>
> The problem I have with this solution, is that if I open a file in
> some other directory, the working directory is changed again :(

Only for the buffer of that file. The `default-directory' for the other buffers
(including, e.g. a Dired buffer) would stay the same.

I don't quite see the problem - perhaps you could describe a usage scenario in a
little more detail.

> > If the files of a project are in multiple directories, then 
> > you can use Dired, passing it the file list explicitly.
> > Then mark specific files in that Dired buffer and then act
> > on the marked files.
>
> And here it seems like one has to perform a lot of steps just to get
> the autocompletion of the files for a project. But probably I'm not
> getting it right

A Dired buffer can have files from multiple directories, and those file names
can be absolute. Example:

M-: (dired '("my project" "/path/to/file1.c" "/other/path/to/file2.c"))

You can then access those files directly in Dired, and you can mark them and
operate on the marked files.

You can also include subdirectories in a Dired listing (using `i').

But yes, the `default-directory' for the Dired buffer won't be appropriate for
completing all of the file names, if the files are from different directories.
No single `default-directory' is adequate to that task. ;-)

But once you're visiting file A, you can complete to other files in the same
directory as A - visiting A changes `default-directory' appropriately.

If you are already aware of these things, and they don't provide what you need,
then try describing the need in a little more detail.





reply via email to

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