emacs-orgmode
[Top][All Lists]
Advanced

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

Re: [O] Conditional link export?


From: Aaron Ecay
Subject: Re: [O] Conditional link export?
Date: Sun, 08 Nov 2015 18:03:39 +0000
User-agent: Notmuch/0.20.2+65~gbd5504e (http://notmuchmail.org) Emacs/25.0.50.2 (x86_64-unknown-linux-gnu)

Hi Oleh,

2015ko azaroak 8an, Oleh Krehel-ek idatzi zuen:
> 
> Aaron Ecay <address@hidden> writes:
> 
>> Extra elisp inside the org file is an important way of extending the
>> power of org markup.  Why don’t you want to use it?
> 
> Including boilerplate Elisp, all subtly different into each markup
> document, just to extend the markup with the syntax that it should have
> in the first place anyway. Doesn't that sound bad to you?
> 
> One-off Elisp inclusions relevant to a single document are great and
> powerful, but adding boilerplate code, usually more of it that the whole
> sum of the markup, doesn't sound great at all.  This could be rectified
> somewhat by using `require', but then we don't have a self-contained
> document any more. Which is important to facilitate sharing and re-use
> of Org-mode documents.

I’m not sure I understand you.  You’re against putting elisp into the
document, but that seems like the main thrust of your proposal.  You
also want self-contained documents, but insofar as these rely on new
features being added to org, they will introduce dependencies on
specific org versions, which is an potential obstacle to sharing and
reuse.

> 
>> Not in general.  For small pieces of text, you can use macros.
>> Something like:
>> 
>> #+macro: ifinfo (eval (if (org-export-derived-backend 
>> org-export-current-backend 'info) "$1" "$2"))
>> 
>> {{{ifinfo([[info:emacs#Pachages]],[[https://....]])}}}
> 
> The macro definition and call syntax looks very ugly.

For aesthetic considerations when editing, check out
‘org-hide-macro-markers’.

I think Nicolas gave you very thorough responses to the rest of your
proposal.  Just a one more additional comment.

[...]

> 2. Something like `ox-link' isn't built-in.

Thorsten Jolitz’s org-dp library might provide you a base on which to
build such functions, if you’re motivated.
<https://github.com/tj64/org-dp>.  The readme is a little dense IMO (the
docstrings are better), but you should be able to do something like:

(defun ox-link (dest)
  (let* ((elements (split-string dest ":"))
         (type (nth 0 elements))
         (path (mapconcat #'identity (cdr elements) ":")))
    (org-dp-create 'link nil nil
                   :type type
                   :path path)))

If you build a library of such functions and they prove useful, we could
put them in org-contrib and (eventually perhaps) into core.

Hope this is helpful,

-- 
Aaron Ecay



reply via email to

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