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: Wed, 16 Jan 2008 07:35:44 +0100

On Jan 16, 2008 3:56 AM, Kevin Rodgers <address@hidden> wrote:
>
> Francis Moreau wrote:
> > Hello list,
> >
> > I'd like Emacs to not changing the working directory when opening
> > a file.
> >
> > For example when doing:
> >
> > $ pwd
> > /home/fmoreau/tmp
> > $ emacs /tmp/foo.txt
> >
> > I'd like the current working directory to be "/home/fmoreau/tmp"
> > when editing "/tmp/foo.txt" in emacs.
> >
> > This is useful when composing an email. I sometime need to
> > include the output of a shell command but this shell command
> > must be executed in the directory where emacs was launched.
> >
> > Does anybody can give me a hint to do that ?
>
> (add-hook 'find-file-hook
>           (lambda ()
>             (setq default-directory
>                   (buffer-local-value 'default-directory
>                                       (get-buffer "*scratch*")))))

Looks even better to me !

Thanks
-- 
Francis




reply via email to

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