Re: gnx-based unls make the backlink and quickMove plugins obsolete

2023-07-03 Thread Thomas Passin
This is getting me to think there should be a new method, say 
c.getCrossfileUnl(p), that returns a tuple (file, gnx).  The caller can 
then assemble the two components into a cross-outline UNL if desired, or 
just use the gnx part.  There would be no need for a caller to root around 
to find the right file and combine it with the gnx, but equally no need to 
split out the file part from the gnx part if that were wanted. Or maybe the 
tuple should be (full_unl, file, gnx).  This new method would not replace 
any existing methods, but would be available to new code going forward.

On Monday, July 3, 2023 at 6:00:32 PM UTC-4 Edward K. Ream wrote:

These plugins create and manage links, including cross-outline links. But 
gnx-based unls can also refer to nodes in other outlines! Most users will 
have no need for either plugin.


Both plugins save link data in uAs. That's an interesting approach! 
However, a script could easily create uAs by searching for gnx-based unls. 
The plugins are way too complicated.


*Summary*


The backlink and quickMove plugins are overly-complex ways of following 
cross-outline links. I do not recommend either plugin. Both plugins now 
reside in the 'Experimental/Obsolete' node in LeoPyRef.leo.


All of your comments are welcome.


Edward

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/352616f8-e1da-4d3d-a95a-15127effa48bn%40googlegroups.com.


gnx-based unls make the backlink and quickMove plugins obsolete

2023-07-03 Thread Edward K. Ream
 

These plugins create and manage links, including cross-outline links. But 
gnx-based unls can also refer to nodes in other outlines! Most users will 
have no need for either plugin.


Both plugins save link data in uAs. That's an interesting approach! 
However, a script could easily create uAs by searching for gnx-based unls. 
The plugins are way too complicated.


*Summary*


The backlink and quickMove plugins are overly-complex ways of following 
cross-outline links. I do not recommend either plugin. Both plugins now 
reside in the 'Experimental/Obsolete' node in LeoPyRef.leo.


All of your comments are welcome.


Edward

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/46e57b61-10e3-4017-9ed0-d400f7643a90n%40googlegroups.com.


Re: Enhancement - Dragging outline to desktop icon should open in same Leo session

2023-07-03 Thread Edward K. Ream
\On Monday, July 3, 2023 at 12:38:38 PM UTC-5 Thomas wrote:

Some people launch Leo from a desktop icon.  If you have such an icon and 
drag'n'drop an outline on it, the outline will open in a new Leo session.  
Drag another outline, get yet another Leo session.


 Feel free to create an enhancement request.

Edward

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/fe45fdb8-3c95-401a-b5ba-796e24e7c525n%40googlegroups.com.


Enhancement - Dragging outline to desktop icon should open in same Leo session

2023-07-03 Thread Thomas Passin
Some people launch Leo from a desktop icon.  If you have such an icon and 
drag'n'drop an outline on it, the outline will open in a new Leo session.  
Drag another outline, get yet another Leo session.

Some programs (e.g., Notepad++ on Windows) will open dropped files in the 
same open session.  I'd prefer Leo to operate that way.  I don't know, 
programming-wise, how it's done.  I presume there's a way to search through 
the running processes to find Leo if it's there.  In Windows, the task 
manager will list a Leo session as a subordinate to a Python session, so it 
must be feasible somehow.

However, I wouldn't want Leo to operate entirely as a singleton program.  I 
find many situations where I want to be able to open a second Leo window, 
and I wouldn't like to give up that ability.  In those cases, though, I'm 
almost always launching the new Leo session from the console since I want 
to use different command-line parameters.

Terry Brown has some scripts in leo-editor-contrib in which he runs a 
leoserver server,  and clients that send code to Leo via the server to do 
things like import  a file for edit.  I'm wondering if some of that 
capability can be gotten in the way I'm describing instead, without needing 
to run a server.

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/2b0c3ee5-b9c5-4c41-895b-4f387163630cn%40googlegroups.com.


Re: A new unit test pattern

2023-07-03 Thread Edward K. Ream
On Mon, Jul 3, 2023 at 11:23 AM Edward K. Ream  wrote:

g.findAnyUnl assumes that @data unl-path-prefixes is functional. Setting up
> this condition is more complicated than usual.
>
>
> One new helper helps simulate the @data unl-path-prefixes setting.
>
>
> The other new helper helps the helper :-)
>
>
> New unit tests test both helpers.
>

One more part of the pattern. Organizer nodes contain both the helpers and
their unit tests. See the LeoUnitTest and TestGlobals classes in
leoTest2.py and test_leoGlobals.py.

Edward

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/CAMF8tS1Fghd4sYTJPU-APeH1sbs2TTRSpS1xMKRWf7a0YnLVYw%40mail.gmail.com.


A new unit test pattern

