emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <carsten.dominik@gmail.com>
To: SebastianRose <sebastian_rose@gmx.de>
Cc: Emacs-orgmode mailing list <emacs-orgmode@gnu.org>
Subject: Re: Patch: org-reload changes default-directory
Date: Wed, 11 Nov 2009 10:48:51 +0100	[thread overview]
Message-ID: <8A6B1BD9-9699-45F6-B640-8C94020F9239@gmail.com> (raw)
In-Reply-To: <87hbt2kn78.fsf@gmx.de>

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

  parent reply	other threads:[~2009-11-11  9:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-11-10 22:51 Patch: org-reload changes default-directory SebastianRose
2009-11-10 23:12 ` Sebastian Rose
2009-11-11  9:48 ` Carsten Dominik [this message]
2009-11-11  9:59   ` Sebastian Rose

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=8A6B1BD9-9699-45F6-B640-8C94020F9239@gmail.com \
    --to=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=sebastian_rose@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).