emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: tftorrey@tftorrey.com (T.F. Torrey)
To: emacs-orgmode@gnu.org
Subject: [PATCH] Fix for relative symlinks in subdirectories
Date: Sun, 02 Sep 2012 11:44:43 -0700	[thread overview]
Message-ID: <87mx18fen8.fsf@lapcat.tftorrey.com> (raw)

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

             reply	other threads:[~2012-09-02 19:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-02 18:44 T.F. Torrey [this message]
2012-09-28 15:24 ` [PATCH] Fix for relative symlinks in subdirectories Bastien

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=87mx18fen8.fsf@lapcat.tftorrey.com \
    --to=tftorrey@tftorrey.com \
    --cc=emacs-orgmode@gnu.org \
    /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).