Re: Leo's new beautifier: progress report

2020-02-13 Thread Edward K. Ream
On Thu, Feb 13, 2020 at 4:02 AM Edward K. Ream  wrote:

> ...it should be pretty safe to try out the new beautify-files command.

There is a problem with @doc and @ sections.

Leo uses a too-clever-by-half convention for determining whether blank
lines in such sections are "real". At present, beautifying a file destroys
that info. It will probably be possible to save some new state to deal with
this, but I haven't done so yet.

Another known bug: -1 sometimes gets formatted as - 1. This will likely be
fixed by consulting the ast node corresponding to one or more tokens.
Failing unit tests cover this bug.

A recent rev fixed a nasty bug: beautifying files would insert too many
blank lines at the end of the file. The result, within Leo, were unwanted
@last directives.

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/CAMF8tS2jZzJuxVxqXA3THu_sijbiF0nd4NvyqOBN5GsrRCR1Xw%40mail.gmail.com.


Re: Leo's new beautifier: progress report

2020-02-13 Thread Edward K. Ream
On Wednesday, February 12, 2020 at 6:23:45 AM UTC-6, Edward K. Ream wrote:

As of rev f8fc59 it should be pretty safe to try out the new beautify-files 
> command. Again, make sure you have backups of any to-be-beautified file. 
>

Still true.

I have beautified all of Leo's files in the fstrings branch. This revealed 
several minor bugs which will be fixed soon.

More importantly, I saw that splitting and joining lines involve subtle 
matters of policy that I had not considered at all. For now, my preference 
is *never* to join lines.

For example, when I have taken the trouble to call or def arguments on 
separate lines, I see no reason to undo that just because they actually 
could fit on a single line. It's not as if anyone is going to print the 
code, so "saving" lines makes no sense.

*Summary*

I'll check in the changes to devel when I have beautified and fstringified 
all of Leo's files to my satisfaction. This will likely take a day or two.

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/4893a3cc-fb80-4298-85bf-e64e681f6100%40googlegroups.com.


Re: Leo's new beautifier: progress report

2020-02-12 Thread Edward K. Ream
On Tuesday, February 11, 2020 at 7:02:02 AM UTC-6, Edward K. Ream wrote:

[Monday] the beautify-files command passed a major milestone: all of Leo's 
> core files compile without syntax errors after being beautified :-)
>

As of rev f8fc59 it should be pretty safe to try out the new beautify-files 
command. Again, make sure you have backups of any to-be-beautified file. 

Yesterday's problems arose from the code that supports @nobeautify.  Rev 
f8fc59 fixes those problems, with just 6 lines of code. All files in 
LeoPyRef.leo beautify without (apparent) problems, and all unit tests pass 
on the beautified files.

I won't ever blindly check in beautified files. Unit tests do not suffice 
to give sufficient confidence. Instead, I'll carefully examine the diffs. 
I'll also ensure that beautifying each file a second time introduces no new 
changes.

*Summary*

The beautify-files and diff-beautify-files are ready for careful testing. 
Back up your files first.

These commands know about Leo sentinels, that is, Leo's outline structure 
and directives.

Support for @beautify/@nobeautify (#pragma: beautify / #pragma: nobeautify) 
is a feature that black lacks. It would likely be difficult for the black 
devs to add similar features.

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/bdea0c11-c9c7-4d4b-ba25-5a7b0ddbdf44%40googlegroups.com.


Re: Leo's new beautifier: progress report

2020-02-11 Thread Edward K. Ream
On Tue, Feb 11, 2020 at 7:02 AM Edward K. Ream  wrote:

Yesterday the beautify-files command passed a major milestone: all of Leo's
> core files compile without syntax errors after being beautified :-)
>

That's no longer true, if it ever was. I'll let you know when I can
recommend using beautify-files.

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/CAMF8tS27BX%3DYVAdKYd%2BfPk6e-b_ZBj%3DFYt_cHErgzqX1Cr9A9w%40mail.gmail.com.