[snip]
2. Is there a simple method to access the content of a specific `unl://` node? I found `core/LeoPyRef.leo#Code-->Core classes-->@file leoGlobals.py-->g.Urls & UNLs`, but it doesn't seem to provide the right function for my needs. With the help of gpt, I can't get the answer. But it is interesting...maybe we need a `getAtNodeFromUNL` function XD
On Sunday, June 25, 2023 at 3:27:38 AM UTC-4 iamap...@gmail.com wrote:[snip]2. Is there a simple method to access the content of a specific `unl://` node? I found `core/LeoPyRef.leo#Code-->Core classes-->@file leoGlobals.py-->g.Urls & UNLs`, but it doesn't seem to provide the right function for my needs. With the help of gpt, I can't get the answer. But it is interesting...maybe we need a `getAtNodeFromUNL` function XD
Would you explain more fully what you mean by "access the content of..."? One way is to CTRL-click on the UNL's string in a body node. This will navigate you to that location, opening the outline if necessary. It should also be easy enough to write a new command that navigates to a UNL that is in the clipboard. It just depends on what you mean ...
On Sunday, June 25, 2023 at 7:59:09 AM UTC-4 iamap...@gmail.com wrote:Would you explain more fully what you mean by "access the content of..."? One way is to CTRL-click on the UNL's string in a body node. This will navigate you to that location, opening the outline if necessary. It should also be easy enough to write a new command that navigates to a UNL that is in the clipboard. It just depends on what you mean ...Hi, Thomas,Thanks for your reply.I want to get the content of UNL by script, like `p.b` to get the body content in the current node.
Do you mean you want a method or function to return the text of the body of the node addressed by the UNL? In general, the UNL could point to another outline.
Do you mean you want a method or function to return the text of the body of the node addressed by the UNL? In general, the UNL could point to another outline. Will you be looking only in the current outline, or any outline? And if the latter, do you care if that other outline gets opened during execution of the function?
For now, my UNL points to a position of the current outline. Could we have a quick way to get it?
--
You received this message because you are subscribed to a topic in the Google Groups "leo-editor" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/leo-editor/_TqPXKhD-rs/unsubscribe.
To unsubscribe from this group and all its topics, send an email to leo-editor+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/leo-editor/246ebac0-0439-4592-91bd-9f40bebd3e23n%40googlegroups.com.
c0, p0 = c, c.pc2 = g.handleUnl(unl, c)
content = c2.p.b # <---- here is the content of the UNL's body
c0.selectPosition(p)Oops, typo! The last line should readc0.selectPosition(p0)
c0, p0 = c, c.pc2 = g.handleUnl(unl, c)
content = c2.p.b # <---- here is the content of the UNL's body
c0.selectPosition(p)Oops, typo! The last line should readc0.selectPosition(p0)Hi, Thomas,It works, thank you!
It's a useful snippet, we should write it down. But where should we save it? Do you know the right place?https://github.com/leo-editor/snippets seems like a good place, but it doesn't update for a long time.
Probably a good place is leo-editor-contrib.
"Remove support for cross-file UNLs" - WTF??? This will break some of my scripts. How are we going to navigate to other outlines by UNL? Wasn't that half of the point of having UNLs in the first place?
On Sun, Jun 25, 2023 at 7:51 AM Thomas Passin <tbp1...@gmail.com> wrote:"Remove support for cross-file UNLs" - WTF??? This will break some of my scripts. How are we going to navigate to other outlines by UNL? Wasn't that half of the point of having UNLs in the first place?This conversation is likely out of date:1.I was probably thinking that g.findUNL (the legacy unl-finding function) might return a position in another outline. To my knowledge, that has never been true.
Yes it has. Here's the docstring from the (unreplaced) g.findUNL:
Find and move to the unl given by the unlList in the commander c.
Return the found position, or None.
Oh ye of little faith. In the PR the call to g.app.selectLeoWindow appears in both g.findUNL and g.findGNX. So these calls have already been done when g.handleUnl returns.That's not the point. This bit of code returns the focus to the original node even if the findUNL() call, for a UNL pointing into another outline, had changed the focus to that other outline. The idea is to retrieve the body of the node addressed by the unl without changing the focus.