emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Sebastian Rose <sebastian_rose@gmx.de>
To: emacs-orgmode@gnu.org
Subject: [Patch] Re: Bug? Inconsistency with org-publish-attachment
Date: Thu, 16 Sep 2010 14:23:37 +0200	[thread overview]
Message-ID: <87d3sdswqe.fsf_-_@gmx.de> (raw)
In-Reply-To: <20100916031504.GA5117@dimension8.tehua.net> (Aidan Gauland's message of "Thu, 16 Sep 2010 15:15:04 +1200")

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

Aidan Gauland <aidalgol@no8wireless.co.nz> writes:
> On Thu, Sep 16, 2010 at 12:40:34AM +0200, Sebastian Rose wrote:
>> Aidan Gauland <aidalgol@no8wireless.co.nz> writes:
>> > Sebastian Rose <sebastian_rose <at> 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




[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: org-publish-correct-target-directory.patch --]
[-- Type: text/x-diff, Size: 1028 bytes --]

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

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

  reply	other threads:[~2010-09-16 12:23 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-15  2:15 Bug? Inconsistency with org-publish-attachment Aidan Gauland
2010-09-15 16:04 ` Sebastian Rose
2010-09-15 19:26   ` Emacs version Sébastien Vauban
2010-09-15 20:11     ` Henri-Paul Indiogine
2010-09-15 20:57       ` A. Ryan Reynolds
2010-09-16 19:27         ` Gregor Zattler
2010-09-15 22:31     ` Sebastian Rose
2010-09-16  3:16       ` suvayu ali
2010-09-16  8:11         ` Scot Becker
2010-09-15 20:23   ` Bug? Inconsistency with org-publish-attachment Aidan Gauland
2010-09-15 22:40     ` Sebastian Rose
2010-09-16  3:15       ` Aidan Gauland
2010-09-16 12:23         ` Sebastian Rose [this message]
2010-09-16 20:33           ` [Patch] " Aidan Gauland
2010-09-16 22:44             ` Sebastian Rose
2010-09-17  1:09               ` Aidan Gauland
2010-09-17  9:16                 ` Sebastian Rose
2010-09-17 20:21                   ` [Patch] Bug: " Aidan Gauland
2010-09-17 22:18                     ` Sebastian Rose
2010-09-17 23:12                       ` Aidan Gauland
2010-09-17 23:18                         ` Sebastian Rose
2010-09-16 22:45             ` Re: [Patch] Re: Bug? " Sebastian Rose

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=87d3sdswqe.fsf_-_@gmx.de \
    --to=sebastian_rose@gmx.de \
    --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).