"D. C. Toedt" <d...@toedt.com> writes:

> I found a problem when trying this on a bigger file (my book file):  If $1
> (actually, #$1) is for a link target that doesn't exist, then org-mode goes
> into its "No match - create this as a new heading? (y or n)" routine. That
> causes the rest of the export to fail.  It'd be better if get-title could
> do the same thing org-mode does natively, that is, including the text of $1
> as italics to indicate a non-existent link.
>
> Example file below:
>
>
> #+MACRO: get-title (eval (save-excursion (org-open-link-from-string
> "[[#$1]]") (org-get-heading nil nil)))
> #+MACRO: SECREF [[#$1][{{{get-title($1)}}}]]
> #+OPTIONS: H:7 toc:nil num:1 email:t author:t
>
> * Introduction to Technology Contracts
>   :PROPERTIES:
>   :CUSTOM_ID: IntroTechContracts
>   :END:
>
> Lorem ipsum etc. etc.
>
> * Dangerous Clauses
>   :PROPERTIES:
>   :CUSTOM_ID: DangerousClauses
>   :END:
>
> Lorem ipsum etc. etc. -- see Section {{{SECREF(
> BogusLinkTarget
> )}}}

The following should work.

  #+MACRO: get-title (eval (or (save-excursion (ignore-errors (let 
((org-link-search-inhibit-query t)) (org-open-link-from-string "[[#$1]]") 
(org-get-heading nil nil)))) "/$1/"))


Regards,

-- 
Nicolas Goaziou

Reply via email to