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: Sebastian Tennant
Subject: Re: how to not change the working directory when opening a file
Date: Tue, 15 Jan 2008 18:25:53 +0200
User-agent: Gnus/5.110007 (No Gnus v0.7) Emacs/22.1 (gnu/linux)

Quoth "Francis Moreau" <francis.moro@gmail.com>:
> (add-hook 'post-mode-hook '(lambda () (setq default-directory 
> emacs-startup-directory)))

If it works go with it.  It's also a more focussed solution than:

  (cd (getenv "PWD"))

in that it only applies to post-mode, although my 'getenv' solution is
perhaps more flexible in that Emacs' default directory at startup will
always be the directory you launched Emacs from, rather than the value
of emacs-startup-directory.

Just for your information, you shouldn't really quote lambda functions,
i.e., you should remove the single quote before (lambda ...).

Quoting lambda functions happens to work in Emacs Lisp but won't work in
other Lisp dialects, so it's not a good habit to get into.

Sebastian





reply via email to

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