2023-07-03 Thread Edward K. Ream
 

I have been adding new unit tests for some (not all) new functions/methods 
in the big PR.


Some of these tests are more complicated than usual. For example, tests of 
*g.findAnyUnl* require that the *@data unl-path-prefixes* setting refers to 
actual files.


The details are a bit messy, so I defined two new helpers:


- *TestGlobals._patch_at_data_unl_path_prefixes* and

- *LeoUnitTest._set_setting.*


The first calls the second. These helpers are themselves a new pattern for 
me.


The second new pattern defines unit tests for the helpers: 


- *LeoUnitTest.test_set_setting* and

- *TestGlobals.test_patch_at_data_unl_path_prefixes*.


*Summary*


g.findAnyUnl assumes that @data unl-path-prefixes is functional. Setting up 
this condition is more complicated than usual.


One new helper helps simulate the @data unl-path-prefixes setting.


The other new helper helps the helper :-)


New unit tests test both helpers.


Edward

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/b0f56678-af91-4ac6-87b3-a0a3643f4dd7n%40googlegroups.com.


Re: Debate: always save session data?

2023-07-03 Thread Edward K. Ream


On Monday, July 3, 2023 at 10:24:39 AM UTC-5 Thoma wrote:

On Monday, July 3, 2023 at 10:57:02 AM UTC-4 Edward K. Ream wrote:

I'm going to shorten *--always-write-session-data* to *--write-session*.


Remember to change  *-a* to *-w *(it's the kind of thing I would forget :-) 
).


The new name of the command-line option is *save-session*.

I see no reason to abbreviate it to -s.

Edward

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/21558c4a-b6e4-419e-afd3-21189a2ebf35n%40googlegroups.com.


Re: Debate: always save session data?

2023-07-03 Thread Thomas Passin

On Monday, July 3, 2023 at 10:57:02 AM UTC-4 Edward K. Ream wrote:

I'm going to shorten *--always-write-session-data* to *--write-session*.


Remember to change  *-a* to *-w *(it's the kind of thing I would forget :-) 
).

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/544762fc-cd05-43cc-ada0-6b8afea4b923n%40googlegroups.com.


Re: Debate: always save session data?

2023-07-03 Thread Edward K. Ream
On Mon, Jul 3, 2023 at 8:32 AM Thomas Passin  wrote:

> I just tested the new code for *--always-write-session-data*, and it
> worked as expected:
>
> 1. Open Leo and load several outlines;
> 2. Close Leo and re-open with *.leo\workbook.leo* on the command line;
> 3. Close and re-open Leo without an outline on the command line.
> 4. Observe that the several outlines get loaded.
> 5.  Close Leo and re-open with *-a* and *.leo\workbook.leo* on the
> command line;
> 6.  Close and re-open Leo without an outline on the command line.;
> 7. Observe that only the workbook loads.  This shows that leo.session was
> created.
>

Many thanks for your testing.

I'm going to shorten *--always-write-session-data* to *--write-session*.

I plan no other changes to PR #3215,
 aside from unit tests
and documentation.

Edward

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/CAMF8tS3hh4h6UZHCsb7v6K7Z38Hsh02T8-9j6pHzsjqSZwfMFw%40mail.gmail.com.


Re: Debate: always save session data?

2023-07-03 Thread Thomas Passin
I just tested the new code for *--always-write-session-data*, and it worked 
as expected:

1. Open Leo and load several outlines;
2. Close Leo and re-open with *.leo\workbook.leo* on the command line;
3. Close and re-open Leo without an outline on the command line.
4. Observe that the several outlines get loaded.
5.  Close Leo and re-open with *-a* and *.leo\workbook.leo* on the command 
line;
6.  Close and re-open Leo without an outline on the command line.;
7. Observe that only the workbook loads.  This shows that leo.session was 
created.

On Monday, July 3, 2023 at 7:47:38 AM UTC-4 Edward K. Ream wrote:

> On Monday, July 3, 2023 at 6:34:16 AM UTC-5 Edward K. Ream wrote:
>
> > A command line is out of the question.
> ...
> > So we must choose *now* how Leo will work for *everyone.* It's time to 
> resolve this question!
>
> It's funny how writing changes my mind.
>
> *Aha!* The only way to resolve this question is to add the 
> *--always-write-session-data* command-line option.
>
> Debate canceled!
>
> Edward
>

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/e46631d2-9509-4729-b603-24d82558c5b6n%40googlegroups.com.


Re: Debate: always save session data?

2023-07-03 Thread Edward K. Ream


On Monday, July 3, 2023 at 6:34:16 AM UTC-5 Edward K. Ream wrote:

> A command line is out of the question.
...
> So we must choose *now* how Leo will work for *everyone.* It's time to 
resolve this question!

It's funny how writing changes my mind.

*Aha!* The only way to resolve this question is to add the 
*--always-write-session-data* command-line option.

