Hi Philippe, initially I'd have said
<assign|hlink2|<macro|text|link|<action|<arg|text>|(ext-viewer "<arg|link>")>>> but this doesn't work: the presence of the <arg|link> causes the argument of the <action> to become a tree instead of a string, and then the code which tries to execute our scheme code gets confused (link-navigate.scm:361) because it receives (concat "(ext-viewer " \" "hello there" "\")") which is not what it expects. So we must convert that tree into a string, and that's what the <merge> macro does. So your final macro will be: <assign|hlink2|<macro|text|link|<action|<arg|text>|<merge|(ext-viewer "|<arg|link>|")>>>> The question of your links being there when you export to PDF is more difficult, though. I'd suggest checking what the export code does with the actions. Does it render them as links, and in that case, how does it process the href? Maybe there's some convention (or we could implement it) that the return value of the action is used as href... Best, ________________ Miguel de Benito. On Tue, Sep 11, 2012 at 9:04 AM, <texmacs.5.pjo...@spamgourmet.com> wrote: > 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<https://lists.gnu.org/mailman/listinfo/texmacs-dev> >
_______________________________________________ Texmacs-dev mailing list Texmacs-dev@gnu.org https://lists.gnu.org/mailman/listinfo/texmacs-dev