Re: All pygments work is in devel

2019-03-28 Thread Matt Wilkie

>
> I did a major change  to a file under an @clean node (it was almost empty 
> and I copied medium size file over it externally), Leo asked to reload, but 
> the content did not change until I forced Leo to re-read from disk. I have 
> never seen this behaviour before.
>

Sounds similar to https://github.com/leo-editor/leo-editor/issues/1100. 

Oh! it's been updated. I have testing work to do ;-)

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 post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: All pygments work is in devel

2019-03-28 Thread Josef


>
> Leo directives are not  always being colored any more (@others, @language 
>> makefile)
>>
>
> I'll need more details. Everything seems to work for me.
>

In nodes under @language latex @others does not always seem to be colored, 
using pygments.

I won't be able to do any tests until after 10 April, though.

- Josef

-- 
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 post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: All pygments work is in devel

2019-03-27 Thread Edward K. Ream
On Tue, Mar 26, 2019 at 11:06 AM Josef  wrote:

> Great work Edward!
>

Glad you like it.

Leo directives are not  always being colored any more (@others, @language
> makefile)
>

I'll need more details. Everything seems to work for me.

Rev 8555f9e0 colors only known languages in @language directives.

I did a major change  to a file under an @clean node (it was almost empty
> and I copied medium size file over it externally), Leo asked to reload, but
> the content did not change until I forced Leo to re-read from disk. I have
> never seen this behaviour before.
>

I have seen something similar when switching between git branches. @clean
has its limits, and major changes are best dealt with using
refresh-from-disk.

Feel free to file an issue for this, if one does not already exist.
However, it is unlikely that anything can be done--the issue will likely be
labeled "Won't Fix".

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 post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: All pygments work is in devel

2019-03-26 Thread Josef
Great work Edward!

the latex coloring is now much better!

I have seen some inconsistencies, though:

Leo directives are not  always being colored any more (@others, @language 
makefile)

Btw. when importing a "Makefile" leo places @language unknown_language, 
instead of @language makefile - but this is ony a minor nuisance and 
nothing new.

I did a major change  to a file under an @clean node (it was almost empty 
and I copied medium size file over it externally), Leo asked to reload, but 
the content did not change until I forced Leo to re-read from disk. I have 
never seen this behaviour before.

- Josef

-- 
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 post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: All pygments work is in devel

2019-03-25 Thread Edward K. Ream
​
On Mon, Mar 25, 2019 at 12:41 PM Edward K. Ream  wrote:

- Previously, I wondered whether it would be possible to add Leonine 
> coloring rules to *all* standard pygments lexers. Here's how, modulo 
> error handling:
>
> def patch_lexer(self, language, lexer):
>
> class PatchedLexer(lexer.__class__):
> tokens = { ​​<< new rules >> }
>
> return PatchedLexer()
>
> Deriving from lexer.__class__ demonstrates *python's* power. 
>

​Looking closer at ​the new rules, we see *pygments' *power.  The rules 
have the form:

<< list of regular expressions >>,
inherit,

I have no idea how "inherit" works.  The beauty is that typical pygments 
devs don't need to know.

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 post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: All pygments work is in devel

2019-03-25 Thread Edward K. Ream
On Monday, March 25, 2019 at 7:18:27 AM UTC-5, john lunzer wrote:

Thank you for this. Sorry that it was kind of a let down beyond 
> colorization for more languages.
>

As I said, I'm glad I did this project:

- Technically, it was a big step forward, and it turned out to be 
surprisingly straightforward.

- Previously, I wondered whether it would be possible to add Leonine 
coloring rules to *all* standard pygments lexers. Here's how, modulo error 
handling:

def patch_lexer(self, language, lexer):

class PatchedLexer(lexer.__class__):
tokens = { << new rules >> }

return PatchedLexer()

Deriving from lexer.__class__ demonstrates *python's* power. It's a big 
deal, and it probably should be part of pygments' docs.

- I understand pygments well enough, from *Leo's* point of view. It was a 
big Aha that Leo's settings could completely replace pygments styles, which 
don't seem all that clever to me.

