emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] How to keep correct filepaths when using the #+INCLUDE derivativ


From: Daniel P Gomez
Subject: Re: [O] How to keep correct filepaths when using the #+INCLUDE derivative?
Date: Thu, 1 Mar 2018 19:56:58 +0100

Currently when passing the :absolute-paths toggle to an include
derivative, as in :

#+INCLUDE: file.org :absolute-paths t

The function `org-export--prepare-file-contents` will automatically
deduce the directory from file.org and adapt links by calling:
`(new-path (expand-file-name old-path (file-name-directory file)))`.
I could either make this a default option, such that links get
corrected but users can overwrite this by calling `:absolute-paths
nil`, or I could completely remove this toggle and always correct
links no matter what.

One question regarding the implementation, currently I'm deleting the
link with a call to `delete-region` and using `(insert "[[file:"
new-path "]]")` to insert the corrected one. This does not take into
consideration whether links are bracketed or not ( is there a
functional difference if links are not bracketed?). Also, my approach
completely disregards link descriptions, which may be relevant if the
linked file would be, for example, an html document.  Would there be a
cleaner org approach to replace the path keeping the description?

Thank you.

Regards,
Daniel

On Thu, Mar 1, 2018 at 7:32 PM, Nicolas Goaziou <address@hidden> wrote:
> Hello,
>
> Daniel P Gomez <address@hidden> writes:
>
>> If there is any interest, I've created a patch adding support for a
>> :absolute-paths functionality.
>> As I said, I don't have much experience writing Elisp, so any
>> suggestions on how to improve the code would be appreciated. If there
>> is any interest in adding this feature to Org I could try to clean it
>> up.
>
> Thank you.
>
> Would it make sense to automatically deduce this directory from included
> file and apply this automatically?
>
> Regards,
>
> --
> Nicolas Goaziou



reply via email to

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