edit or navigate code by feature

Registered by Eric S. Johansson

editing code using speech recognition requires a different way of looking at the code. To get high-efficiency vocal use, it's necessary to edit the code by "feature", uniquely identifiable fragments of code. For example, a predicate is the code between flow control key word and the colon. Other examples are argument list, second argument, index, and the like. Navigation by the same features would be helpful as well "jump to second argument".

Search always be to the right by default but have the ability to go to the left. The feature identified should be surrounded by mark and point.

Blueprint information

Needs approval
Andreas Roehler
Series goal:
Milestone target:
milestone icon 6.2.1
Started by
Andreas Roehler


Eric S. Johansson:

From the speaking perspective, there are only a few types of symbols. Class, method, instance, variable. All of these are relatively difficult to detect in many circumstances unless a databases Of symbols and their type signature is maintained.

But if it isn't, all is not lost as long as I can fall back on the generic "symbol" so I can say things like "choose symbol 4" and have it select the fourth symbol in the line. Along the same vein, it would be nice to have the ability to choose an index, a full set of arguments or in individual argument. Super special would be being able to reduce scope after you select something like an argument which is a method with multiple arguments of its own. Being able to select that argument by name (choose argument 3) and be able to narrow your focus to just that argument has the potential for being very good for speech use and for

[ ... ] 17.06.2011 16:02:

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.


here's a grammar I speak and the characters it generates.

# Voice commands for xwin

# include Unimacro.vch;
include folders.vch;
include files.vch;

# This really should be just for xemacs but, we will do the best we can

(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}|
        )= $1;

kill (character = {ctrl+d} |
        )= $1;

delete (character = {esc}xdelete-backward-charI{enter}|
        )= $1;

left (character={ctrl+b}|
        )= $1;

right (character={ctrl+f}|
        )= $1;


saying "ipython" should be enough to put cursor into an ipython-shell environement.
Respective with "python2" "python3" or just "python" or "jython"


with r572 some progress should be made with new commands:

py-close-block, -clause, -def, class

  Set indent level to that of beginning of definition.
  If final line isn't empty and
  `py-close-block-provides-newline' non-nil, insert a
  newline. Returns column.


Work Items

This blueprint contains Public information 
Everyone can see this information.