On 6/27/2011 3:07 AM, Andreas Röhler wrote:
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?
Okay, I think I understand some of the trouble.
When I said something like "get method", I'm using a shorthand that I think you
would call "get method name". The vocal command for what you are describing
would be "get entire method". Using the totally fictitious method:
def simple_method (self, index, string, instance):
oil_type = string[3:7]
oil_level = self.tank [index]
lubricated_device = instance.motor
when I say "get entire method", I expect the entire method to be returned. when
I say:
"get method" Return one of the following (tank, motor).
"get instance" Return one of the following (self, instance).
"get method definition" Return the following name (simple_method)
"get first argument Return self if this command is used while the cursor is on
the same line as "simple_method"
"get index" returns one of the following (3:7, index)
slightly more complicated versions:
If the cursor sits on the word type of oil_type and I say "get index" it should
return a string "3:7" leaving mark at '3' and the cursor (point) after '7'.
From the same starting point, if I say "get next index", it should return the
word "index" leaving the mark on "i" and point after "x"
from the same starting point, if I say "get last argument" it should return the
word "instance" leaving mark on'i' of instance and point after the 'n'
I am on the fence about whether or not to return information or strictly use
these new routines to mark a region and then use the region retrievals and
change functions. What do you think about that? I'm also missing some
pronounceable and unique shorthand names for other features.
--- eric
_______________________________________________
Python-mode mailing list
Python-mode@python.org
http://mail.python.org/mailman/listinfo/python-mode