- How pygments handles non-standard tokens is still a mystery to me.  To be 
safe, Leo catches exceptions in leo_h._get_format_from_style, something 
that Jupyter's code did not do.  This try/except statement is something 
that bothers me, but for now it's there for safety.

- pyg_c.mainLoop fixes apparent bugs in the Jupyter code, and does so 
elegantly.

In short, pygments will help some users, and was personally fulfilling.  I 
can't ask for more than that.

Edward

P. S. Completing this project may take a day or two more:

- At present, Leo uses the default font/color dicts in leoColorizer.py to 
determine what settings should be examined.  But that can't be exactly 
right.  Theoretically, @data extra-pygments-tokens might be needed, but I 
suspect Leo won't need this any time soon.

- In any case, *all* standard pygments tokens should be present in the 
default font/color dicts.

EKR

-- 
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 post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: All pygments work is in devel

2019-03-25 Thread Edward K. Ream
On Mon, Mar 25, 2019 at 8:37 AM lewis  wrote:

> Yes, that's fixed.
>

Thanks for the confirmation.

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 post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: All pygments work is in devel

2019-03-25 Thread lewis
Yes, that's fixed.

Thanks
Lewis

-- 
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 post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: All pygments work is in devel

2019-03-25 Thread Edward K. Ream
On Monday, March 25, 2019 at 8:09:25 AM UTC-5, lewis wrote:
>
> Leo launches but if I copy text ctrl-c and then ctrl-v it crashes 
> immediately.
>

Fixed at rev 884082b2 in devel.

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 post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: All pygments work is in devel

2019-03-25 Thread Edward K. Ream
On Monday, March 25, 2019 at 8:09:25 AM UTC-5, lewis wrote:

Leo launches but if I copy text ctrl-c and then ctrl-v it crashes 
> immediately.
>
>
>
>
>
>
> *Leo Log WindowLeo 5.8.1-b2 devel, build 20190227233831, Wed Feb 27 
> 23:38:31 PST 2019Git repo info: branch = devel, commit = 95ef89bc33b6Python 
> 3.7.2, PyQt version 5.12.2Windows 10 AMD64 (build 10.0.17134) SP0isPython3: 
> True*
>
> *[snip]*
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> *extractExecutableString rest pythonget_lexer  no lexer for 
> 'plain'get_lexer CREATED default lexer for python:  'pygments.lexers.python.Python3Lexer'>patch_lexer can not patch 
> 'plain'Traceback (most recent call last):  File 
> "N:\git\leo-editor\leo\core\leoColorizer.py", line 2501, in patch_lexer
> return PatchedLexer()TypeError: __new__() missing 3 required positional 
> arguments: 'name', 'bases', and 'd'Traceback (most recent call last):  File 
> "N:\git\leo-editor\leo\core\leoColorizer.py", line 2160, in 
> highlightBlockself.colorizer.recolor(s)  File 
> "N:\git\leo-editor\leo\core\leoColorizer.py", line 2549, in recolor
> self.mainLoop(s)  File "N:\git\leo-editor\leo\core\leoColorizer.py", line 
> 2411, in mainLoopfor token, text in lexer.get_tokens(s):TypeError: 
> get_tokens() missing 1 required positional argument: 'text'*
> [end of log in console]
>

Weird.  I didn't get the full message in my email.

Clearly, the problem is the missing parser for @language plain.  I'll fix 
this immediately.

This happens in PygmentsColorizer.mainLoop, so it can't happen when @bool 
use-pygments is False.

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 post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: All pygments work is in devel

2019-03-25 Thread lewis
And here is the console log with leo running. I haven't done ctrl-v yet.



















*N:\git\leo-editor>launchleo.pyEmpty setting name in Falseset parent 
@settingsextractExecutableString rest restextractExecutableString rest 
pythonextractExecutableString rest restextractExecutableString rest 
pythonLeo 5.8.1-b2 devel, build 20190227233831, Wed Feb 27 23:38:31 PST 
2019livecode.py: can not import metapip install metarss.py: can not import 
feedparserlivecode.py: can not import metapip install 
metaextractExecutableString rest restextractExecutableString rest 
pythonextractExecutableString rest restextractExecutableString rest python*

