[Python-mode] edit or navigate code by feature

Andreas Röhler andreas.roehler at online.de
Mon Jun 27 09:07:15 CEST 2011


Am 26.06.2011 21:44, schrieb Andreas Röhler:
> [ ... ]
>> notation: Spoken -- Emacs -- results
>>
>> given a line like:
>>
>> self.calories = self.calories + food_record["calories"]*grams
>> ^
>> ^ = cursor position
>>
>> "get method" -- (result-to-knp(ar-method-copy-apt)) -- returns copy of
>> method name and places it in the cut and paste buffer (is region defined
>> here?).
>>

py-copy-of-def-or-class will do that. Region is marked than.
Will put alias `py-copy-method' onto that.

Would you want to get the whole class too, when below a class and above 
a method definition?

Understand strictly speaking "method" only inside a class.
However, for your purposes, if cursor is between the opening of a class 
and its first method, dealing with class variables for example, "get 
method" would cover the whole class. Thats the question so far.

BTW what about return values? Is it good enough as 
`py-copy-of-def-or-class' does? Would an explicit sending of the 
beginning and and of the region then be of interest?

Cheers,

Andreas



More information about the Python-mode mailing list