My main reaction is to make sure that Leo's read behavior remains backwards 
compatible with the pre-black sentinel format. People with much older 
outlines should be able to open them for the indefinite future.  It's also 
possible that there is some user code that does something with sentinels 
and assumes there will be no space after the leading '#' character.  So 
perhaps the  *--black-sentinels** command line option* should remain in 
reverse:  *--black-sentinels**=False * would be allowed but not be the 
default .

With this proviso, the proposal seems sensible.

On Saturday, November 25, 2023 at 4:52:05 PM UTC-5 Edward K. Ream wrote:

> Issue #3657 <https://github.com/leo-editor/leo-editor/issues/3657> suggests 
> that Leo should *always *write black-compatible sentinel lines. Leo would 
> no longer need the *--black-sentinels* command line option.
>
>
> This post discusses this proposal and asks for your comments.
>
>
> *Background*
>
>
> Black <https://pypi.org/project/black/> adds a space between the # and @ 
> at the start of Leo's sentinel comments, treating such comments according 
> to the PEP8 <https://peps.python.org/pep-0008/> guidelines for inline 
> comments <https://peps.python.org/pep-0008/#inline-comments>.
>
>
> As a result, *Black will continually reformat Leo's external files* unless 
> the --black-sentinels command line option was in effect when Leo wrote the 
> external files.
>
>
> The Black devs do not appear interested in treating Leo's sentinels as 
> exceptions!
>
>
> *Compatibility*
>
>
> For at least the last several years, Leo has been able to read external 
> files containing "blackened" comments. I know of no significant 
> compatibility issues.
>
>
> *Summary*
>
>
> Like it or not, Black is the de-facto standard for formatting Python 
> programs. The Ruff Format 
> <https://github.com/astral-sh/ruff/blob/main/crates/ruff_python_formatter/README.md>
>  tool 
> emulates Black's operation.
>
>
> Imo, Leo should *always *write Black-compatible sentinels. Doing so will 
> remove a reason for not using Leo! 
>
>
> Leonine projects (including Leo!) will notice large diffs when Leo 
> converts sentinel comments to the Black-compatible format. These diffs are 
> a *one-time* cost of this proposal.
>
>
> Afaik, this proposal has no other negative consequences.
>
>
> Your comments, please.
>
>
> 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/929a5386-9ce7-4403-8431-29d79ad027dcn%40googlegroups.com.

Reply via email to