Re: clone short cut for Mac

2019-08-24 Thread Austin(Xu) Wang
Looks like in my Mac, the Command button is Ctrl.
Command-u/d/r/l/i all works.

However, Command-` doesn't.  I redefined clone in myLeoSettings.leo to 
Crtl-\  for now.

Another question is, which key is Alt key?
Tried Option-- and Option-] with no luck..



On Sunday, August 25, 2019 at 8:02:10 AM UTC+7, Austin(Xu) Wang wrote:
>
> Shift-Command-C doesn't work in my Mac.
> Shift-Command-X copy one node
> Shift-Command-V paste one node ( not clone)
>
> If the body editor control is focused, 
> Option-x will put one capitalized X.
>
> If the log panel is focused,
> Option-x will put meta-x
>
>
>
> On Sunday, August 25, 2019 at 3:24:45 AM UTC+7, Rob wrote:
>>
>> Maybe not the best way, but what I do on my Mac is:
>>
>> Shift-Command-C (copy node)
>> Option-x (mini-buffer) paste-retaining-clones
>>
>> HTH
>> Rob...
>>
>> On Friday, August 23, 2019 at 3:19:15 PM UTC-5, Austin(Xu) Wang wrote:
>>>
>>> Hello Mac Leo User,
>>>
>>> Please how to clone a node via keyboard?
>>> It should be Ctrl-` , but I tried Command-` , Control-`, Option-`, no  
>>> one works...
>>>
>>> Also, Alt-x on my key board doesn't work too.. 
>>>
>>> BR,Austin
>>>
>>

-- 
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/90ba9768-1578-48cd-880d-e653d221b7e9%40googlegroups.com.


source code for http://leoeditor.com/load-leo.html

2019-08-24 Thread Austin(Xu) Wang
Dear Leonine,

Checking the documentation website, I found this tool
http://leoeditor.com/load-leo.html

which looks simple and easy to use.

Is the source code for the tool in leo git repo?

BR,Austin

-- 
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/0c66f7c7-0eb5-4994-9b35-1efd982c4669%40googlegroups.com.


Re: clone short cut for Mac

2019-08-24 Thread Austin(Xu) Wang
Shift-Command-C doesn't work in my Mac.
Shift-Command-X copy one node
Shift-Command-V paste one node ( not clone)

If the body editor control is focused, 
Option-x will put one capitalized X.

If the log panel is focused,
Option-x will put meta-x



On Sunday, August 25, 2019 at 3:24:45 AM UTC+7, Rob wrote:
>
> Maybe not the best way, but what I do on my Mac is:
>
> Shift-Command-C (copy node)
> Option-x (mini-buffer) paste-retaining-clones
>
> HTH
> Rob...
>
> On Friday, August 23, 2019 at 3:19:15 PM UTC-5, Austin(Xu) Wang wrote:
>>
>> Hello Mac Leo User,
>>
>> Please how to clone a node via keyboard?
>> It should be Ctrl-` , but I tried Command-` , Control-`, Option-`, no  
>> one works...
>>
>> Also, Alt-x on my key board doesn't work too.. 
>>
>> BR,Austin
>>
>

-- 
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/7693e5fc-302c-4d58-8de1-043bd80ffaf6%40googlegroups.com.


Re: Having trouble writing a simple grouped undo/redo

2019-08-24 Thread Brian Theado
It turns out the '-m pdb' workaround for the readline crash does work for
me running unit tests.

I decided I wanted to follow the good practice of adding a failing unit
test which exposes the bug and then show after the fix that same test
passes. I discovered there are already unit tests for other group undo
commands like convertAllBlanks and convertAllTabs and I wondered how those
tests were passing. It turns out all the undo/redo tests start with a fresh
undo stack. The off-by-one error of this bug causes the bead index to be -1
instead of 0. But for a single element list array, indices -1 and 0 point
to the same list element. So the group redo will always function properly
when it is the only item on the list.

In order to duplicate the bug, I will need to write a test containing
multiple commands. I might be out of time for this for a few days, but I
plan to tackle it when I get a chance.

On Wed, Aug 21, 2019 at 7:45 AM Brian Theado  wrote:

> Sure, I'll do that or figure out the segfault issue sometime this week.
>
> On Tue, Aug 20, 2019 at 7:26 AM Edward K. Ream 
> wrote:
>
>> Unfortunately, I'm not able to run unit tests without getting a segfault.
>>>
>> Alright.  Create a new branch, and I'll run the unit tests there.
>>
>

-- 
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/CAO5X8Cxs_P3MHsYWw1eKC9tSNZug9XexBPezsOk0aR%2BqBt7mVQ%40mail.gmail.com.


Re: I've just killed two issues

2019-08-24 Thread vitalije
 

> Is there anything a person of small dev skills like myself can do to help 
> prove/isprove the approach is sound and beneficial?
>
-matt
>

If you have any questions about my idea I would be glad to explain it in 
more details. That could be a great help to make my idea clear. It is clear 
in my mind, but I am not sure if I explained it well. Sometimes I feel I 
should write more detailed explanation. But sometimes too many details can 
make things less clear. Questions of careful reader are likely to help in 
achieving an optimal ratio between details and the whole picture.

Vitalije 

-- 
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/0f75dc8d-e34e-4aee-bca8-3cc16f1b3268%40googlegroups.com.


Re: I've just killed two issues

2019-08-24 Thread Matt Wilkie
Clearly you've devoted some concentrated thought to the challenge Vitalije. 
I love the idea of setting levels 0,1,2,... and the setting being able to 
report on it's level. Is there anything a person of small dev skills like 
myself can do to help prove/isprove the approach is sound and beneficial?

-matt

-- 
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/8f79211a-caec-45aa-a51c-30ea622bbc72%40googlegroups.com.


Re: clone short cut for Mac

2019-08-24 Thread Rob
Maybe not the best way, but what I do on my Mac is:

Shift-Command-C (copy node)
Option-x (mini-buffer) paste-retaining-clones

HTH
Rob...

On Friday, August 23, 2019 at 3:19:15 PM UTC-5, Austin(Xu) Wang wrote:
>
> Hello Mac Leo User,
>
> Please how to clone a node via keyboard?
> It should be Ctrl-` , but I tried Command-` , Control-`, Option-`, no  one 
> works...
>
> Also, Alt-x on my key board doesn't work too.. 
>
> BR,Austin
>

-- 
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/e32d6cc7-2e2b-4d74-81c2-db7eb5122d75%40googlegroups.com.


Re: I've just killed two issues

2019-08-24 Thread vitalije


On Saturday, August 24, 2019 at 2:46:02 PM UTC+2, Matt Wilkie wrote:
>
> It's too bad there's no obvious path forward. Maybe one will present 
> itself eventually as we dwell here longer. Good that increased complication 
> without clear gain has been avoided though!
>
> -matt
>
 
If you ask me, there is an obvious path forward. The question is whether 
Edward will like it or not :-).

Vitalije.

-- 
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/1e602910-d1cf-419c-92f4-70e9410bede5%40googlegroups.com.


Re: I've just killed two issues

2019-08-24 Thread vitalije
IMHO the real problem is the way Leo handles settings at the moment. I have 
suggested several times in the past to change this. 

The way I see it is this. Leo handles settings using the very same 
functionality that is used to handle its primary 
data - outlines. One might think it was a clever idea that saved some 
coding. But if we honestly and without prejudices, look at the result of 
this idea, we can see that it caused numerous complications in several 
other parts of Leo. Initialization code is an excellent example. But there 
is much more examples. One of the most extreme I can remember is that there 
is a call to c.endEditing very early before any gui element has any chance 
of being created. 

By the way this call is spread throughout the code base, contaminating and 
entangling all Leo's modules. I am not very convinced that it is still 
necessary because there had been many changes since it was introduced. It 
would be good to look how to eliminate the need for this call. But this 
should go to another topic.

Let's continue with the way Leo handles settings. Let's first split this 
idea in two parts:

   1. editing settings as an ordinary outline
   2. loading settings from the outline

The two parts are not necessarily bound to one another. They can be changed 
separately without too much trouble. While I am not very interested in 
changing the first, the second one IMHO should be changed in order to 
simplify other parts of Leo, and I am pretty sure the simplifications would 
be significant.

If we ask users both newbies and seasoned are they satisfied with the way 
Leo handles settings, I guess we would find many more unsatisfied users 
than the satisfied ones. I remember loosing many hours on more than one 
occasion while trying to solve some settings issue. I am afraid of touching 
any settings because of these bad memories.

Many things are impossible or prohibited because of this. There is no way 
user can load and unload plugins without restart. Python is dynamic 
language and there should be no problem to allow this. In almost all other 
editors plugins are downloaded from the internet, installed and switched on 
and off with the single click. Leo users can't possibly dream about such a 
feature mainly because of the way Leo handles its settings.

Switching the theme is impossible without restart.

*What can we do about it?*

After editing settings in the myLeoSettings.leo or any other settings 
outline, user should invoke a command to save settings. This command can be 
executed automatically on each save. This command would read settings from 
the outline and build settings dict as it is now done during the startup 
code. The result set of settings can be stored in g.app.db for the next 
run. During the startup settings can be retrieved from the g.app.db in one 
line. This would require the least changes in Leo's code. However there 
might be even a better scheme. Store each setting in the db table with the 
following columns:
(name, level, filename, type, value) where primary key is (name, level, 
filename).
Then c.config.get can be changed to execute simple query from the 
database selecting the value at the highest level for this outline. Leo's 
defaults defined in leoSettings.leo should have level=0, myLeoSettings.leo 
- level=1 and all other outlines should have level=2. 
I remember an experiment to test whether accessing settings from db would 
slow down Leo and result was that sqlite3 database would outperform Leo's 
present config machinery. 

Now, adjusting  any setting would be as easy as executing a simple SQL 
command. Calling afterwards c.reloadSettings should apply new setting value 
immediately without any trouble. 

There will be no problems related to what is read before and what is read 
after because already compiled set of settings will be present from the 
early start. And if a user wishes to change some setting it can be done at 
any moment, and the result of this change will be preserved for the next 
run too.

*Summary*

IMHO your idea of having global settings is not bad at all. The only thing 
I would change is not keeping it in an .ini file, but instead in the 
sqlite3 database, so we get parsing, querying, persistence for free.
This idea conflicts with the way Leo handles settings now. To resolve the 
conflict, you should change the way Leo handles settings now and it would 
simplify many parts of Leo's code base.

Vitalije

PS: I would gladly help with the necessary changes.

On Saturday, August 24, 2019 at 1:50:12 PM UTC+2, Edward K. Ream wrote:
>
> I've just killed #1298 
>  and #1301 
> . #1298 suggests 
> using a .ini file.  #1301 suggests replacing @string theme-name with an 
> *implicit* setting in g.app.db.
>
> Both were my ideas.  Both are truly wretched. Each would complicate how 
> Leo handles settings. Each would confuse newbies and 

Re: I've just killed two issues

2019-08-24 Thread Matt Wilkie
It's too bad there's no obvious path forward. Maybe one will present itself 
eventually as we dwell here longer. Good that increased complication 
without clear gain has been avoided though!

-matt

-- 
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/97341af5-d461-41c5-a1e8-a5d758ef23fb%40googlegroups.com.


Re: locate one node by it's path via leoBridge

2019-08-24 Thread Austin(Xu) Wang
thanks vitalije for the instruction. much appreciated. 

On Saturday, August 24, 2019 at 4:00:21 PM UTC+7, vitalije wrote:
>
> You can try the following:
> def get_child_headlines(c, address):
> return g.recursiveUNLSearch(address.split('-->'), c)
>
> You can find nodes even faster if you know their gnx (you can obtain a gnx 
> value by using p.gnx or v.gnx). 
> def get_node(c, gnx):
> return c.fileCommands.gnxDict.get(gnx)
>
> def get_body_and_headline(c, gnx):
> v = get_node(gnx)
> return v.h, v.b
>
> I assume that you have obtained the address of the 
> node "IT-->Leo-->Writing Plugin-->Display Message" by copying it from the 
> status line in Leo window. If you want to copy gnx of some node you can do 
> this using the following script.
> g.app.gui.replaceClipboardWith(p.gnx)
>
> This script you can make a button of it and then when you want to copy gnx 
> of some node, just select it and click the button.
>
> HTH Vitalije
>
>
>
> On Saturday, August 24, 2019 at 9:07:44 AM UTC+2, Austin(Xu) Wang wrote:
>>
>>
>> I realized  get_headline ("IT-->Leo-->Writing Plugin-->Display Message") 
>> is with no sense..
>>
>> What I want is:
>>
>> - get_child_headlines ("IT-->Leo-->Writing Plugin-->Display Message")
>>   # return a list of headlines for each child node.
>> - get_body ("IT-->Leo-->Writing Plugin-->Display Message")
>># return the body text
>>
>>
>> On Saturday, August 24, 2019 at 12:46:07 PM UTC+7, Austin(Xu) Wang wrote:
>>>
>>> Dear Leo User,
>>>
>>> I want to access the headline and body of a specific node inside that 
>>> file using the leoBridge interface.
>>> Is it possible to get the body and headline from the path of that node?
>>>
>>> For example, for one node with headline "Display Message":
>>> /Users/wangxu/Documents/Leo/austin.leo#IT-->Leo-->Writing 
>>> Plugin-->Display Message
>>>
>>> Is it doable to implement function:
>>> - get_headline ("IT-->Leo-->Writing Plugin-->Display Message")
>>> - get_body ("IT-->Leo-->Writing Plugin-->Display Message")
>>>
>>> Please guide me on this..
>>>
>>> BR,Austin
>>>
>>

-- 
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/0c0c0762-06e0-4b8f-a607-8dd57880b7b2%40googlegroups.com.


Re: locate one node by it's path via leoBridge

2019-08-24 Thread vitalije
You can try the following:
def get_child_headlines(c, address):
return g.recursiveUNLSearch(address.split('-->'), c)

You can find nodes even faster if you know their gnx (you can obtain a gnx 
value by using p.gnx or v.gnx). 
def get_node(c, gnx):
return c.fileCommands.gnxDict.get(gnx)

def get_body_and_headline(c, gnx):
v = get_node(gnx)
return v.h, v.b

I assume that you have obtained the address of the node "IT-->Leo-->Writing 
Plugin-->Display Message" by copying it from the status line in Leo window. 
If you want to copy gnx of some node you can do this using the following 
script.
g.app.gui.replaceClipboardWith(p.gnx)

This script you can make a button of it and then when you want to copy gnx 
of some node, just select it and click the button.

HTH Vitalije



On Saturday, August 24, 2019 at 9:07:44 AM UTC+2, Austin(Xu) Wang wrote:
>
>
> I realized  get_headline ("IT-->Leo-->Writing Plugin-->Display Message") 
> is with no sense..
>
> What I want is:
>
> - get_child_headlines ("IT-->Leo-->Writing Plugin-->Display Message")  
> # return a list of headlines for each child node.
> - get_body ("IT-->Leo-->Writing Plugin-->Display Message")
># return the body text
>
>
> On Saturday, August 24, 2019 at 12:46:07 PM UTC+7, Austin(Xu) Wang wrote:
>>
>> Dear Leo User,
>>
>> I want to access the headline and body of a specific node inside that 
>> file using the leoBridge interface.
>> Is it possible to get the body and headline from the path of that node?
>>
>> For example, for one node with headline "Display Message":
>> /Users/wangxu/Documents/Leo/austin.leo#IT-->Leo-->Writing 
>> Plugin-->Display Message
>>
>> Is it doable to implement function:
>> - get_headline ("IT-->Leo-->Writing Plugin-->Display Message")
>> - get_body ("IT-->Leo-->Writing Plugin-->Display Message")
>>
>> Please guide me on this..
>>
>> BR,Austin
>>
>

-- 
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/cbe4e8e3-4961-40be-9e24-d7f119484c67%40googlegroups.com.


Re: locate one node by it's path via leoBridge

2019-08-24 Thread Austin(Xu) Wang

I realized  get_headline ("IT-->Leo-->Writing Plugin-->Display Message") is 
with no sense..

What I want is:

- get_child_headlines ("IT-->Leo-->Writing Plugin-->Display Message")  
# return a list of headlines for each child node.
- get_body ("IT-->Leo-->Writing Plugin-->Display Message")  
 # return the body text


On Saturday, August 24, 2019 at 12:46:07 PM UTC+7, Austin(Xu) Wang wrote:
>
> Dear Leo User,
>
> I want to access the headline and body of a specific node inside that file 
> using the leoBridge interface.
> Is it possible to get the body and headline from the path of that node?
>
> For example, for one node with headline "Display Message":
> /Users/wangxu/Documents/Leo/austin.leo#IT-->Leo-->Writing Plugin-->Display 
> Message
>
> Is it doable to implement function:
> - get_headline ("IT-->Leo-->Writing Plugin-->Display Message")
> - get_body ("IT-->Leo-->Writing Plugin-->Display Message")
>
> Please guide me on this..
>
> BR,Austin
>

-- 
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/b109022c-9247-422e-8a81-14e89f164222%40googlegroups.com.