Renaming variables to bring them into pep8 "compliance" is often a terrible
idea. It can instantly ruin code.
But last week, when creating the V2 scanners, I wanted to use
under_score_names to denote new code in place of camelCaseNames. This was
important protection against accidentally changing the wrong code.
The @@button pep8 @key=Ctrl-5 node in scripts made this easy to do
*selectively*, on a name-by-name basis.
As of rev 1e0e97c, the docstring is:
'''
Undoably converts the word at the cursor to pep8 style throughout a given
tree.
Also sets the find text to the new word.
'''
When this @button script is enabled, I would simply select a name I wanted
to convert and hit Ctrl-5. The selected tree was the *new* code (a copy of
the old), so there was little danger.
This saved a lot of wear and tear on my hands.
Edward
P. S. A cute point:
c.findCommands.ftm.setFindText(new_name)
sets the find text to the new name so I could easily check what the button
did.
This is useful enough that the c.findCommands instance should redirect
setFindText to ftm.setFindText. Ditto for setReplaceText. Script writers
shouldn't have to know about the ftm instance. It's on the list.
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.