From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastian Rose Subject: [Patch] Re: Bug? Inconsistency with org-publish-attachment Date: Thu, 16 Sep 2010 14:23:37 +0200 Message-ID: <87d3sdswqe.fsf_-_@gmx.de> References: <20100915021535.GA19762@dimension8.tehua.net> <87tylrgfin.fsf@gmx.de> <87eicuhbq5.fsf@gmx.de> <20100916031504.GA5117@dimension8.tehua.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from [140.186.70.92] (port=42336 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OwDVD-0005Ji-Cy for emacs-orgmode@gnu.org; Thu, 16 Sep 2010 08:23:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OwDVB-0006PN-R9 for emacs-orgmode@gnu.org; Thu, 16 Sep 2010 08:23:47 -0400 Received: from mailout-de.gmx.net ([213.165.64.22]:48729 helo=mail.gmx.net) by eggs.gnu.org with smtp (Exim 4.69) (envelope-from ) id 1OwDVB-0006PJ-ED for emacs-orgmode@gnu.org; Thu, 16 Sep 2010 08:23:45 -0400 In-Reply-To: <20100916031504.GA5117@dimension8.tehua.net> (Aidan Gauland's message of "Thu, 16 Sep 2010 15:15:04 +1200") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Aidan Gauland writes: > On Thu, Sep 16, 2010 at 12:40:34AM +0200, Sebastian Rose wrote: >> Aidan Gauland writes: >> > Sebastian Rose gmx.de> writes: >> >> It would be a bug. >> >> >> >> But I cannot reproduce it (current Org mode from git, emacs24). >> > >> > I just figured out why: I store all my images in ~/images/ and just >> > have symbolic links to them in my Org website directory. >> > >> > Can you reproduce it now that you have this piece of information? >> >> >> Ah, OK. That might be because of some call to >> >> (file-truename file...) >> >> or similar. `file-truename' removes symbolic links in filenames. >> >> Functions like this are called to make sure, the file is published only >> if needed (i.e. the file has changed since last export). >> >> I'm not sure currently if it's clever to remove such calls (see >> lisp/org-publish.el and search `file-truename'). > > What if `file-truename' was used only to get the path of the actual > file to copy, but the (relative) path of the link is used as the > destination? > > --Aidan Hi Aidan, `org-publish-attachment' is wrong or called with wrong arguments. This patch fixes it. As always, there might be a better way to fix it, but this way the function `org-publish-attachment' will work regardless of parameters. Someone will always call this function with the wrong `PUB-DIR' parameter... Aidan, would like to apply the patch and verify it works for you? Best wishes, Sebastian --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=org-publish-correct-target-directory.patch diff --git a/lisp/org-publish.el b/lisp/org-publish.el index de52410..f32aa94 100644 --- a/lisp/org-publish.el +++ b/lisp/org-publish.el @@ -578,13 +578,18 @@ See `org-publish-org-to' to the list of arguments." "Publish a file with no transformation of any kind. See `org-publish-org-to' to the list of arguments." ;; make sure eshell/cp code is loaded +(let* ((rel-dir + (file-relative-name + (file-name-directory filename) + (plist-get plist :base-directory))) + (pub-dir + (expand-file-name + (concat (file-name-as-directory pub-dir) rel-dir)))) (unless (file-directory-p pub-dir) (make-directory pub-dir t)) (or (equal (expand-file-name (file-name-directory filename)) (file-name-as-directory (expand-file-name pub-dir))) - (copy-file filename - (expand-file-name (file-name-nondirectory filename) pub-dir) - t))) + (copy-file filename pub-dir t)))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;; Publishing files, sets of files, and indices --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --=-=-=--