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.
On Friday, April 9, 2021 at 1:48:47 PM UTC-4 [email protected] wrote:
> I recreated that example file tree on Linux, and darned if I didn't get
> the same result as you. I must have had my eyes see the "~" and start
> reading from there because that's what I expected to see. So, a real bug
> and not just a Mac quirk.
>
> In fact, I get the same behavior on Windows. It's a little weird because
> "~" isn't a normal shortcut on Windows. But Python evaluates it correctly,
> for example by os.path.expanduser('~'), so we might think that expanding
> *@path
> ~\test* would act as expected, but instead it acts just like it does on
> Linux.
>
> On Friday, April 9, 2021 at 1:02:45 PM UTC-4 TEK42 wrote:
>
>> Thanks for the input.
>>
>>
>> I don't have a Mac, so I can't help much, but I can speak a bit about the
>> *@path
>>> ~* matter. This does work on Linux. When you wrote "does not expand",
>>> did you mean that the implied paths are not created when you save an
>>> "external" file? If so, you can change this behavior by adding a node to
>>> your MyLeoSettings.leo file. This node has to be a child of the @settings
>>> node, and have this headline:
>>>
>>> @bool create_nonexistent_directories = True
>>>
>>>
>> What I mean by "does not expand: is that there is no "tilde expansion"
>> taking place when I use '~', which I expect to "expand" to my home
>> directory.
>>
>>
>>> Restart Leo after saving. Then the following should happen. Create a
>>> small subtree, for example:
>>>
>>> - @path ~/aaa
>>> - @path bbb
>>> -@path ccc
>>> @clean test1.txt
>>>
>>> After you save the outline, the file *test1.txt* should be there at
>>> *~/aaa/bbb/ccc/test1.txt*.
>>>
>>>
>> Using the setting above the directories are indeed created, but not in my
>> home directory. So if my outline file is in
>> "/Users/leodude/projects/coolproj/" the structure gets created as:
>>
>> "/Users/leodude/projects/coolproj/*~*/aaa/bbb/ccc/test1.txt"
>> instead of ""/Users/leodude/aaa/bbb/ccc/test1.txt" like I expect.
>>
>> Using *'.'* works as expected (cwd) and is arguably more useful than
>> referencing "home dir" in most cases.
>>
>>
>>
>>> There are Mac users who seem to have good success using Leo, so it ought
>>> to workable for you. A lot of them read these posts, so I expect you will
>>> get some help pretty soon.
>>>
>>> Leo is a remarkably useful and adaptable piece of software. But it can
>>> be hard to learn about all the things, like the *@bool* setting above,
>>> that make it really sing for you. Just keep asking here, and read the Leo
>>> docs about settings, customization, and so on.
>>>
>>>
>> That is good to hear.
>>
>> Thanks,
>> TK
>>
>
--
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/1aedb13f-d86a-4e40-8d60-974fd52f9b27n%40googlegroups.com.