[Orgmode] Re: Patch: org-reload changes default-directory

2009-11-11 Thread Carsten Dominik

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





___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode


[Orgmode] Re: Patch: org-reload changes default-directory

2009-11-11 Thread Sebastian Rose
Carsten Dominik carsten.domi...@gmail.com writes:
 Hi Sebastian,

 excellent catch, thank you very much!  This was one difficult
 to trace bug.

It wasn't difficult, once I noticed _when_ it showed up. I noticed that
something was wrong since several weeks. But I never new what exactly
the action was that triggered the misbehavior.

This was one of the things that make people think their computers have
some subtle kind of personality :-D


  Sebastian


___
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode