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

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

Re: how to not change the working directory when opening a file


From: Francis Moreau
Subject: Re: how to not change the working directory when opening a file
Date: Tue, 15 Jan 2008 10:27:14 +0100

Hello,

On Jan 15, 2008 1:21 AM, Lennart Borgman (gmail)
<lennart.borgman@gmail.com> wrote:
> >>>>>> "Francis" == Francis Moreau <francis.moro@gmail.com> writes:
> >
> >     Francis> Hello list, I'd like Emacs to not changing the working
> >     Francis> directory when opening a file.
> >
> >     Francis> For example when doing:
> >
> >     Francis> $ pwd /home/fmoreau/tmp $ emacs /tmp/foo.txt
> >
> >     Francis> I'd like the current working directory to be
> >     Francis> "/home/fmoreau/tmp" when editing "/tmp/foo.txt" in emacs.
> >
> >     Francis> This is useful when composing an email.  I sometime need
> >     Francis> to include the output of a shell command but this shell
> >     Francis> command must be executed in the directory where emacs was
> >     Francis> launched.
> >
> >     Francis> Does anybody can give me a hint to do that ?
>
> Can't you use the variable default-directory? Ie do
>
>    M-: (setq default-directory "/my-full-dir-path/")
>
> when you are in that files buffer.
>

Yes something like this may work.

But I need to set 'default-directory' to the directory where emacs was
launched. I don't want to set a fixed path.

Actually I'm using mutt as MUA and use emacs as editor inside mutt.
When I compose an email mutt basically does the following to start
emacs:

emacs -nw /tmp/mutt-file -f post-mode

So I'm using "post" mode to compose my email. I could create a post
mode hook to change  'default-directory' value but i don't know how to
specify "the directory where emacs was launched".

I could change mutt's email file path to the current directory but I
would prefer not to and let its temporary directory in /tmp which is
the default configuration.

Thanks
-- 
Francis




reply via email to

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