emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Orgmode] Proper way to "link" external files into a project?


From: Andreas Rottmann
Subject: [Orgmode] Proper way to "link" external files into a project?
Date: Tue, 14 Jul 2009 15:52:53 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.96 (gnu/linux)

Hi!

I'd like to include several files into an org-mode project that live
outside the project tree. I tried to just symlink them into the
appropriate place into my project, and thought that might suffice to get
them published correctly, but that doesn't work out, as org-mode doesn't
consider the symlink's name, but the "true" filename; for example, I
have this:

(setq org-publish-project-alist
      '(("homepage"
         :base-directory "~/homepage"
         :base-extension "org"
         :publishing-directory "~/public_html"
         ...)
        ...))

% ls -l ~/homepage/software/SPE.org
lrwxrwxrwx 1 rotty rotty 26 Jul 14 15:01 /home/rotty/homepage/software/SPE.org 
-> /home/rotty/src/spe/README

org-mode publishes this as ~/public_html/README.html, while I'd like it
to use ~/public_html/software/SPE.html.

After playing around with EDebug for a while, I've come up with the
following horrible hack, which does what I want, but is nowhere near a
general solution:

diff --git a/lisp/org-publish.el b/lisp/org-publish.el
index 38e1c7b..2c42685 100644
--- a/lisp/org-publish.el
+++ b/lisp/org-publish.el
@@ -414,6 +414,9 @@ PUB-DIR is the publishing directory."
             (init-buf (current-buffer))
             (init-point (point))
             (init-buf-string (buffer-string))
+             ;; dirty hack to allow symlinking; this is likely to
+             ;; break stuff --rotty
+             (buffer-file-name filename)
             export-buf-or-file)
        ;; run hooks before exporting
        (run-hooks 'org-publish-before-export-hook)
@@ -501,8 +504,8 @@ See `org-publish-org-to' to the list of arguments."
     (setq tmp-pub-dir
          (file-name-directory
           (concat pub-dir
-                  (and (string-match (regexp-quote base-dir) ftname)
-                       (substring ftname (match-end 0))))))
+                  (and (string-match (regexp-quote base-dir) filename)
+                       (substring filename (match-end 0))))))
     (if (listp publishing-function)
        ;; allow chain of publishing functions
        (mapc (lambda (f)
Is there a "proper" way to do this?

Regards, Rotty
-- 
Andreas Rottmann -- <http://rotty.yi.org/>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]