emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Proper way to "link" external files into a project?
@ 2009-07-14 13:52 Andreas Rottmann
  2009-07-14 23:58 ` Sebastian Rose
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Rottmann @ 2009-07-14 13:52 UTC (permalink / raw)
  To: org-mode mailing list

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-08-03  4:33 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-14 13:52 Proper way to "link" external files into a project? Andreas Rottmann
2009-07-14 23:58 ` Sebastian Rose
2009-07-15 20:35   ` Andreas Rottmann
2009-08-03  4:33     ` Carsten Dominik

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