Good find. That change works well for OS X too.  Additionally, environment 
variables can be handled:

    val = ''.join(aList)
    *val = os.path.expanduser(val)  # <===== Add this line*
    *val = os.path.expandvars(val)  # eg. $HOME, $SOME_OTHER_PATH_VAR*
    if g.isWindows:
        val = val.replace('\\', '/')
    return val

Thus:











*import osg.cls() # <-- does nothing on macos (darwin), probably same with 
linux since the procedure checks for "win" onlyg.es 
<http://g.es/>(os.path.expanduser('~'))# --> /Users/leodudeg.es 
<http://g.es/>(os.environ["HOME"])# --> /Users/leodudeg.es 
<http://g.es/>(c.expand_path_expression('~'))# --> **/Users/leodude*


*g.es <http://g.es/>(c.expand_path_expression('$HOME'))# --> /Users/leodude*


I've installed from the devel git branch, so I'll just go ahead and look 
into how to contribute to this project. I'd like to enhance the "g.cls()" 
also.



It looks like there is a simple fix.  This hasn't had hardly any testing, 
> but on the surface it's doing the right thing.  The little example that 
> failed in an earlier post created the right directories.
>
> In *leoCommands.py*, in the method *expand_path_expression(self, s)*, add 
> the line marked below
>
>     val = ''.join(aList)
>     *val = os.path.expanduser(val)  # <===== Add this line*
>     if g.isWindows:
>         val = val.replace('\\', '/')
>     return val
>
> @n00b, if you know how to find Leo's python code files, would you make 
> this change and see if it works for you?  They would be in the 
> *Lib/sitepackages/leo* directory for the python executable you are 
> using.  There may be more than one *sitepackages *directory.  You can 
> locate them this way:
>
>>
>> I checked this on os x and get the same results:
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> *import osg.cls() # <-- does nothing on macos (darwin), probably same 
>> with linux since the procedure checks for "win" onlyg.es 
>> <http://g.es/>(os.path.expanduser('~'))# --> /Users/leodudeg.es 
>> <http://g.es/>(os.environ["HOME"])# --> /Users/leodudeg.es 
>> <http://g.es/>(c.expand_path_expression('~'))# --> ~g.es 
>> <http://g.es/>(c.expand_path_expression('$HOME'))# --> $HOME*
>>
>> It looks like there is opportunity to bring Leo into better usability 
>> with Linux-ey OS’s.
>>
>> Depending on how much I end up using Leo (I already spent more time in 
>> Leo than in emacs org-mode this week), I may be up for contributing towards 
>> that end - at least for macos. 
>>
>>
>> Subject to correction by Edward or some else who knows more, it looks 
>>> like the place to intervene is in c.expand_path_expression() because  
>>> on even on Linux it returns this:
>>>
>>> >>> c.expand_path_expression('~')
>>> '~'
>>>
>>> This method is in the class *Commands*.  I'm not sure how tricky this 
>>> would be to adjust, because you would only want to substitute 
>>> */home/{user}* for "~" if it appears at the start of a path expression, 
>>> and I don't know yet how to know.  Also, it needs to be checked if a change 
>>> here would cause troubles anywhere else.
>>
>>

-- 
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 on the web visit 
https://groups.google.com/d/msgid/leo-editor/af257ca1-2f49-4fd1-8bdc-ed73d25e3a0fn%40googlegroups.com.

Reply via email to