Debate canceled!

Edward

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/0cdade6e-3620-4962-83d0-52bb8be1d454n%40googlegroups.com.


Debate: always save session data?

2023-07-03 Thread Edward K. Ream
 

We disagree about when to write *session data *(a list outlines). Some say, 
"Always." Others say, "Only if the command line had no outlines."


I see no way to allow all Leonistas to make Leo work as they like. A 
command line is out of the question. My bright idea failed spectacularly :-)


So we must choose *now* how Leo will work for *everyone.* It's time to 
resolve this question!


Please put forth your arguments. I have no opinion on the question.


I won't tolerate claims that Leo is unusable because it doesn't work as you 
like. You must explain why your way is best for everyone.


Good luck. Let the debate begin!


Edward

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/ab4fba21-5f8d-4098-b396-06ad4d6711dfn%40googlegroups.com.


Re: ENB: About session preferences

2023-07-03 Thread Edward K. Ream
On Monday, July 3, 2023 at 5:34:42 AM UTC-5 Edward K. Ream wrote:

> Drat. My scheme is in ruins. The only way to enable this plugin would be 
with a per-outline setting (@enabled-plugins).

I'm stuck. My plan, for now:

- Leo will always write session data. Sorry Thomas. 
- A new command-line arg is out of the question.
- I'll retain the Easter Egg: the new/restored g.app ivars and associated 
logic.
- I'll retain the modify_sessions plugin while we debate what to do next.

Edward

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/84406ec1-1b00-4a8f-9a75-efa411457db4n%40googlegroups.com.


Re: ENB: About session preferences

2023-07-03 Thread Edward K. Ream
On Monday, July 3, 2023 at 4:52:17 AM UTC-5 Edward K. Ream wrote:

> I'll modify PR #3215  so 
that Leo always writes session data.

> Those who prefer otherwise can enable the modify_session plugin.

Drat. My scheme is in ruins. 

The only way to enable this plugin would be with a per-outline setting 
(@enabled-plugins).

And a startup script won't work either. Those scripts must always be 
per-outline scripts.

Edward

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/e02e909d-dfd4-4621-b73e-40e106e4f212n%40googlegroups.com.


ENB: About session preferences

2023-07-03 Thread Edward K. Ream
 

Thomas has convinced me not to change Leo's session-handling code 
significantly. I have closed #3417 
 and its related PR: 
Leo will retain its session-* commands and related documentation.


However, Leonistas disagree about *when *to write *session data *(a list 
outlines). Some say, "Always." Others say, "Only if the command line had no 
outlines."


We usually do not argue about preferences. However, a per-outline setting 
won't do. And I refuse to add a command-line option to resolve this minor 
question.


What to do? It's a puzzle.


When I awoke this morning, I saw the way forward. I'll add an Easter Egg to 
Leo's startup and shutdown code. A tiny new plugin, *modify_sessions*, will 
exploit the hidden code. Like this:


1: Restore the *g.app.loaded_session* ivar, inited (as before) to False.


2: Add the *g.app.always_write_session_data *ivar, inited to True.


3: Change the shutdown logic in two places:


if g.app.sessionManager and (

   g.app.loaded_session or g.app.always_write_session_data

):

 g.app.sessionManager.save_snapshot()


4: Create the modifiy_sessions plugin, containing (sans docstrings) only:


def init():

   g.app.always_write_session_data = False


*Summary*


Leo will retain its session-* commands and related documentation.


Leonistas disagree about when Leo should write session data. Some say, 
"Always." Others say, "Only if the command line had no outlines."


Neither a command-line option nor a per-outline setting can resolve this 
question.


I'll modify PR #3215  so 
that Leo always writes session data. Those who prefer otherwise can enable 
the modify_session plugin.


All your comments are welcome.


Edward

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/f0fbf1ae-85ef-4963-a2b5-edc0a9149eefn%40googlegroups.com.


Re: Discuss: Remove all session commands?

2023-07-03 Thread Edward K. Ream
On Mon, Jul 3, 2023 at 12:28 AM Robert-Felix  wrote:

> I have not done the sessions related code yet, (i didnt even know what
> they were 5 minutes ago) and I do not intend if i dont have to ! haha! In
> fact, I intended to use the same system as in leointeg: It reopens the last
> Leo files you had opened when last closing vscode *for a given workspace*,
> and kept in vscode's user-data storage "object"* for that workspace. *
>
> ( So that it feels natural to see the last Leo files you had worked on
> when opening a given folder (workspace) to work with in vscode.  )
>

Thanks for your comments. I'm glad to hear Leo's session follies will have
no impact on leoJS or leoInteg.

Edward

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/CAMF8tS2HWQMVJFTSMQTeSpWT-imrQGt8Q1V5XkHtEmK3XKq4Gg%40mail.gmail.com.