I meant CTRL-click, sorry.

Yes, it is nice that the 'mailto//' ... schema(?) works as well.

I have previously mentioned that the treatment of 'file://' is a bit iffy 
... it does not work as expected in all cases (for me, under Linux). It 
would be nice to sort things out so that I could past a file link 
(preferably with spaces and non-ASCII characters) into Leo and have a 
CTRL-click do 'xdg-open' appropriately. I started looking into where the 
current limitations/non-conformities lie but it was a bit too much of a 
twisty maze of passages for me at the time.

    J^n


On Tuesday, November 25, 2025 at 4:23:00 AM UTC [email protected] wrote:

> Ha! I didn't think of trying that.  Control-click worked for me.  Tres 
> cool. Double clicking didn't do anything; CTRL-Click opened my email client 
> right directly.
>
> On Monday, November 24, 2025 at 6:21:33 PM UTC-5 jkn wrote:
>
>> one reason I never got around to it is that in my setup at least, 
>> double-clicking on a link:
>>
>>     mailto://[email protected]
>>
>> causes the browser to open my mail client similarly. So that is something 
>> similar...
>>
>>     J^n
>>
>>
>> On Monday, November 24, 2025 at 11:19:12 PM UTC jkn wrote:
>>
>>> Nice - I have been meaning to write something myself like this myself, 
>>> so thanks Thomas
>>>
>>>     Jon N
>>>
>>>
>>> On Monday, November 24, 2025 at 6:34:17 PM UTC [email protected] wrote:
>>>
>>>> Here's a script that lets you send the body of the selected node to 
>>>> email. The body needs to contain the text "email: <address>", where 
>>>> "<address>" is the email address to send the node to.  If there is a text 
>>>> selection, it will be searched for the address.  If not, the entire body 
>>>> will be searched. The script works for both Windows and Linux.  It ought 
>>>> to 
>>>> work on MacOS but I can't try that. The message is handled by the system 
>>>> default email handler. 
>>>>
>>>> I have added this script to my "Local" custom menu defined in 
>>>> myLeoSettings.leo. Here it is:
>>>>
>>>> @language python
>>>> """Extract email address and launch email program on it.
>>>>
>>>> The address is expected to be prefaced like this:
>>>>     
>>>> [optional text first] email: [email protected] [optional text after]
>>>>
>>>> If there is a selection, the selected text is searched for an email
>>>> address.  Otherwise, the entire body is searched.  The system's
>>>> default email program is opened.
>>>> """
>>>>
>>>> import re
>>>> from sys import platform
>>>> import os
>>>> from subprocess import call
>>>>
>>>> EMAILre = r'.*email:[ ]*([^@]+@[^@ \t\n]+)'  # inline
>>>>
>>>> def open_file(filename):
>>>>     try:
>>>>         os.startfile(filename)  # Windows only
>>>>     except Exception as e:
>>>>         print(e)
>>>>         opener = "open" if platform == "darwin" else "xdg-open"
>>>>         call([opener, filename])
>>>>
>>>> # List of line(s) containing cursor or selection
>>>> cursor_lines = c.getBodyLines()[1]
>>>> line = cursor_lines[0] if cursor_lines else ''
>>>>
>>>> matched = re.match(EMAILre, line)
>>>> target = matched[1] if matched else None
>>>>
>>>> if target:
>>>>     target = 'mailto:' + target.strip()
>>>>     open_file(target)
>>>> else:
>>>>     g.es('no address found')
>>>>
>>>>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/leo-editor/98593d7f-41da-4f7b-9a6e-2cd417ba0b68n%40googlegroups.com.

Reply via email to