Dear all,

I often want to enrich texmacs documents with links to stuff that I cannot (or do not want to) view in texmacs. It can be websites, videos, pdf files... In that case the desired action is to use the default appropriate reader to open that content.

That's actually rather easy to do. Define a scheme function:

(tm-define (ext-viewer dest)
(:secure #t)
(:synopsis "uses system default apps to open a destination")
(:argument dest "string that designates a web url, a file...")
(eval-system*
  (cond
         ((os-macos?) "open ")
         ((os-win32?) "start ")
         (else "xdg-open "))
  dest))

then in the document use for instance:

<action|lemonde|(ext-viewer "http://www.lemonde.fr";)>

<action|musique!|(ext-viewer "'~/my music/my song.mp3'")>

It just works.

Now I'd like to simplify entering such links by defining a macro <hlink2|x|y> that would expand to <action|x|(ext-viewer "y")>. I've tried to play with <extern|> but with not much success... Any idea on how to do that?

Oh, and after that I'd like those hlinks to survive in the pdf output :)

best,
Philippe




_______________________________________________
Texmacs-dev mailing list
Texmacs-dev@gnu.org
https://lists.gnu.org/mailman/listinfo/texmacs-dev

Reply via email to