Discuss: retire two of the three new gnx-related settings?

36 views
Skip to first unread message

Edward K. Ream

unread,
Jul 5, 2023, 7:29:35 AM7/5/23
to leo-editor

Don't panic. I'm not going to do anything rash.


Imo, there is no need for these two new settings:


- @string unl-status-kind = legacy

- @bool full-unl-paths = True


If these settings must remain, their default values should change to:


- @string unl-status-kind = gnx

- @bool full-unl-paths = False


These settings were essential while working on the big PR. But now most users should use gnx-based unls!


Furthermore, plugins (including Thomas's plugins) can easily ignore (or better, support) gnx-based unls:


p.get_full_legacy_UNL writes legacy unls.


Given a gnx-based unl resolved to position p, the following will "recover" the path list used in old (path-based) unls:


paths = list(reversed([z.h for z in p.self_and_parents()]))


Heh. A similar line appears in p.get_full_legacy_UNL!


Summary


Leonistas should always be using gnx-based unls.


Plugins can easily enforce legacy (path-based) unls if they must.


All questions and comments are welcome. I'm not going to do anything rash.


Edward

Thomas Passin

unread,
Jul 5, 2023, 9:48:16 AM7/5/23
to leo-editor
I disagree about removing the  @string unl-status-kind setting.  I get the most value from the status bar when I can see the path of a node.  A gnx-based unl tells me nothing useful.  If I want to see if the node is in the outline I think it is, I can look at its tab or the title bar of the Leo window.  The gnx part is useless for orienting me within an outline.  I **really want** to see the path-based expression in there.

If you say, yes, but when we copy from the status bar, we want to get the new gnx-based unl, I say fine, but there could be a minibuffer command to do that.  In fact, it would be useful to have the context menu for the status bar contain separate items for copying either the gnx- or legacy path-based UNL of the focused node.

As for your expression paths = list(reversed([z.h for z in p.self_and_parents()])), I have two remarks.  First, there is no need  to cast it to a list.  [...] returns a list already, as does reversed().  Second, if that is a serious suggestion then let's have a Leo method to return it.  No reason for everybody to roll their own.

Edward K. Ream

unread,
Jul 5, 2023, 10:50:36 AM7/5/23
to leo-e...@googlegroups.com
On Wed, Jul 5, 2023 at 8:48 AM Thomas Passin <tbp1...@gmail.com> wrote:
I disagree about removing the  @string unl-status-kind setting.  I get the most value from the status bar when I can see the path of a node.  A gnx-based unl tells me nothing useful.  If I want to see if the node is in the outline I think it is, I can look at its tab or the title bar of the Leo window.  The gnx part is useless for orienting me within an outline.  I **really want** to see the path-based expression in there.

Alright. Let's leave this setting in.

What about the other setting, @bool full-unl-paths = True?

It's never made much sense to me. It does not affect gnx-based unls.

As for your expression paths = list(reversed([z.h for z in p.self_and_parents()])),
 
there is no need  to cast it to a list.

This is the second time you have made this mistaken assertion. reversed is a generator:

print(reversed(['a', 'b']))

<list_reverseiterator object at 0x00000218572299C0>

...let's have a Leo method to return it.  No reason for everybody to roll their own.

I don't want to encourage path-based unls :-)  I mentioned this statement only to show how you could maintain compatibility in your plugins.

Edward

Thomas Passin

unread,
Jul 5, 2023, 11:22:02 AM7/5/23
to leo-editor
On Wednesday, July 5, 2023 at 10:50:36 AM UTC-4 Edward K. Ream wrote:
On Wed, Jul 5, 2023 at 8:48 AM Thomas Passin <tbp1...@gmail.com> wrote:
As for your expression paths = list(reversed([z.h for z in p.self_and_parents()])),
 
there is no need  to cast it to a list.

This is the second time you have made this mistaken assertion. reversed is a generator:

print(reversed(['a', 'b']))

<list_reverseiterator object at 0x00000218572299C0>

Aargh!  My mind is still stuck in Python 2! [pounds head on desk].  Although list.reverse() does not change a list into a generator (although it doesn't return anything, just changes the list in place)

Edward K. Ream

unread,
Jul 5, 2023, 11:47:12 AM7/5/23
to leo-editor
On Wednesday, July 5, 2023 at 6:29:35 AM UTC-5 Edward K. Ream wrote:

If these settings must remain, their default values should change to:


- @string unl-status-kind = gnx

- @bool full-unl-paths = False


 Alright. These settings will remain with the new defaults shown above. It's time to move on.

PR #3424  is now ready for review. I'll wait a few days before merging it.

Note: The PR changes p.get_UNL (which returns gnx-based unl) so it returns a short filename. Imo there should never be a need for an absolute path name in gnx-based unls.

Edward
Reply all
Reply to author
Forward
0 new messages