emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Improve symlink handling in `org-babel-load-file'
@ 2010-02-04 11:29 Martin Kühl
  2010-02-04 16:46 ` Eric Schulte
  0 siblings, 1 reply; 2+ messages in thread
From: Martin Kühl @ 2010-02-04 11:29 UTC (permalink / raw)
  To: Emacs-Orgmode

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

Hi,

when `org-babel-load-file' is called on a symlink, its timestamp code
checks the modification date of the symlink instead of the file it
points to, leading it to skip tangling the source file although its
contents have been modified.

The attached patch fixes this by resolving paths with `file-truename'
before calling `file-attributes'.

Thanks,
Martin

[-- Attachment #2: org-babel-load-file--symlinks.patch --]
[-- Type: application/octet-stream, Size: 720 bytes --]

diff --git a/contrib/babel/lisp/org-babel-tangle.el b/contrib/babel/lisp/org-babel-tangle.el
index 66e2c26..4edab9c 100644
--- a/contrib/babel/lisp/org-babel-tangle.el
+++ b/contrib/babel/lisp/org-babel-tangle.el
@@ -48,7 +48,8 @@ file using `load-file'."
   (flet ((age (file)
               (time-to-seconds
                (time-subtract (current-time)
-                              (sixth (file-attributes file))))))
+                              (sixth (file-attributes
+                                      (file-truename file)))))))
     (let* ((base-name (file-name-sans-extension file))
            (exported-file (concat base-name ".el")))
       ;; tangle if the org-mode file is newer than the elisp file

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

_______________________________________________
Emacs-orgmode mailing list
Please 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] 2+ messages in thread

* Re: [PATCH] Improve symlink handling in `org-babel-load-file'
  2010-02-04 11:29 [PATCH] Improve symlink handling in `org-babel-load-file' Martin Kühl
@ 2010-02-04 16:46 ` Eric Schulte
  0 siblings, 0 replies; 2+ messages in thread
From: Eric Schulte @ 2010-02-04 16:46 UTC (permalink / raw)
  To: Martin Kühl; +Cc: Emacs-Orgmode

Applied, Thanks! -- Eric

Martin Kühl <martin.kuehl@gmail.com> writes:

> Hi,
>
> when `org-babel-load-file' is called on a symlink, its timestamp code
> checks the modification date of the symlink instead of the file it
> points to, leading it to skip tangling the source file although its
> contents have been modified.
>
> The attached patch fixes this by resolving paths with `file-truename'
> before calling `file-attributes'.
>
> Thanks,
> Martin
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

end of thread, other threads:[~2010-02-04 16:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-04 11:29 [PATCH] Improve symlink handling in `org-babel-load-file' Martin Kühl
2010-02-04 16:46 ` Eric Schulte

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