From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Francis Moreau" Newsgroups: gmane.emacs.help Subject: Re: How to not change the working directory when opening a file Date: Wed, 16 Jan 2008 07:35:44 +0100 Message-ID: <38b2ab8a0801152235s68fd170cxfe77cb8ac861439b@mail.gmail.com> References: <38b2ab8a0801141313i3489dab8h3c1535bebb0de53c@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1200465370 29702 80.91.229.12 (16 Jan 2008 06:36:10 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 16 Jan 2008 06:36:10 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: "Kevin Rodgers" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 16 07:36:33 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JF1t3-0001cR-5f for geh-help-gnu-emacs@m.gmane.org; Wed, 16 Jan 2008 07:36:33 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JF1se-0002vm-JF for geh-help-gnu-emacs@m.gmane.org; Wed, 16 Jan 2008 01:36:08 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JF1sN-0002uh-NA for help-gnu-emacs@gnu.org; Wed, 16 Jan 2008 01:35:51 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JF1sK-0002oN-1g for help-gnu-emacs@gnu.org; Wed, 16 Jan 2008 01:35:51 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JF1sJ-0002o3-T8 for help-gnu-emacs@gnu.org; Wed, 16 Jan 2008 01:35:47 -0500 Original-Received: from rv-out-0910.google.com ([209.85.198.191]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1JF1sJ-0006Qs-Dw for help-gnu-emacs@gnu.org; Wed, 16 Jan 2008 01:35:47 -0500 Original-Received: by rv-out-0910.google.com with SMTP id c27so190241rvf.6 for ; Tue, 15 Jan 2008 22:35:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=Cegw8h+RmTI3q+RyOGLve4Hrla2BZgMluqS53MeQy5o=; b=umJ2R00gOcFqVpskCaLCmaAaZgJ/NHuPpMQ+2RRpb6SEiyzhxVoJVa+TjavXw4sQuxTDbc+jqdPlBlKG/LPW4bVHcvNgYBSZdAcAcdNW2Ppk10SlfzK4sdHqkvOkE8TDurNdGX4bK3rO17rK70stmcb0R1TTZ2yBeJLQSYzlS6Q= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=aee0kc4b7aZA4fwUbLO9fo0FORgypR6BMOJ+wpbk9PVQpmDWRSHav/HuJ4KlHkzz8pbh+9uL7mqpprMJ94ssRsHixciepdlSrXhgL2vTGOU5Pi9E4FkRxf+Gee0fD86s+y/6q+qQLdEYqszVlLN3BfcVxcsMx5YOCxKy7nPnfwU= Original-Received: by 10.141.145.11 with SMTP id x11mr292999rvn.264.1200465344750; Tue, 15 Jan 2008 22:35:44 -0800 (PST) Original-Received: by 10.140.193.5 with HTTP; Tue, 15 Jan 2008 22:35:44 -0800 (PST) In-Reply-To: Content-Disposition: inline X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:50745 Archived-At: On Jan 16, 2008 3:56 AM, Kevin Rodgers 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