Discuss: Leo should write black-compatible sentinels

18 views
Skip to first unread message

Edward K. Ream

unread,
Sep 19, 2021, 8:04:43 AM9/19/21
to leo-editor
For at least two years Leo has been able to read external files formatted with black.

Indeed, black will change the format of Leo's sentinel lines, inserting two spaces between the comment delimiter and the `@` that signals the start of a sentinel comment.

Imo, starting with Leo 6.5,  Leo should write sentinel comments so that black will not reformat sentinel comments. This change will make it possible to make black the default formatting standard for Leo's own code base.

Compatibility

Most Leonistas will hardly notice such a change. However, I have waited until now because ancient versions of Leo will not be able to read external files written by Leo 6.5.  I don't think that matters. Nobody using an old version of Leo is likely to want to read an external file written by Leo 6.5.

Summary

Writing black-compatible sentinels will simplify beautifying Leo's own code base.

Please let me know if you can think of a plausible situation in which writing black-compatible sentinels will cause a problem.

I have just created #2194 for this issue.

Edward

tbp1...@gmail.com

unread,
Sep 19, 2021, 8:56:16 AM9/19/21
to leo-editor
IMO, this capability should be fairly robust.  Here I'm thinking of the number of spaces between the leading "#" character and the first "@" character.  I would prefer that Leo not be sensitive to whether there are exactly two such spaces.  I wonder if there is ever any case where someone deliberately inserts a leading space before an "@" character, possibly to disable it (instead of, e.g., writing "@@" or "#@").

Edward K. Ream

unread,
Sep 19, 2021, 9:40:48 AM9/19/21
to leo-editor
On Sun, Sep 19, 2021 at 7:56 AM tbp1...@gmail.com <tbp1...@gmail.com> wrote:

IMO, this capability should be fairly robust. 

I agree, but this extra "robustness" comes with a (hopefully small) compatibility cost.

I wonder if there is ever any case where someone deliberately inserts a leading space before an "@" character, possibly to disable it (instead of, e.g., writing "@@" or "#@").

Any such munging would be foolish. Leo is under no obligation to load such adulterated files.

Edward
Reply all
Reply to author
Forward
0 new messages