emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [PATCH] Fix for relative symlinks in subdirectories
@ 2012-09-02 18:44 T.F. Torrey
  2012-09-28 15:24 ` Bastien
  0 siblings, 1 reply; 2+ messages in thread
From: T.F. Torrey @ 2012-09-02 18:44 UTC (permalink / raw)
  To: emacs-orgmode

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

Hello all,

When publishing a project that contains relative symlinks in
subdirectories, org-publish-cache-ctime-of-src mistakenly connects the
true file name with the base-dir of the project instead of the symlink,
causing an error when the linked file is in a subdirectory and not the
base-dir.

The attached patch modifiies org-publish-cache-ctime-of-src to use the
dir of the current file as the base-dir instead of simply the project
base-dir.

With this change, though, the base-dir argument to this function now
never does anything. This doesn't seem to cause problems for me, but I
am far from intimate with the workings of the org-publish cache system.
Perhaps someone with better knowledge of the system could provide a
better fix. Otherwise, the base-dir argument could be refactored out.

ChangeLog entry: Fix for relative symlinks in subdirectories

Modify org-publish-cache-ctime-of-src to use the dir of the current file
as the base-dir instead of simply the project base-dir.

TINYCHANGE

Emacs : GNU Emacs 24.2.50.1 (i686-pc-linux-gnu, GTK+ Version 3.4.2) of
 2012-08-29 on nannyberry, modified by Debian Package: Org-mode version
 7.9 (release_7.9-190-g845daf.dirty-git @ mixed installation!
 /usr/local/share/emacs/site-lisp/ and
 /home/tftorrey/.emacs.d/src/org-mode/lisp/)

Best regards,
Terry
--
T.F. Torrey


[-- Attachment #2: Patch for org-publish.el --]
[-- Type: text/plain, Size: 539 bytes --]

diff --git a/lisp/org-publish.el b/lisp/org-publish.el
index e78e2d4..cd77c82 100644
--- a/lisp/org-publish.el
+++ b/lisp/org-publish.el
@@ -1191,7 +1191,7 @@ Returns value on success, else nil."
 (defun org-publish-cache-ctime-of-src (f base-dir)
   "Get the FILENAME ctime as an integer."
   (let ((attr (file-attributes
-	       (expand-file-name (or (file-symlink-p f) f) base-dir))))
+	       (expand-file-name (or (file-symlink-p f) f) (file-name-directory f)))))
     (+ (lsh (car (nth 5 attr)) 16)
        (cadr (nth 5 attr)))))
 

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

* Re: [PATCH] Fix for relative symlinks in subdirectories
  2012-09-02 18:44 [PATCH] Fix for relative symlinks in subdirectories T.F. Torrey
@ 2012-09-28 15:24 ` Bastien
  0 siblings, 0 replies; 2+ messages in thread
From: Bastien @ 2012-09-28 15:24 UTC (permalink / raw)
  To: T.F. Torrey; +Cc: emacs-orgmode

Hi,

tftorrey@tftorrey.com (T.F. Torrey) writes:

> The attached patch modifiies org-publish-cache-ctime-of-src to use the
> dir of the current file as the base-dir instead of simply the project
> base-dir.

I applied a modified version of your patch, removing useless base-dir
argument.  Thanks for reporting this!  If you can, please test the
current maint or master branch to confirm the fix.

Best,

-- 
 Bastien

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

end of thread, other threads:[~2012-09-28 15:25 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-09-02 18:44 [PATCH] Fix for relative symlinks in subdirectories T.F. Torrey
2012-09-28 15:24 ` Bastien

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