I may have missed this in documentation, but hacking took less time
and was more fun...

@url nodes are great for bookmark-related entities to open with a web
browser.  The UNL plugin allows access to Leo nodes.  Is there an
@command for opening arbitrary (viewable) files via their preferred
software, e.g. mime/mailcap?

A task I'm using Leo for is organizing research mindmap info.  It
would be great to have headlines "@url papers/White2009.pdf" open on
d-click with kpdf/acroread directly instead of within a browser.  Yes,
it works, but...

My 4-line hack of UNL.py in leoPlugins.leo
QQQQ
Plugins-->UNL plugin-->@thin UNL.py-->onUrl1--><<invoke external browser>>

if url.lower().startswith('file:'):
    import os
    os.spawnlp(os.P_NOWAIT, 'see', 'see', url[5:])
else:
    import webbrowser

    # Mozilla throws a weird exception, then opens the file!
    try:
        webbrowser.open(url)
    except:
        pass
QQQQ

Better IMO would not to require the protocol "file:" prefix and
instead differentiate between a UNL and file.  Open a browser if a
protocol is specified (including file:), goto Leo node if a UNL, or
attempt to spawn an appropriate viewer using @path information.

"see" is part of mime-support in Ubuntu and does the mailcap dirty work.

If I described the new desired behavior clearly, are there better or
more intuitive ways for this to work?  A new e.g. "@mime" directive?

This is a contribution I'm happy to make, but there's probably some
better ideas out there.

Dan

-- 
www.whiteaudio.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/leo-editor?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to