From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Patch: org-reload changes default-directory Date: Wed, 11 Nov 2009 10:48:51 +0100 Message-ID: <8A6B1BD9-9699-45F6-B640-8C94020F9239@gmail.com> References: <87hbt2kn78.fsf@gmx.de> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N89pF-0007tP-Tn for emacs-orgmode@gnu.org; Wed, 11 Nov 2009 04:49:17 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N89pA-0007ot-G1 for emacs-orgmode@gnu.org; Wed, 11 Nov 2009 04:49:16 -0500 Received: from [199.232.76.173] (port=53129 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N89pA-0007on-C9 for emacs-orgmode@gnu.org; Wed, 11 Nov 2009 04:49:12 -0500 Received: from paard.ic.uva.nl ([145.18.40.182]:50397) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1N89p9-0006HQ-R1 for emacs-orgmode@gnu.org; Wed, 11 Nov 2009 04:49:12 -0500 In-Reply-To: <87hbt2kn78.fsf@gmx.de> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: SebastianRose Cc: Emacs-orgmode mailing list Hi Sebastian, excellent catch, thank you very much! This was one difficult to trace bug. I have applied you patch and modified it a bit further, by wrapping it in unwind-protect. So even if the version computation throws an error, the working directory will be restored. - Carsten P.S. In fact, Bernt did try to restore the working directory in his original org-version function, but that code was not always executed due to badly placed parenthesis. On Nov 10, 2009, at 11:51 PM, SebastianRose wrote: > Hi, > > > I found out why I ran into this earlier. It's _not_ org-reload, it's > org-version that changes the default directory. Patch attached. > > > I don't know where my bug report is... so I cannot respond to that > post. > > > > > Best wishes, > > Sebastian > > diff --git a/lisp/org.el b/lisp/org.el > index 42e229e..0b1005f 100644 > --- a/lisp/org.el > +++ b/lisp/org.el > @@ -102,7 +102,8 @@ > "Show the org-mode version in the echo area. > With prefix arg HERE, insert it at point." > (interactive "P") > - (let* ((version org-version) > + (let* ((origin default-directory) > + (version org-version) > (git-version) > (dir (concat (file-name-directory (locate-library "org")) "../" ))) > (if (and (file-exists-p (expand-file-name ".git" dir)) > @@ -122,6 +123,7 @@ With prefix arg HERE, insert it at point." > (cd pwd)))) > (setq version (format "Org-mode version %s" version)) > (if here (insert version)) > + (cd origin) > (message version) > version)) > - Carsten