Python mode - `C-c |' feature suggestion

François Pinard pinard at iro.umontreal.ca
Tue Feb 22 15:40:38 CET 2000


Hi, people.  I just wanted to move the three lines defining `once_matcher',
below, into a Python interactive buffer, to play with:

    [...]
    # Vérifier la syntaxe des programmes Perl.
    if syntax:
        once_matcher = re.compile(
            'Name "main::([^"]+)" used only once:'
            ' possible typo at ({^ ]+) line ([0-9]+)').match
        sys.stdout.write(separator)
        sys.stdout.write("Vérification syntaxique des scripts Perl\n")
    [...]

Putting the region around these three lines and doing `C-c |' yields a
syntax buffer, because of the indentation.  If I temporarily unindent
these three lines in the source buffer before doing `C-c |', it works.

My suggestion is that `C-c |' be made clever enough to discover the left
margin of the region under consideration, and that it removes that margin
while transmitting the region to the Python interpreter.  That would allow
for using that command in a much wider variety of (smaller :-) contexts.

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard






More information about the Python-list mailing list