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

* Re: Proper way to "link" external files into a project?
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Sebastian Rose @ 2009-07-14 23:58 UTC (permalink / raw)
  To: Andreas Rottmann; +Cc: org-mode mailing list

Andreas Rottmann <a.rottmann@gmx.at> writes:
> 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:


First of all: How about hardlinks?


Second:

  See
  http://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.php#sec-7.1 
  
  That shows how you can share files between projects, simply by pulling
  them in through a special export  project.
  I use this technique a lot. One advantage is that each project has a
  complete set of files.
  The drawbacks are minor for my use-case, but that might vary. But as
  linking was enough, this approach should be fine.




   Sebastian

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

* Re: Proper way to "link" external files into a project?
  2009-07-14 23:58 ` Sebastian Rose
@ 2009-07-15 20:35   ` Andreas Rottmann
  2009-08-03  4:33     ` Carsten Dominik
  0 siblings, 1 reply; 4+ messages in thread
From: Andreas Rottmann @ 2009-07-15 20:35 UTC (permalink / raw)
  To: Sebastian Rose; +Cc: org-mode mailing list

Sebastian Rose <sebastian_rose@gmx.de> writes:

> Andreas Rottmann <a.rottmann@gmx.at> writes:
>> 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:
>
>
> First of all: How about hardlinks?
>
I'd rather not use them in this case.

>
> Second:
>
>   See
>   http://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.php#sec-7.1 
>   
>   That shows how you can share files between projects, simply by pulling
>   them in through a special export  project.
>   I use this technique a lot. One advantage is that each project has a
>   complete set of files.
>   The drawbacks are minor for my use-case, but that might vary. But as
>   linking was enough, this approach should be fine.
>
Thanks! I'm now using this approach, and it works well. The only
drawback for me is that I have to "pollute" the included projects' org
files with a line like this:

#+SETUPFILE: ~/.emacs.d/org-templates/level-2.org

Ideally, I'd like to have that information inferred, or at least
external to the included projects, as they should not have to "know" at
which location they are used. You don't know about a trick how to get
around this? I'd also be willing to write some elisp to that end...

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

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

* Re: Proper way to "link" external files into a project?
  2009-07-15 20:35   ` Andreas Rottmann
@ 2009-08-03  4:33     ` Carsten Dominik
  0 siblings, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2009-08-03  4:33 UTC (permalink / raw)
  To: Andreas Rottmann; +Cc: org-mode mailing list


On Jul 15, 2009, at 10:35 PM, Andreas Rottmann wrote:

> Sebastian Rose <sebastian_rose@gmx.de> writes:
>
>> Andreas Rottmann <a.rottmann@gmx.at> writes:
>>> 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:
>>
>>
>> First of all: How about hardlinks?
>>
> I'd rather not use them in this case.
>
>>
>> Second:
>>
>>  See
>>  http://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.php#sec-7.1
>>
>>  That shows how you can share files between projects, simply by  
>> pulling
>>  them in through a special export  project.
>>  I use this technique a lot. One advantage is that each project has a
>>  complete set of files.
>>  The drawbacks are minor for my use-case, but that might vary. But as
>>  linking was enough, this approach should be fine.
>>
> Thanks! I'm now using this approach, and it works well. The only
> drawback for me is that I have to "pollute" the included projects' org
> files with a line like this:
>
> #+SETUPFILE: ~/.emacs.d/org-templates/level-2.org

IIUC, you don't need to do this.  Since you are only linking to
these files, you can simply define a project component that will
make sure these files will be copied into the correct location.
Then use links with relative path, and this should do the trick.
The level-dependent setupfiles Sebastian describes in his tutorial
are for different purposes.

- Carsten

>
> Ideally, I'd like to have that information inferred, or at least
> external to the included projects, as they should not have to "know"  
> at
> which location they are used. You don't know about a trick how to get
> around this? I'd also be willing to write some elisp to that end...
>
> Regards, Rotty
> -- 
> Andreas Rottmann -- <http://rotty.yi.org/>
>
>
> _______________________________________________
> 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	[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).