-- 
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 post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: All pygments work is in devel

2019-03-25 Thread lewis
Here is full leo log:

Leo Log Window
Leo 5.8.1-b2 devel, build 20190227233831, Wed Feb 27 23:38:31 PST 2019
Git repo info: branch = devel, commit = 95ef89bc33b6
Python 3.7.2, PyQt version 5.12.2
Windows 10 AMD64 (build 10.0.17134) SP0
isPython3: True
current dir: N:/git/leo-editor
load dir: N:/git/leo-editor/leo/core
global config dir: N:/git/leo-editor/leo/config
home dir: C:/Users/lewis
reading settings in N:/git/leo-editor/leo/config/leoSettings.leo
reading settings in C:/Users/lewis/.leo/myLeoSettings.leo
Empty setting name in False
reading settings in C:/Users/lewis/.leo/LeoBlackGraySolarized.leo
livecode.py: can not import meta
pip install meta
http serving enabled at 127.0.0.1:8130
Module 'feedparser' not installed. Plugin rss.py not loaded.
reading settings in C:/Users/lewis/.leo/workbook.leo
livecode.py: can not import meta
pip install meta
Module 'feedparser' not installed. Plugin rss.py not loaded.
read outline in 0.16 seconds

-- 
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 post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: All pygments work is in devel

2019-03-25 Thread lewis
In myLeoSettings file I have 
*@bool use-pygments = True*

-- 
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 post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: All pygments work is in devel

2019-03-25 Thread Edward K. Ream
On Mon, Mar 25, 2019 at 8:09 AM lewis  wrote:

> Leo launches but if I copy text ctrl-c and then ctrl-v it crashes
> immediately.
>

Works for me on a similar system, regardless of @bool use-pygments.
Please run Leo from a console and report the full log and console.

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 post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: All pygments work is in devel

2019-03-25 Thread lewis
Leo launches but if I copy text ctrl-c and then ctrl-v it crashes 
immediately.






*Leo Log WindowLeo 5.8.1-b2 devel, build 20190227233831, Wed Feb 27 
23:38:31 PST 2019Git repo info: branch = devel, commit = 95ef89bc33b6Python 
3.7.2, PyQt version 5.12.2Windows 10 AMD64 (build 10.0.17134) SP0isPython3: 
True*

Regards
Lewis

On Monday, March 25, 2019 at 10:23:16 PM UTC+11, Edward K. Ream wrote:
>
> I should add that by default everything should work *exactly* as before.  
> If not, please report a bug.
>
> *- *@bool use-pygments is False in leoSettings.leo.
>

-- 
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 post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: All pygments work is in devel

2019-03-25 Thread john lunzer
Thank you for this. Sorry that it was kind of a let down beyond 
colorization for more languages.

On Monday, March 25, 2019 at 7:13:29 AM UTC-4, Edward K. Ream wrote:
>
> I plan no further work on this project.  Please report any problems 
> immediately.
>
> *Summary of this project*
>
> This project is technically useful and interesting.  I'm glad I did it.
>
> Using pygments (*@bool use-pygments = True*) makes syntax coloring 
> available for many more languages.
>
> Bypassing pygments' styles machinery (*@bool use-pygments-styles = False*) 
> allows much more flexible configuration *of pygments *using Leo's @color 
> settings.
>
> At long last, @color settings may now use any symbolic name appearing in 
> Leo's color base in leoColor.py.  Leo normalizes setting names, so 
> Solarized-Red means solarizedred.
>
> It's been a busy week. According to the checkin logs, work began last 
> Tuesday, March 19.
>
> 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 post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.


Re: All pygments work is in devel

2019-03-25 Thread Edward K. Ream
On Monday, March 25, 2019 at 6:13:29 AM UTC-5, Edward K. Ream wrote:

> I plan no further work on this project.

I should add that by default everything should work *exactly* as before.  
If not, please report a bug.

*- *@bool use-pygments is False in leoSettings.leo.
- All old @color settings should continue to work.

However, you may now use symbolic names for @color settings, if you like.
 
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 post to this group, send email to leo-editor@googlegroups.com.
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.