post 127

By anders pearson 06 Oct 2000

someone who knows emacs lisp really really well and is looking for something to do:

i would be much more productive if emacs had completion like bash for variables and functions in code. eg, if i’m writing a program and i have:

int a_very_long_variable_name = 0;

and later on, i’m typing

a_very_long_variable_name = (a_very_long_variable_name < 0) ? 0 : a_very_long_variable_name;

i would love to, instead, be able to type:

a_very[tab] = (a_very[tab] < 0) ? a_very[tab];

and have it just complete the variable names for me when i hit tab. i realize that this it would probably take a pretty significant amount of programming to get this to work, but i think it’s far from impossible, and anyone who programs could see that this would save an enormous amount of work and prevent numerous errors from mistyping a variable name in the same sort of way that syntax coloring helps prevent errors from missing ‘}‘s and such.

the various modes for different programming languages are already smart enough to know what is a variable, what is a function, what is a string, etc, in order to implement syntax coloring. it seems like it shouldn’t be that hard to have it autocomplete say, just variables that have already been declared/defined earlier in the same source document. i think Word even has a feature similar to this in that it allows you to define some commonly used words and if you type the first few letters, it will let you hit enter and complete it.

i may have to learn elisp myself if only to make sure that there is never a worthwhile function that Word has that emacs doesn’t. i should probably learn elisp anyway…