emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Andreas Rottmann <a.rottmann@gmx.at>
To: org-mode mailing list <emacs-orgmode@gnu.org>
Subject: Proper way to "link" external files into a project?
Date: Tue, 14 Jul 2009 15:52:53 +0200	[thread overview]
Message-ID: <87r5wj4bii.fsf@delenn.lan> (raw)

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

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:


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: Try to give symlinks \"proper\" treatment --]
[-- Type: text/x-diff, Size: 989 bytes --]

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)

[-- Attachment #3: Type: text/plain, Size: 100 bytes --]


Is there a "proper" way to do this?

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

[-- Attachment #4: Type: text/plain, Size: 204 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Remember: use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

             reply	other threads:[~2009-07-14 13:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-14 13:52 Andreas Rottmann [this message]
2009-07-14 23:58 ` Proper way to "link" external files into a project? Sebastian Rose
2009-07-15 20:35   ` Andreas Rottmann
2009-08-03  4:33     ` Carsten Dominik

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=87r5wj4bii.fsf@delenn.lan \
    --to=a.rottmann@gmx.at \
    --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).