What I think I want out of autocompletion in GNU Emacs (for Go coding)
I mentioned a while back that I had set up autocompletion in GNU Emacs for Go, using gocode and the auto-complete Emacs package. I also mentioned that I wasn't sure if I liked autocompletion and was going to stick with it. Well, the verdict is in for now; I found it too annoying and I wound up turning it off. However, I still kind of miss it. Thinking about what I miss and what made me hate it enough to turn it off has led me to what I think I want out of autocompletion.
Why I turned autocompletion off is that it kept stealing my keystrokes (in order to do the wrong autocompletion); cursor keys, the return key, and I think even sometimes the space bar. I type fast and I type ahead, so I absolutely, utterly hate having the sequence of what I'm typing be derailed because autocompletion decided to grab a cursor motion or a return or whatever. Unless I go out of my way, I want what I type at the keyboard to actually be what shows up in the file I'm editing. At the same time, the prompting and information that autocompletion gave me was genuinely useful; it was a great way to not have to remember the full names of things in Go packages and so on.
Given that I liked the information display, I don't want all of (auto)completion to be deferred until I use a special key sequence like C-M-i. If I spent a lot of time in GNU Emacs I might be able to train myself to hit that by reflex, but with my more casual use it'd just insure that I mostly never used completion at all. But I don't want any actual completing of things to happen until I hit a key to start it (and once I hit the key, it's fine if autocompletion steals my cursor keys and return key and so on).
So in short what I want from autocompletion is immediate information on possible completions coupled with deferred actual completion until I take some active step to start the completion process. This is fairly similar to the completion model I'm happy with in Unix shells, where nothing starts getting filled in until you hit TAB.
(Defering only actual completion doesn't appear to be possible in auto-complete. I can't entirely blame the package, because what I'm calling an information display is what it thinks of as a completion menu and completion prompt.)
Part of my irritation with autocompletion is specific to the Go
autocompletion mode provided by gocode. For instance, in Go I
don't want to have completion happen when I'm typing in language
func; I find it both distracting and
not useful. Completion is for things that I might have to look up;
if I'm typing a keyword, that is not the case.
(This completion of keywords is especially irritating because it's
blind to context. If I start typing 'pa' on a new line in a function
body, I'll still get offered '
package' as a possible completion
despite that clearly not being correct or even valid. Gocode is context
aware in general, in that it does things like offer local variables as
PS: That part of my issues are with gocode itself suggests that even switching to vim wouldn't entirely help.
Comments on this page:Written on 21 November 2015.