emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Patch: org-reload changes default-directory
@ 2009-11-10 22:51 SebastianRose
  2009-11-10 23:12 ` Sebastian Rose
  2009-11-11  9:48 ` Carsten Dominik
  0 siblings, 2 replies; 4+ messages in thread
From: SebastianRose @ 2009-11-10 22:51 UTC (permalink / raw)
  To: Emacs-orgmode mailing list; +Cc: carsten.dominik

[-- Attachment #1: Type: text/plain, Size: 245 bytes --]

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


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Patch org-version --]
[-- Type: text/x-diff, Size: 709 bytes --]

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))
 

[-- Attachment #3: Type: text/plain, Size: 204 bytes --]

_______________________________________________
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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: Patch: org-reload changes default-directory
  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
  1 sibling, 0 replies; 4+ messages in thread
From: Sebastian Rose @ 2009-11-10 23:12 UTC (permalink / raw)
  To: Emacs-orgmode mailing list; +Cc: carsten.dominik


SebastianRose <sebastian_rose@gmx.de> writes:
> 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.


As I cannot find the bug report on the gmane, I thought I'd better
re-write the reason for this patch, so you can reproduce the problem.


Steps to reproduce the bug the patch fixes here:


   1. Open an *.org file you can export to PDF. Ensure the file is not
      located where your Org-mode sources are (org-*.el files). Choose a
      file, that includes some images or a SETUPFILE using relative
      paths.
   2. M-x default-directory RET
      to see the value of that variable in the current buffer.
   3. C-c C-e p
      to export to PDF and verify it works.
   4. C-c C-x !
      to `org-reload'
   5. Now repeat steps 2 and 3. Note, that the export fails.



Best wishes

  Sebastian

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Patch: org-reload changes default-directory
  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
  2009-11-11  9:59   ` Sebastian Rose
  1 sibling, 1 reply; 4+ messages in thread
From: Carsten Dominik @ 2009-11-11  9:48 UTC (permalink / raw)
  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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Patch: org-reload changes default-directory
  2009-11-11  9:48 ` Carsten Dominik
@ 2009-11-11  9:59   ` Sebastian Rose
  0 siblings, 0 replies; 4+ messages in thread
From: Sebastian Rose @ 2009-11-11  9:59 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Emacs-orgmode mailing list

Carsten Dominik <carsten.dominik@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

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-11-11  9:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
2009-11-11  9:59   ` Sebastian Rose

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).