From romand.ne at gmail.com Wed Jun 8 16:16:05 2011 From: romand.ne at gmail.com (Roman Dzvinkovsky) Date: Wed, 8 Jun 2011 15:16:05 +0100 Subject: [Python-mode] py-master-file behavior doesn't work Message-ID: Hi, even when I set py-master-file variable locally in python buffer, py-execute-buffer and others still use temporary file, so I can't see context in IPython. Is it broken or I do something wrong? Thanks in advance, Roman. -------------- next part -------------- An HTML attachment was scrubbed... URL: From andreas.roehler at online.de Thu Jun 9 08:38:16 2011 From: andreas.roehler at online.de (=?ISO-8859-1?Q?Andreas_R=F6hler?=) Date: Thu, 09 Jun 2011 08:38:16 +0200 Subject: [Python-mode] py-master-file behavior doesn't work In-Reply-To: References: Message-ID: <4DF06A58.8050403@online.de> Am 08.06.2011 16:16, schrieb Roman Dzvinkovsky: > Hi, > > even when I set py-master-file variable locally in python buffer, > py-execute-buffer and others still use temporary file, so I can't see > context in IPython. > Is it broken or I do something wrong? > > Thanks in advance, > Roman. > Thanks for the report. Made an entry in the bug-tracker at https://bugs.launchpad.net/python-mode/+bug/794850 Please consider subscribing there in order to get upcoming discussions. Could you try the patch against py-execute-region? (IMO exists a respective bug still at py-execute-import-or-reload.) ;;;;;;;;;;; === modified file 'python-mode.el' --- python-mode.el 2011-05-27 06:58:43 +0000 +++ python-mode.el 2011-06-09 05:38:38 +0000 @@ -1889,9 +1889,11 @@ (let* ((filename (expand-file-name py-master-file)) (buffer (or (get-file-buffer filename) (find-file-noselect filename)))) - (set-buffer buffer))) - (py-execute-region (point-min) (point-max) async) - (pop-to-buffer old-buffer))) + (set-buffer buffer) + (py-execute-region (point-min) (point-max) async) + (pop-to-buffer old-buffer)) + (py-execute-region (point-min) (point-max) async) + (pop-to-buffer old-buffer)))) (defun py-execute-import-or-reload (&optional async) "Import the current buffer's file in a Python interpreter. ;;;;;;;;;;; From code at familjenjonsson.org Sat Jun 11 18:40:50 2011 From: code at familjenjonsson.org (Patrik Jonsson) Date: Sat, 11 Jun 2011 12:40:50 -0400 Subject: [Python-mode] python-mode 5.1.0aq; Within a triple-quoted string, python-mode switches out of string mode for single quotes Message-ID: Dear Barry, Within a multi-line string, using quotes switches out of string mode. This can cause the remainder of the code to end up in string-mode. Try either of these: s=""" a semi-quoted "string inside the string switches syntax highlighting out of string mode and when the string really ends, real code ends up in string-mode""" def func_highlighted_as_string(): a=1 t=""" It also interprets a "string with # in it" as an unbalanced-quote # since it thinks the hash mark is # an actual comment""" Emacs : GNU Emacs 23.2.50.1 (i386-apple-darwin9.8.0, NS apple-appkit-949.54) of 2010-08-18 on braeburn.aquamacs.org - Aquamacs Distribution 2.1 Package: python-mode 5.1.0aq current state: ============== (setq py-python-command "python" py-indent-offset 4 py-block-comment-prefix "##" py-temp-directory "/var/folders/oA/oAy-YWg-FoSh1QxGzAILA++++TI/-Tmp-/" py-beep-if-tab-change t ) -------------- next part -------------- An HTML attachment was scrubbed... URL: From barry at python.org Mon Jun 13 23:07:44 2011 From: barry at python.org (Barry Warsaw) Date: Mon, 13 Jun 2011 17:07:44 -0400 Subject: [Python-mode] execfile In-Reply-To: <4DD6536C.3020309@online.de> References: <4DD6536C.3020309@online.de> Message-ID: <20110613170744.7d7a5654@neurotica.wooz.org> On May 20, 2011, at 01:41 PM, Andreas R?hler wrote: >think we should get the execfile issue fixed with next release too. Definitely. Sorry for letting this one get buried in my inbox, but I've now commented on the issue. >What about introducing a var indicating the python version the code is >intended to? +1 >In case that var isn't set, the python version which py-execute-region would >call, may be queried on the fly. > >Should I look for this? Yes please! python-mode.el should know whether the file it's visiting is Python 2 or Python 3, probably in a local variable which could be set automatically if you can find a decent clue (e.g. #!/usr/bin/python3). You might want to think of other ways to set this (file local variables, or auto-mode-alist perhaps?) Once you have that, then the mode can do all sorts of version-specific things, like doing different font-locking, or firing off a different Python shell, etc. In this specific case, you could run different Python code, as described in my bug comment. I think this would be a really valuable feature for python-mode.el. Cheers, -Barry -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: not available URL: From andreas.roehler at online.de Tue Jun 14 18:22:43 2011 From: andreas.roehler at online.de (=?UTF-8?B?QW5kcmVhcyBSw7ZobGVy?=) Date: Tue, 14 Jun 2011 18:22:43 +0200 Subject: [Python-mode] execfile In-Reply-To: <20110613170744.7d7a5654@neurotica.wooz.org> References: <4DD6536C.3020309@online.de> <20110613170744.7d7a5654@neurotica.wooz.org> Message-ID: <4DF78AD3.2090000@online.de> Am 13.06.2011 23:07, schrieb Barry Warsaw: > On May 20, 2011, at 01:41 PM, Andreas R?hler wrote: > >> think we should get the execfile issue fixed with next release too. > > Definitely. Sorry for letting this one get buried in my inbox, but I've now > commented on the issue. > >> What about introducing a var indicating the python version the code is >> intended to? > > +1 > >> In case that var isn't set, the python version which py-execute-region would >> call, may be queried on the fly. >> >> Should I look for this? > > Yes please! python-mode.el should know whether the file it's visiting is > Python 2 or Python 3, probably in a local variable which could be set > automatically if you can find a decent clue (e.g. #!/usr/bin/python3). You > might want to think of other ways to set this (file local variables, or > auto-mode-alist perhaps?) Once you have that, then the mode can do all sorts > of version-specific things, like doing different font-locking, or firing off a > different Python shell, etc. In this specific case, you could run different > Python code, as described in my bug comment. > > I think this would be a really valuable feature for python-mode.el. > > Cheers, > -Barry Hi Barry, should be a pleasure for me to proceed at this point. Just a thought in context: as people my run parallel different versions of python --locally or send something to remote machines-- there should be a way to specify the version to run. This would override the default version-check. Cheers, Andreas From barry at python.org Tue Jun 14 21:23:52 2011 From: barry at python.org (Barry Warsaw) Date: Tue, 14 Jun 2011 15:23:52 -0400 Subject: [Python-mode] execfile In-Reply-To: <4DF78AD3.2090000@online.de> References: <4DD6536C.3020309@online.de> <20110613170744.7d7a5654@neurotica.wooz.org> <4DF78AD3.2090000@online.de> Message-ID: <20110614152352.26d6fe53@neurotica.wooz.org> On Jun 14, 2011, at 06:22 PM, Andreas R?hler wrote: >should be a pleasure for me to proceed at this point. Fantastic! >Just a thought in context: as people my run parallel different versions of >python --locally or send something to remote machines-- there should be a way >to specify the version to run. > >This would override the default version-check. That would certainly be useful for *me* :). It's pretty typical that I want to run both Python 2 and 3 in different windows at the same time, but I could even imagine some folks might want to run Jython and Python 2, or even Python 2.6 and 2.7 and IronPython at the same time. If it's possible, there should be one default, with a fairly easy way to override on a case-by-case basis. Cheers, -Barry -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: not available URL: From andreas.roehler at online.de Fri Jun 17 08:34:24 2011 From: andreas.roehler at online.de (=?ISO-8859-1?Q?Andreas_R=F6hler?=) Date: Fri, 17 Jun 2011 08:34:24 +0200 Subject: [Python-mode] Fwd: Re: adding a standard font-lock-number-face Message-ID: <4DFAF570.6090301@online.de> Hi, would make a bug report/feature request for that. Opinions? Cheers, Andreas Am 17.06.2011 05:54, schrieb Fabian Ezequiel Gallina: > 2011/6/17 Stefan Monnier: >>> So long story short: isn't a good idea to add a standard >>> font-lock-number-face in order to have fine grained control on >>> font-lock and give the users the chance to customize numbers >>> decoration out of the box? >> >> I don't think highlighting tokens that are only lexically relevant but >> not syntactically relevant is a good idea. >> E.g. it's good to highlight keywords because they determine structure. >> It's good to highlight strings and comments because keywords within them >> *don't* determine structure. >> It's good to highlight identifier definitions because these are >> semantically important and they tend to be a bit like section titles, so >> syntactically meaningful. >> >> But it's not useful to highlight all identifiers, or all numbers, or all >> separators, or all infix operators, ... because that doesn't help the >> user navigate his code. >> > > Thanks for the clarification Stefan, I was pretty sure there was a > good reason why it wasn't there already. > > An argument I can think of for inclusion is that it seems highlighting > those kind of stuff (event operators) is really common on other > editors, so it is acceptable that people coming from other places > would expect this kind of stuff highlighted out-of-the-box. I know the > "people coming from other editors" argument is kinda weak, but I don't > see why not giving them the chance to enable that easily in a vanilla > Emacs. > > Please note that I'm no expert at font-locking but I think it might be > good (and possible) to let modes to specify a higher or special level > of font-locking so this kind of things can be highlighted. Let the > default be the standard Emacs way, but giving the users the chance to > enable that special level easily. This way standard font-lock > performance shouldn't be hit. > > What do you think? > > > Regards, Hi Fabian, don't know if my opinion here values a cent at all, :) but let me tell that IMO you are right. As long as the default set not differs ie inherits from default face, the user normally will not notice that customizable. OTOH user looking for will find it. Cheers, Andreas From barry at python.org Fri Jun 17 14:17:42 2011 From: barry at python.org (Barry Warsaw) Date: Fri, 17 Jun 2011 08:17:42 -0400 Subject: [Python-mode] adding a standard font-lock-number-face In-Reply-To: <4DFAF570.6090301@online.de> References: <4DFAF570.6090301@online.de> Message-ID: <20110617081742.7dd94fd9@neurotica.wooz.org> On Jun 17, 2011, at 08:34 AM, Andreas R?hler wrote: >would make a bug report/feature request for that. >Opinions? Personally, I think it's overkill. I agree that making the default indistinguishable would lessen the fruit salad look, but I wonder if it's really all that useful. I guess I would compromise by not adding any py-* faces to handle these. If there are already existing font-lock-* faces for these types of things, adding some regexps to recognize them in Python code would be okay, as long as performance doesn't suffer. Just my opinion though. -Barry > >Am 17.06.2011 05:54, schrieb Fabian Ezequiel Gallina: >> 2011/6/17 Stefan Monnier: >>>> So long story short: isn't a good idea to add a standard >>>> font-lock-number-face in order to have fine grained control on >>>> font-lock and give the users the chance to customize numbers >>>> decoration out of the box? >>> >>> I don't think highlighting tokens that are only lexically relevant but >>> not syntactically relevant is a good idea. >>> E.g. it's good to highlight keywords because they determine structure. >>> It's good to highlight strings and comments because keywords within them >>> *don't* determine structure. >>> It's good to highlight identifier definitions because these are >>> semantically important and they tend to be a bit like section titles, so >>> syntactically meaningful. >>> >>> But it's not useful to highlight all identifiers, or all numbers, or all >>> separators, or all infix operators, ... because that doesn't help the >>> user navigate his code. >>> >> >> Thanks for the clarification Stefan, I was pretty sure there was a >> good reason why it wasn't there already. >> >> An argument I can think of for inclusion is that it seems highlighting >> those kind of stuff (event operators) is really common on other >> editors, so it is acceptable that people coming from other places >> would expect this kind of stuff highlighted out-of-the-box. I know the >> "people coming from other editors" argument is kinda weak, but I don't >> see why not giving them the chance to enable that easily in a vanilla >> Emacs. >> >> Please note that I'm no expert at font-locking but I think it might be >> good (and possible) to let modes to specify a higher or special level >> of font-locking so this kind of things can be highlighted. Let the >> default be the standard Emacs way, but giving the users the chance to >> enable that special level easily. This way standard font-lock >> performance shouldn't be hit. >> >> What do you think? >> >> >> Regards, > >Hi Fabian, > >don't know if my opinion here values a cent at all, :) but let me tell >that IMO you are right. As long as the default set not differs ie >inherits from default face, the user normally will not notice that >customizable. > >OTOH user looking for will find it. > >Cheers, > >Andreas > > > -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: not available URL: From andreas.roehler at online.de Fri Jun 17 15:46:43 2011 From: andreas.roehler at online.de (=?UTF-8?B?QW5kcmVhcyBSw7ZobGVy?=) Date: Fri, 17 Jun 2011 15:46:43 +0200 Subject: [Python-mode] adding a standard font-lock-number-face In-Reply-To: <20110617081742.7dd94fd9@neurotica.wooz.org> References: <4DFAF570.6090301@online.de> <20110617081742.7dd94fd9@neurotica.wooz.org> Message-ID: <4DFB5AC3.8080804@online.de> Am 17.06.2011 14:17, schrieb Barry Warsaw: > On Jun 17, 2011, at 08:34 AM, Andreas R?hler wrote: > >> would make a bug report/feature request for that. >> Opinions? > > Personally, I think it's overkill. Agreed, will not use that. However, as the OP pointed at, users switching from other editors asked for. IMHO a similar thing as with intellisense, which isn't that useful as it looks nice. In some time we should have that too for the reasons above. I agree that making the default > indistinguishable would lessen the fruit salad look, but I wonder if it's > really all that useful. > > I guess I would compromise by not adding any py-* faces to handle these. If > there are already existing font-lock-* faces for these types of things, adding > some regexps to recognize them in Python code would be okay, as long as > performance doesn't suffer. > > Just my opinion though. > -Barry OK, that should be a path, Andreas > >> >> Am 17.06.2011 05:54, schrieb Fabian Ezequiel Gallina: >>> 2011/6/17 Stefan Monnier: >>>>> So long story short: isn't a good idea to add a standard >>>>> font-lock-number-face in order to have fine grained control on >>>>> font-lock and give the users the chance to customize numbers >>>>> decoration out of the box? >>>> >>>> I don't think highlighting tokens that are only lexically relevant but >>>> not syntactically relevant is a good idea. >>>> E.g. it's good to highlight keywords because they determine structure. >>>> It's good to highlight strings and comments because keywords within them >>>> *don't* determine structure. >>>> It's good to highlight identifier definitions because these are >>>> semantically important and they tend to be a bit like section titles, so >>>> syntactically meaningful. >>>> >>>> But it's not useful to highlight all identifiers, or all numbers, or all >>>> separators, or all infix operators, ... because that doesn't help the >>>> user navigate his code. >>>> >>> >>> Thanks for the clarification Stefan, I was pretty sure there was a >>> good reason why it wasn't there already. >>> >>> An argument I can think of for inclusion is that it seems highlighting >>> those kind of stuff (event operators) is really common on other >>> editors, so it is acceptable that people coming from other places >>> would expect this kind of stuff highlighted out-of-the-box. I know the >>> "people coming from other editors" argument is kinda weak, but I don't >>> see why not giving them the chance to enable that easily in a vanilla >>> Emacs. >>> >>> Please note that I'm no expert at font-locking but I think it might be >>> good (and possible) to let modes to specify a higher or special level >>> of font-locking so this kind of things can be highlighted. Let the >>> default be the standard Emacs way, but giving the users the chance to >>> enable that special level easily. This way standard font-lock >>> performance shouldn't be hit. >>> >>> What do you think? >>> >>> >>> Regards, >> >> Hi Fabian, >> >> don't know if my opinion here values a cent at all, :) but let me tell >> that IMO you are right. As long as the default set not differs ie >> inherits from default face, the user normally will not notice that >> customizable. >> >> OTOH user looking for will find it. >> >> Cheers, >> >> Andreas >> >> >> From esj at harvee.org Fri Jun 17 16:02:19 2011 From: esj at harvee.org (Eric S. Johansson) Date: Fri, 17 Jun 2011 10:02:19 -0400 Subject: [Python-mode] more speech driven how twos Message-ID: <4DFB5E6B.6070502@harvee.org> making more progress on some of the tools I need for speech or programming. Got a friend working with me on the variable management tool. Could use a few bits to help project along. 1) "Where am I." used to help resolve which transformation of an English name is used in a given context. Specifically, I'm looking for files/class/method information. Next variation of this "where am I." context is if I have an instance, what names are visible from that class defining that instance. Yes, yes I know all about ducktyping and how it has made people's lives completely miserable (mine at least. I really love a good strong type signature). I'm perfectly content to do my own transformation between instance and class and then ask about what's visible in the class. which raises the question of how does an external application query Emacs for data. 2) (Jump to|push to|get|change) [next | last] (instance|method|argument #|index|single [double] quotes|triple [double] quotes) These are the kind of operations and data types I need to manipulate. Some of these imply selection at the same time (get, change). 3) Something that would be really really nice would be navigation plus selection. If you navigate piece of code like this, you would highlight (and automatically select) in the following sequence if unit is "carbs": if unit is "carbs": (statements) if unit is "carbs": (predicate) if unit is "carbs": (comparison) if unit is "carbs": if unit is "carbs": if unit is "carbs": as you can see, navigation involves traversing the language structure. The reason for this is each point is highlighted in red has a name and I should also be able to navigate it by name. I've put in the few that I can think of that makes sense and yes, if you have multiple terms it's going get a little ugly naming them but I'm sure something useful will evolve. For right now though simply navigating and selection would make things much easier because I don't have to coordinate hands, fingers, mouse to select an element. I just get a chunk and it will most likely be the chunk I want. I think I did warn you that speech user interfaces and specifically programming by speech does get a little weird at times if all you're used to his keyboard and mouse. :-) -------------- next part -------------- An HTML attachment was scrubbed... URL: From andreas.roehler at online.de Fri Jun 17 18:18:49 2011 From: andreas.roehler at online.de (=?ISO-8859-1?Q?Andreas_R=F6hler?=) Date: Fri, 17 Jun 2011 18:18:49 +0200 Subject: [Python-mode] more speech driven how twos In-Reply-To: <4DFB5E6B.6070502@harvee.org> References: <4DFB5E6B.6070502@harvee.org> Message-ID: <4DFB7E69.8090204@online.de> Am 17.06.2011 16:02, schrieb Eric S. Johansson: > making more progress on some of the tools I need for speech or > programming. [ ... ] Hi Eric, thanks reminding at that. Seeing you introduced a blueprint. Your previous text went into the `second-level-commands'. As said, would like to do that. As soon as we solved issues around python v2-v3 file exec, I'll hopefully address the matter. Meanwhile you could instruct us still a little bit about the specific environment in use. Could you send a kind of technical description of your system? Which programs do the speech recording etc. Do you use emacsspeak? Andreas From esj at harvee.org Fri Jun 17 19:41:27 2011 From: esj at harvee.org (Eric S. Johansson) Date: Fri, 17 Jun 2011 13:41:27 -0400 Subject: [Python-mode] more speech driven how twos In-Reply-To: <4DFB7E69.8090204@online.de> References: <4DFB5E6B.6070502@harvee.org> <4DFB7E69.8090204@online.de> Message-ID: <4DFB91C7.1080708@harvee.org> On 6/17/2011 12:18 PM, Andreas R?hler wrote: > Am 17.06.2011 16:02, schrieb Eric S. Johansson: >> making more progress on some of the tools I need for speech or >> programming. > > [ ... ] > > Hi Eric, > > thanks reminding at that. Seeing you introduced a blueprint. Your previous > text went into the `second-level-commands'. Yeah that was probably a speech recognition error. Speech and browsers do not get along well > > As said, would like to do that. As soon as we solved issues around python > v2-v3 file exec, I'll hopefully address the matter. > > Meanwhile you could instruct us still a little bit about the specific > environment in use. > > Could you send a kind of technical description of your system? Which programs > do the speech recording etc. use Dragon NaturallySpeaking for speech recognition system. Runs on Windows I use a community built extension called vocola to generate macros and some degree of smart user interface with Python extensions to vocola. My currently preferred Emacs is Xemacs for political reasons[1] I'm not sure what you need in a technical description. Normally in a speech recognition environment you use either fixed grammars or contiguous dictation. I am building a hybrid where you use a fixed grammar with contextually dependent elements and interact with GUI elements to make an unspeakable process speakable. the process of making the unspeakable speakable involves identifying and extracting information from the application and transforming it into a speakable form before displaying it in a second application which can be manipulated. See blog.esjworks.com for more complete examples. I expect that most of the action routines for a complete grammar will just be Emacs keystrokes invoking Emacs methods via keyboard input. It would be nice to do a direct injection of commands to eliminate problems with errors in command execution caused by too fast a rate of injecting characters. A direct access channel would also allows to query the buffer for state information which could be used to influence the action routine. The commands I asked for it which have no need to export information to any external program would help me get a better feel for if I'm on the right track or not. If there's something I use regularly and they "feel" right" is a vocal damage through excessive use, then I'm on the right path. If not, I need to look at the problem again they come up with a better solution. An example of a more complicated spoken command is the "get method" command. The first thing the command does is search to the right for the next method. An alias for it would be get next method. Going in the other direction would be get previous method. Once the method was identified, it would be placed in the region, mark on the left, point on the right. The action routine for the grammar would then invoke a GUI helper program to manipulate symbol names that pass the existing name along to it. The resulting change method would be returned via a different grammar and action routine, "use < transformation type>", and the result would be placed back into the buffer replacing what was in the region. Making any sense? > > Do you use emacsspeak? wrong direction. I speak to the computer but it seems to pay no more attention to me than either my wife or dog do. --- eric [1] I think I've described this before but by political reasons, I mean that Stallman is a dick when it comes to accessibility issues. He told me that he puts greater emphasis on the freedom of software than he does over living breathing disabled people who need a way to make a living and function in society. he completely rejected the concept of using a hybrid system of proprietary software (NaturallySpeaking) driving Emacs and instead advocated waiting five or 10 years for an open-source equivalent to magically appear. Somehow he doesn't grok the fact that making open source available through proprietary gateway would bind disabled people to open source technology instead of continuing their dependence on closed source tools as well as making it possible for disabled people to create accessibility interfaces in an open-source environment. I swear the guy can't see past the end of his keyboard. From andreas.roehler at online.de Sat Jun 18 13:41:57 2011 From: andreas.roehler at online.de (=?ISO-8859-1?Q?Andreas_R=F6hler?=) Date: Sat, 18 Jun 2011 13:41:57 +0200 Subject: [Python-mode] more speech driven how twos In-Reply-To: <4DFB91C7.1080708@harvee.org> References: <4DFB5E6B.6070502@harvee.org> <4DFB7E69.8090204@online.de> <4DFB91C7.1080708@harvee.org> Message-ID: <4DFC8F05.2010707@online.de> Am 17.06.2011 19:41, schrieb Eric S. Johansson: > On 6/17/2011 12:18 PM, Andreas R?hler wrote: >> Am 17.06.2011 16:02, schrieb Eric S. Johansson: >>> making more progress on some of the tools I need for speech or >>> programming. >> >> [ ... ] >> >> Hi Eric, >> >> thanks reminding at that. Seeing you introduced a blueprint. Your >> previous text went into the `second-level-commands'. > > Yeah that was probably a speech recognition error. Speech and browsers > do not get along well IIRC that's me who put it into some times ago :) [ ... ] > > use Dragon NaturallySpeaking for speech recognition system. Runs on > Windows I use a community built extension called vocola to generate > macros and some degree of smart user interface with Python extensions to > vocola. Thanks, see it. BTW what are suitable returns from Emacs report functions for you. As choices coming into my mind for the moment are: - simple get it returned - display in mode-line - message-buffer - tool-tip - so-called speed-bar Instead of a simple return it might be send so a program... > > My currently preferred Emacs is Xemacs for political reasons[1] > > I'm not sure what you need in a technical description. Normally in a > speech recognition environment you use either fixed grammars or > contiguous dictation. I am building a hybrid where you use a fixed > grammar with contextually dependent elements and interact with GUI > elements to make an unspeakable process speakable. > > the process of making the unspeakable speakable involves identifying and > extracting information from the application and transforming it into a > speakable form before displaying it in a second application which can be > manipulated. See blog.esjworks.com for more complete examples. > > I expect that most of the action routines for a complete grammar will > just be Emacs keystrokes invoking Emacs methods via keyboard input. It > would be nice to do a direct injection of commands to eliminate problems > with errors in command execution caused by too fast a rate of injecting > characters. A direct access channel would also allows to query the > buffer for state information which could be used to influence the action > routine. > > The commands I asked for it which have no need to export information to > any external program would help me get a better feel for if I'm on the > right track or not. If there's something I use regularly and they "feel" > right" is a vocal damage through excessive use, then I'm on the right > path. If not, I need to look at the problem again they come up with a > better solution. > > An example of a more complicated spoken command is the "get method" > command. The first thing the command does is search to the right for the > next method. An alias for it would be get next method. Going in the > other direction would be get previous method. Once the method was > identified, it would be placed in the region, mark on the left, point on > the right. The action routine for the grammar would then invoke a GUI > helper program to manipulate symbol names that pass the existing name > along to it. The resulting change method would be returned via a > different grammar and action routine, "use < transformation type>", and > the result would be placed back into the buffer replacing what was in > the region. > > Making any sense? > > It does. However, it's a new and vast matter for me. So let's proceed step by step and see how it goes. Let's start with the report-function, telling where you are in code. Agreed? So I will dig a little bit into the question, how the results from Emacs are taken up in your environment. Cheers, Andreas From esj at harvee.org Sat Jun 18 15:00:07 2011 From: esj at harvee.org (Eric S. Johansson) Date: Sat, 18 Jun 2011 09:00:07 -0400 Subject: [Python-mode] more speech driven how twos In-Reply-To: <4DFC8F05.2010707@online.de> References: <4DFB5E6B.6070502@harvee.org> <4DFB7E69.8090204@online.de> <4DFB91C7.1080708@harvee.org> <4DFC8F05.2010707@online.de> Message-ID: <4DFCA157.6000306@harvee.org> > BTW what are suitable returns from Emacs report functions for you. > > As choices coming into my mind for the moment are: > > - simple get it returned yes as in position = Emacs_fetch ("current character position", buffer = "focus") buffer_list = Emacs_fetch ("buffer list") obviously we have to figure out what's a reasonable set of first arguments for this function. I am perfectly willing to use internal Lisp names including calling functions to get data. Actually, that seems like it might be very reasonable thing to do. Sort of like SQL queries only more understandable. > - display in mode-line that seems to be more of a Emacs_set function. Could you elaborate what you're thinking of? > - message-buffer actually, I was thinking of any buffer. If we had access to the current buffer, it would be possible to reimplement VR-mode in a more generic fashion. > - tool-tip Again, could you elaborate but I do suspect it's something you would set through the set data function > - so-called speed-bar > > Instead of a simple return it might be send so a program... > >> >> My currently preferred Emacs is Xemacs for political reasons[1] >> >> I'm not sure what you need in a technical description. Normally in a >> speech recognition environment you use either fixed grammars or >> contiguous dictation. I am building a hybrid where you use a fixed >> grammar with contextually dependent elements and interact with GUI >> elements to make an unspeakable process speakable. >> >> the process of making the unspeakable speakable involves identifying and >> extracting information from the application and transforming it into a >> speakable form before displaying it in a second application which can be >> manipulated. See blog.esjworks.com for more complete examples. >> >> I expect that most of the action routines for a complete grammar will >> just be Emacs keystrokes invoking Emacs methods via keyboard input. It >> would be nice to do a direct injection of commands to eliminate problems >> with errors in command execution caused by too fast a rate of injecting >> characters. A direct access channel would also allows to query the >> buffer for state information which could be used to influence the action >> routine. >> >> The commands I asked for it which have no need to export information to >> any external program would help me get a better feel for if I'm on the >> right track or not. If there's something I use regularly and they "feel" >> right" is a vocal damage through excessive use, then I'm on the right >> path. If not, I need to look at the problem again they come up with a >> better solution. >> >> An example of a more complicated spoken command is the "get method" >> command. The first thing the command does is search to the right for the >> next method. An alias for it would be get next method. Going in the >> other direction would be get previous method. Once the method was >> identified, it would be placed in the region, mark on the left, point on >> the right. The action routine for the grammar would then invoke a GUI >> helper program to manipulate symbol names that pass the existing name >> along to it. The resulting change method would be returned via a >> different grammar and action routine, "use < transformation type>", and >> the result would be placed back into the buffer replacing what was in >> the region. >> >> Making any sense? >> >> > > It does. However, it's a new and vast matter for me. So let's proceed step by > step and see how it goes. I didn't get here overnight. It took me 18 years to become injured and 10 years to become frustrated with speech recognition and then another five years to figure out how to not become frustrated only become frustrated because I couldn't pay people to write the code for me. joys of being a serial entrepreneur self-employed type person. If you think this is interesting, you should see what I'm doing for diabetes self-management tools. I really need to get that done so I can pass the demo to potential funders which is part of the reason why I need these Emacs extensions. Everybody has an ulterior motive. :-) > > Let's start with the report-function, telling where you are in code. > Agreed? So I will dig a little bit into the question, how the results from > Emacs are taken up in your environment. this has been problematic from day one. The blind spot in speech recognition has been that since getting information from application is "too hard" that commands have become open loop commands using the content of the command to generate a keystroke or menu injection commands to activate a function within an application. Emacs examples would be something like: (date | time | log) stamp = stamp.string($1); search (forward={ctrl+s}|back={ctrl+r}) = $1; yank (again={Esc}y|it back={ctrl+y}) = $1; go to line = {Alt+g}; repeat (it={ctrl+u} | twice={ctrl+u2} | thrice={ctrl+u3} ) = $1; copy (character={esc}xdelete-forward-char{enter}{ctrl+y} | word= {esc}d{ctrl+y}| line={esc}xset-mark{ctrl-e}{esc}w )= $1; kill (character = {ctrl+d} | word={esc}d| line={ctrl+k} )= $1; delete (character = {esc}xdelete-backward-charI{enter}| word={esc}xbackward-kill-word{enter}| line={ctrl+u}0k{} )= $1; left (character={ctrl+b}| word={esc}b| line={ctrl+u}0k{esc}xforward-line{enter} )= $1; right (character={ctrl+f}| word={esc}f| line={esc}xforward-line{enter} )= $1; sorry if that doesn't make much sense but the grammar is expressed in a rather odd way in vocola, mixing action with grammar. copy (character | word | line) is expressed as: copy (character={esc}xdelete-forward-char{enter}{ctrl+y} | word= {esc}d{ctrl+y}| line={esc}xset-mark{ctrl-e}{esc}w )= $1; the right hand side of each grammar expression is the key sequence emitted. Note: in this example, not all of the key sequences are correct but I fixed them when I need them for the first time. You could say this is programming by placeholder. there has been no activity trying to find a general way to return data to the speech recognition environment. There have been some hacks using the cut and paste buffer mechanism but that's a rather unsophisticated. I think the best model is "tell me what I want" rather than try to force anything into the speech recognition action routines. The only potential of exception to that would be the change of some major state which necessitates moving to a new grammar and action routine state. For example, if you change modes, you had want a new grammar. We might build a handle that by the first thing we ask is "what is the state" and if it's the same as the last time, we don't change anything. Otherwise we initiate a grammar change. This also highlights another difference between current thinking and what I think is a better solution. Current thinking only changes grammar if you change applications. I believe we should change grammar if an internal state changes because that should allow you to disambiguate commands through reduction of scope (you'll hear me say that a lot) in python mode, an example that would be enabling commands for Shell operation and debugging only after you enter a shell buffer versus a globally active grammar which would require longer more unique commands. in summary, I would say that the easiest model is to continue with the grammar and action routine triggers the way we do now and action routines query the application for data and push data to the application. I should probably into here because I'm probably giving you intellectual heartburn at this point because it's a lot to digest and I'm late for my astronomy club's work party. observing sites don't maintain themselves. Later --- eric From esj at harvee.org Sat Jun 18 15:08:03 2011 From: esj at harvee.org (Eric S. Johansson) Date: Sat, 18 Jun 2011 09:08:03 -0400 Subject: [Python-mode] more speech driven how twos In-Reply-To: <4DFCA157.6000306@harvee.org> References: <4DFB5E6B.6070502@harvee.org> <4DFB7E69.8090204@online.de> <4DFB91C7.1080708@harvee.org> <4DFC8F05.2010707@online.de> <4DFCA157.6000306@harvee.org> Message-ID: <4DFCA333.3010900@harvee.org> On 6/18/2011 9:00 AM, Eric S. Johansson wrote: > > I should probably into here because I'm probably giving you intellectual > heartburn at this point because it's a lot to digest and I'm late for my > astronomy club's work party. observing sites don't maintain themselves. one more bit of IHB. I believe that the model we are working with is leading us to a general foundation by which you can make all applications more easily accessible with greater functionality than the current efforts. I'm dead serious. The current accessibility methods have been make the same mistakes as long as I've been disabled and they provide no more accessibility today than they did in the past and vendor still have to do a lot to their applications to make it work. If we do this right, we make it easier, we make it simpler, and we make it possible for any vendor to make their software verifiably accessible without any great expense or effort. This is why I think this particular effort is important besides the minor point that it makes it possible for crips like me to use speech recognition and Emacs. it's kind of a big vision to take in but I think what I'm talking about will become visible as we make progress. --- eric From andreas.roehler at online.de Sat Jun 18 21:41:11 2011 From: andreas.roehler at online.de (=?ISO-8859-1?Q?Andreas_R=F6hler?=) Date: Sat, 18 Jun 2011 21:41:11 +0200 Subject: [Python-mode] more speech driven how twos In-Reply-To: <4DFCA157.6000306@harvee.org> References: <4DFB5E6B.6070502@harvee.org> <4DFB7E69.8090204@online.de> <4DFB91C7.1080708@harvee.org> <4DFC8F05.2010707@online.de> <4DFCA157.6000306@harvee.org> Message-ID: <4DFCFF57.3000703@online.de> Am 18.06.2011 15:00, schrieb Eric S. Johansson: > >> BTW what are suitable returns from Emacs report functions for you. >> >> As choices coming into my mind for the moment are: >> >> - simple get it returned > yes as in > position = Emacs_fetch ("current character position", buffer = "focus") > buffer_list = Emacs_fetch ("buffer list") > that looks like a list of values as parse-partial-sexp returns for example, right? [ ... ] > > I didn't get here overnight. It took me 18 years to become injured and > 10 years to become frustrated with speech recognition and then another > five years to figure out how to not become frustrated only become > frustrated because I couldn't pay people to write the code for me. joys > of being a serial entrepreneur self-employed type person. If you think > this is interesting, you should see what I'm doing for diabetes > self-management tools. I really need to get that done so I can pass the > demo to potential funders which is part of the reason why I need these > Emacs extensions. Everybody has an ulterior motive. :-) Even if neither Emacs nor Python related, I'll take occasion to mention Chaumont Devin, a poet from Hawai, who wrote some interesting computer linguistics and told a similar story beside. Here the adress of his language works: http://panlingua.net/ Cheers, Andreas From esj at harvee.org Sun Jun 19 19:28:59 2011 From: esj at harvee.org (Eric S. Johansson) Date: Sun, 19 Jun 2011 13:28:59 -0400 Subject: [Python-mode] more speech driven how twos In-Reply-To: <4DFCFF57.3000703@online.de> References: <4DFB5E6B.6070502@harvee.org> <4DFB7E69.8090204@online.de> <4DFB91C7.1080708@harvee.org> <4DFC8F05.2010707@online.de> <4DFCA157.6000306@harvee.org> <4DFCFF57.3000703@online.de> Message-ID: <4DFE31DB.7080103@harvee.org> On 6/18/2011 3:41 PM, Andreas R?hler wrote: > Am 18.06.2011 15:00, schrieb Eric S. Johansson: >> >>> BTW what are suitable returns from Emacs report functions for you. >>> >>> As choices coming into my mind for the moment are: >>> >>> - simple get it returned >> yes as in >> position = Emacs_fetch ("current character position", buffer = "focus") >> buffer_list = Emacs_fetch ("buffer list") >> > > that looks like a list of values as parse-partial-sexp returns for example, > right? I'll need a bit more of an explanation please. I looked up the definition of cars-partial-Saxby[1] and it was not clear to me. I need more context. > > Even if neither Emacs nor Python related, I'll take occasion to mention > Chaumont Devin, a poet from Hawai, who wrote some interesting computer > linguistics and told a similar story beside. Here the adress of his language > works: > > http://panlingua.net/ fascinating. It takes a bit of time to digest. I'll need to meditate on it a bit. I'm always looking for potential sources of ideas for the next stage which is translation to and from code/speakable language. for some reason, his site reminds me of the following quote from George Bernard Shaw: """The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man.""" --- eric (unreasonable man) [1] an example of why I'm taking the approach I am with name generation From andreas.roehler at online.de Sun Jun 19 20:00:08 2011 From: andreas.roehler at online.de (=?ISO-8859-1?Q?Andreas_R=F6hler?=) Date: Sun, 19 Jun 2011 20:00:08 +0200 Subject: [Python-mode] more speech driven how twos In-Reply-To: <4DFE31DB.7080103@harvee.org> References: <4DFB5E6B.6070502@harvee.org> <4DFB7E69.8090204@online.de> <4DFB91C7.1080708@harvee.org> <4DFC8F05.2010707@online.de> <4DFCA157.6000306@harvee.org> <4DFCFF57.3000703@online.de> <4DFE31DB.7080103@harvee.org> Message-ID: <4DFE3928.5070905@online.de> Am 19.06.2011 19:28, schrieb Eric S. Johansson: > On 6/18/2011 3:41 PM, Andreas R?hler wrote: >> Am 18.06.2011 15:00, schrieb Eric S. Johansson: >>> >>>> BTW what are suitable returns from Emacs report functions for you. >>>> >>>> As choices coming into my mind for the moment are: >>>> >>>> - simple get it returned >>> yes as in >>> position = Emacs_fetch ("current character position", buffer = "focus") >>> buffer_list = Emacs_fetch ("buffer list") >>> >> >> that looks like a list of values as parse-partial-sexp returns for >> example, right? > > I'll need a bit more of an explanation please. I looked up the > definition of cars-partial-Saxby[1] and it was not clear to me. I need > more context. > Inside the python-mode archiv exists a pars-part-output.el it provides a function called parse-partial-sexp-iac which displays the output of parse-partial-sexp together with its explanation Cheers, Andreas From esj at harvee.org Sun Jun 19 20:21:24 2011 From: esj at harvee.org (Eric S. Johansson) Date: Sun, 19 Jun 2011 14:21:24 -0400 Subject: [Python-mode] more speech driven how twos In-Reply-To: <4DFE3928.5070905@online.de> References: <4DFB5E6B.6070502@harvee.org> <4DFB7E69.8090204@online.de> <4DFB91C7.1080708@harvee.org> <4DFC8F05.2010707@online.de> <4DFCA157.6000306@harvee.org> <4DFCFF57.3000703@online.de> <4DFE31DB.7080103@harvee.org> <4DFE3928.5070905@online.de> Message-ID: <4DFE3E24.1080909@harvee.org> On 6/19/2011 2:00 PM, Andreas R?hler wrote: > > > Inside the python-mode archiv exists a pars-part-output.el > > it provides a function called parse-partial-sexp-iac > which displays the output of parse-partial-sexp together with its explanation > er. I need a bit more of an example than that :-) I tried running it. that documentation made some sense but I really need to see an example of what it does. From andreas.roehler at online.de Sun Jun 19 20:40:26 2011 From: andreas.roehler at online.de (=?ISO-8859-1?Q?Andreas_R=F6hler?=) Date: Sun, 19 Jun 2011 20:40:26 +0200 Subject: [Python-mode] more speech driven how twos In-Reply-To: <4DFE3E24.1080909@harvee.org> References: <4DFB5E6B.6070502@harvee.org> <4DFB7E69.8090204@online.de> <4DFB91C7.1080708@harvee.org> <4DFC8F05.2010707@online.de> <4DFCA157.6000306@harvee.org> <4DFCFF57.3000703@online.de> <4DFE31DB.7080103@harvee.org> <4DFE3928.5070905@online.de> <4DFE3E24.1080909@harvee.org> Message-ID: <4DFE429A.2030700@online.de> Am 19.06.2011 20:21, schrieb Eric S. Johansson: > On 6/19/2011 2:00 PM, Andreas R?hler wrote: >> >> >> Inside the python-mode archiv exists a pars-part-output.el >> >> it provides a function called parse-partial-sexp-iac >> which displays the output of parse-partial-sexp together with its >> explanation >> > > er. I need a bit more of an example than that :-) > > I tried running it. that documentation made some sense but I really need > to see an example of what it does. > it reports the syntactic state of the code position. Returns a list. Below an explanation of it's elements and what they contain. car of this list is a number indicating the nesting, and so on: 0. depth in parens. 1. character address of start of innermost containing list; nil if none. 2. character address of start of last complete sexp terminated. 3. non-nil if inside a string. (it is the character that will terminate the string, or t if the string should be terminated by a generic string delimiter.) 4. nil if outside a comment, t if inside a non-nestable comment, else an integer (the current comment nesting). 5. t if following a quote character. 6. the minimum paren-depth encountered during this scan. 7. style of comment, if any. 8. character address of start of comment or string; nil if not in one. BTW XEmacs implementation is slightly different. From andreas.roehler at online.de Mon Jun 20 17:55:18 2011 From: andreas.roehler at online.de (=?UTF-8?B?QW5kcmVhcyBSw7ZobGVy?=) Date: Mon, 20 Jun 2011 17:55:18 +0200 Subject: [Python-mode] execfile In-Reply-To: <20110614152352.26d6fe53@neurotica.wooz.org> References: <4DD6536C.3020309@online.de> <20110613170744.7d7a5654@neurotica.wooz.org> <4DF78AD3.2090000@online.de> <20110614152352.26d6fe53@neurotica.wooz.org> Message-ID: <4DFF6D66.5030108@online.de> [ ... ] > >> Just a thought in context: as people my run parallel different versions of >> python --locally or send something to remote machines-- there should be a way >> to specify the version to run. >> >> This would override the default version-check. > > That would certainly be useful for *me* :). It's pretty typical that I want > to run both Python 2 and 3 in different windows at the same time, but I could > even imagine some folks might want to run Jython and Python 2, or even Python > 2.6 and 2.7 and IronPython at the same time. > > If it's possible, there should be one default, with a fairly easy way to > override on a case-by-case basis. Hi Barry, as it's progressing some specification in order to avoid re-writes: - buffer will be in a writing mode of python2 or python3 flavour. Should the mode-line indicates than "python2" or "python3" instead "python"? -- IMHO yes but tell... :) Nonewithstanding in which versions-mode the buffer is, user may select installed python versions to execute. Per default the python-version selected in buffer mode will be used. So far Andreas From andreas.roehler at online.de Thu Jun 23 19:06:21 2011 From: andreas.roehler at online.de (=?UTF-8?B?QW5kcmVhcyBSw7ZobGVy?=) Date: Thu, 23 Jun 2011 19:06:21 +0200 Subject: [Python-mode] [Bug 310354] Re: 3.0 execute into python session In-Reply-To: <20110613210222.32748.9780.malone@chaenomeles.canonical.com> References: <20081222000715.2989.11180.malonedeb@gandwana.canonical.com> <20110613210222.32748.9780.malone@chaenomeles.canonical.com> Message-ID: <4E03728D.8040206@online.de> Am 13.06.2011 23:02, schrieb Barry Warsaw: > There are a couple of issues here. > > I'd like to see python-mode eventually grow better support for Python 3 > and Python 2 at the same time. Probably Python 3 support should be a > derived major-mode so things that are unique to it can be handled > separately from Python 2 support. It would then be nice if python-mode > could auto-detect which to use when possible (this will sometimes be > difficult), or provide an easy way for the user to specify or switch to > python3-mode (e.g. via an auto-mode-alist or some such). Definitely > python-mode.el should at least keep a local variable that tells you > whether the current buffer is Python 2 or Python 3. > > * Now, when you have such a variable, functions like py-execute-file can > switch on that to decide what Python code to exec. For Python 3, I'd > actually run something like this snippet: > > with open(r'%s') as python_mode_exec_hack: > exec(python_mode_exec_hack.read()) Hi Barry, while it seems pretty close at finish, just to communicate some changes: If that local variable mentioned --lets call it py-which-shell-- doesn't exist, shebang, import will be queried, finally recurring to installed default Python. Ie in that (new) order: (setq active-shell (or py-which-shell (py-choose-shell-by-shebang) (py-choose-shell-by-import) installed-system-default-python M-x py-toggle-shell without arg will switch between Cpython und Jython - similar as now, but no numeric args required any more, while with C-u prompts for specific Python version - any reachable might be given, python2.7, python3.1 or whatever. Cheers, Andreas From andreas.roehler at online.de Sun Jun 26 10:09:35 2011 From: andreas.roehler at online.de (=?ISO-8859-15?Q?Andreas_R=F6hler?=) Date: Sun, 26 Jun 2011 10:09:35 +0200 Subject: [Python-mode] edit or navigate code by feature Message-ID: <4E06E93F.6000509@online.de> Hi Eric, what about implementing a simplified navigation mode like such: just call an object: for example "method", "string", "list" etc. Emacs will look if inside such a thing. If yes, it marks it as region. If not, go forward to the next in buffer. Should take the common numeric arguments moving forward or backward. Once the region is marked, a couple of functions already are provided to work at it: see 'ar-bracket-region-atpt' 'ar-brace-region-atpt' and the like provided by thing-at-point-utils.el. which are delivered with https://code.launchpad.net/~a-roehler/python-mode/components-python-mode More stuff of that kind at: https://code.launchpad.net/s-x-emacs-werkstatt/ Might deliver shorthands within the new mode, so just saying "brack" instead of 'ar-bracket-region-atpt' should be enough than. Cheers, Andreas From esj at harvee.org Sun Jun 26 17:26:00 2011 From: esj at harvee.org (Eric S. Johansson) Date: Sun, 26 Jun 2011 11:26:00 -0400 Subject: [Python-mode] edit or navigate code by feature In-Reply-To: <4E06E93F.6000509@online.de> References: <4E06E93F.6000509@online.de> Message-ID: <4E074F88.104@harvee.org> On 6/26/2011 4:09 AM, Andreas R?hler wrote: > Hi Eric, overall but I think we're pretty close agreement although sometimes I feel like conversations about speech recognition goes something like this: http://www.youtube.com/watch?v=6e1hZGDaqIw > > > what about implementing a simplified navigation mode like such: > > just call an object: for example "method", "string", "list" etc. > > Emacs will look if inside such a thing. > If yes, it marks it as region. > If not, go forward to the next in buffer. > > Should take the common numeric arguments moving forward or backward. in walking through some examples, I'll be expressing grammar to Emacs associations using the notation at the end of the paragraph. That may hopefully bridge some of the Emacs and speech recognition "magic". As I work on examples, I realize I don't know enough of the Emacs magic to properly describe the Emacs function so I'm making it up as I go along. Yes I expect to be corrected. :-) I'll 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?). my expectation would be that it would select the entire word "calories" and the result would be in the cut and paste buffer (kill ring?) For use later on. I asked the question about whether or not the region is redefined to be on this word because that might be useful for some other operation within Emacs. Kinda messy. Too many side effects to make a comfortable but I haven't seen a better way that doesn't involve speaking more which is not a better way. "Get next method" -- (result-to-knp(ar-method-copy-apt 1)) -- go find the next method which would be the next "calories" to the right. "Replace [string] index" -- (ar-index-replace-apt type 1)) -- find the next index and replace it with what's in the cut paste/kill buffer. Encapsulate in quotes or not depending on what is said. "Narrow to index" -- (ar-index-narrow-apt) -- find the next index and narrow edit buffer to index. Note: this model should also apply to things like arguments and predicates. Should be possible to narrow recursively. is this making enough sense that I should go through and define the grammar and Emacs expectations? > > Might deliver shorthands within the new mode, so just saying "brack" instead > of 'ar-bracket-region-atpt' should be enough than. > don't worry about making Emacs pronounceable. I will handle that in the grammar. Let's make the functionality work for a small subset to test it out and also figure out a better method of driving Emacs by voice other than injecting keystrokes. I'd really like to have a method of getting data out of Emacs other than the cut and paste buffer. --- eric "pronoun trouble" From andreas.roehler at online.de Mon Jun 27 09:07:15 2011 From: andreas.roehler at online.de (=?ISO-8859-15?Q?Andreas_R=F6hler?=) Date: Mon, 27 Jun 2011 09:07:15 +0200 Subject: [Python-mode] edit or navigate code by feature In-Reply-To: <4E078C22.20908@online.de> References: <4E06E93F.6000509@online.de> <4E074F88.104@harvee.org> <4E078C22.20908@online.de> Message-ID: <4E082C23.6070706@online.de> 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 From andreas.roehler at online.de Mon Jun 27 09:51:10 2011 From: andreas.roehler at online.de (=?ISO-8859-15?Q?Andreas_R=F6hler?=) Date: Mon, 27 Jun 2011 09:51:10 +0200 Subject: [Python-mode] wiki Message-ID: <4E08366E.4060404@online.de> Hi Barry, suggest to change the remark at http://wiki.python.org/moin/EmacsEditor saying: "Work is underway to unify the two modes." into something like: "Ideas, features and code is exchanged between these modes. " While unifying remains an option, current development at GNU's makes ending up with a third mode more probable IMHO. At the moment seeing three quite different cores, while the API is similar - as far as existing. Which must not affect users BTW, as we may provide everything, any other python mode offers. Cheers, Andreas From esj at harvee.org Mon Jun 27 15:37:32 2011 From: esj at harvee.org (Eric S. Johansson) Date: Mon, 27 Jun 2011 09:37:32 -0400 Subject: [Python-mode] edit or navigate code by feature In-Reply-To: <4E082C23.6070706@online.de> References: <4E06E93F.6000509@online.de> <4E074F88.104@harvee.org> <4E078C22.20908@online.de> <4E082C23.6070706@online.de> Message-ID: <4E08879C.6070302@harvee.org> 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 From barry at python.org Tue Jun 28 06:09:19 2011 From: barry at python.org (Barry Warsaw) Date: Tue, 28 Jun 2011 05:09:19 +0100 Subject: [Python-mode] wiki In-Reply-To: <4E08366E.4060404@online.de> References: <4E08366E.4060404@online.de> Message-ID: <20110628050919.779f8e31@snowdog> Hi Andreas, On Jun 27, 2011, at 09:51 AM, Andreas R?hler wrote: >suggest to change the remark at > >http://wiki.python.org/moin/EmacsEditor > >saying: > >"Work is underway to unify the two modes." > >into something like: > >"Ideas, features and code is exchanged between these modes. " That does reflect today's reality better. +1 It's a wiki, go for it! :) -Barry -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: not available URL: