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: Tue, 15 Jan 2008 10:27:14 +0100 Message-ID: <38b2ab8a0801150127x27021810s542c6a921c495a7f@mail.gmail.com> References: <38b2ab8a0801140715h6a920332t3598c7c10b1f4d2e@mail.gmail.com> <87hchguhe0.fsf@offby1.atm01.sea.blarg.net> <478BFC8C.3020800@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 1200407241 1748 80.91.229.12 (15 Jan 2008 14:27:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 15 Jan 2008 14:27:21 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: "Lennart Borgman (gmail)" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Jan 15 15:27:43 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 1JEmlP-0007Co-Oi for geh-help-gnu-emacs@m.gmane.org; Tue, 15 Jan 2008 15:27:40 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JEml1-00073R-8Y for geh-help-gnu-emacs@m.gmane.org; Tue, 15 Jan 2008 09:27:15 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1JEi57-0005iO-FK for help-gnu-emacs@gnu.org; Tue, 15 Jan 2008 04:27:41 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1JEi52-0005f4-FR for help-gnu-emacs@gnu.org; Tue, 15 Jan 2008 04:27:40 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JEi51-0005ee-Cf for help-gnu-emacs@gnu.org; Tue, 15 Jan 2008 04:27:36 -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 1JEi4w-0004wh-II for help-gnu-emacs@gnu.org; Tue, 15 Jan 2008 04:27:35 -0500 Original-Received: by rv-out-0910.google.com with SMTP id c27so3112165rvf.6 for ; Tue, 15 Jan 2008 01:27:14 -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=4IX+O/9nY8YLaZJ2XSdEYQba8mRCA0YP2LUasaQ29hk=; b=an/MNrHNwXQJ5317ZWfVpe4ECoKyVhvBTwMhpTyoTn25Iu2BcEbqeBBWq9lrDCf239jeek0UOqxdTRWSF/frhPu5THSzIJ19HTac8NwMP2i9RA3g6y8Rw0Dm4CxUadt21H7IzpUqrPzIwIHsfrSSE+Df/9lCNMkX1U/2AH4mGIw= 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=RFgikKaG91I1fuFgI3jInjUYp7Ld7ZIfhzGsImgk3onvrnamf6hEYXzrNIAxU7PXqOTAFvmRMCLfxzNE5WoOjNdoKprvABRxTvEn6QoBN3bTjKWikeexeUfDTILzy5cVRg9YOSCbT6ZhdUIeLQbfj8SqjUytiCBXeUNK5AfLm00= Original-Received: by 10.140.134.15 with SMTP id h15mr2137397rvd.48.1200389234827; Tue, 15 Jan 2008 01:27:14 -0800 (PST) Original-Received: by 10.141.171.17 with HTTP; Tue, 15 Jan 2008 01:27:14 -0800 (PST) In-Reply-To: <478BFC8C.3020800@gmail.com> Content-Disposition: inline X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-Mailman-Approved-At: Tue, 15 Jan 2008 09:25:09 -0500 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:50728 Archived-At: Hello, On Jan 15, 2008 1:21 AM, Lennart Borgman (gmail) wrote: > >>>>>> "Francis" == Francis Moreau 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