1

It's become a standard feature of most (all?) software the past decade or two to have predictive text completion. By predictive completion I mean, when you type into the url field of a web browser it offers completion suggestions, or pretty much any search field, or write in a text messaging app, or an IDE like IntelliJ, or ... pretty much every piece of software I can think of, with one exception, which is Emacs. When I type into Emacs, nothing pops up and nothing is predicted.

Is this capability really missing from Emacs?

Searches turned up three packages that would need to be installed as add-ons and configured: autocomplete, company-mode, and corfu. Add-ons for completion? Really?

I went ahead and installed company-mode, but its behavior seems eccentric. For instance, the candidate lists often have duplicates. A search revealed this bug has existed for more than 5 years. Yet, company-mode seems to still be under active development. Count me baffled.

Also, the candidate lists seem not to be ordered in a logical way. Most of these systems are based on simple machine learning algorithms that would tend to put the more likely choices at the top. It doesn't seem to me that's happening with company-mode.

Also, the candidate list persists even after it's down to a unique choice, and it's awkward to dismiss. As I type it's constantly popping up with the unique completion of the word I'm typing, forcing me to constantly manually dismiss it. How did that make it out of beta? And it alters the letter case of candidate words in a way that makes many choices useless, for instance turning camel-case identifiers into all lower case. All this behavior strikes me as quite broken.

I honestly can't see why Emacs would need a special plug in for a feature this elementary. I'm not seeking anything esoteric or powerful, just basic text completion like any software of recent decades would have. I'm baffled by the seemingly broken functionality of company and I already invested a painful amount of time in it.

Can I expect anything more standard from autocomplete or corfu? Are there any other good options?

6
  • 2
    What's the question? This post is more like a blog. This site is for specific single questions, especially how-to and conceptual questions. For discussion or very broad questions you might want to try a discussion site, such as Reddit. There are also GNU Emacs mailing lists you can post to. I'm sure your observations and ideas would be welcome there.
    – Drew
    Dec 31, 2021 at 0:13
  • 1
    The question is: How do I get completion for Emacs? I've tried company and it didn't work well. Are there other packages that do? The opening paragraph explains what I mean by "completion." Most of the rest of what I wrote was to be specific about why I consider company-mode unusable. Dec 31, 2021 at 0:31
  • You can think of company as a UI. And then try additional packages to choose the completion logic and advanced sources that you would like. It isn't clear what you want exactly because we seem to have different understanding of what completion in "any software of recent decades" does or can do. auto-complete and corfu aren't going to help with the latter by themselves. They're also UIs, alternative ones.
    – Dmitry
    Dec 31, 2021 at 2:01
  • @Dmitry If they these packages won't help by themselves, what will help? What I'm hoping to do: 1. What most of these systems do, at the least, is complete something based on your own past writing (previous searches in a browser, ...), 2. What other people have done (popular searches), 3. keywords and defined functions in code editing buffers, 4. words pulled from the dictionary, ordered by frequency of use, 5. names pulled from your contacts, etc. Nothing exotic. Just the most basic functionality that almost all software implements. Why would Emacs lack basic things like that? Dec 31, 2021 at 2:45
  • 1
    @Dmitry And also, 6. fixing typos automatically. The functionality of company was the right kind of stuff. It was just didn't seem to have much if anything in the way of AI or context-sensitivity, so pretty trivial, but the bigger problem was really crazy behavior like duplicated candidates and intrusive behavior, like I described. If it weren't so broken, company would be better than nothing. Dec 31, 2021 at 2:56

1 Answer 1

1

You should read the documentation before complaining about it. See the list of pluggable back ends that it supports? Those are different sources it can use for completion results. It can pull from your Emacs environment (elisp), C and C++ compilers (clang, lsp, semantic), many other language compilers (lsp, etags, gtags, semantic, completion-at-point), your address book (bbdb), etc. However, you have to choose which of these are in use at any given time. It has some defaults, but they are not going to be perfect for everyone.

If company doesn’t work well enough for you, then there are alternatives. If none of them are good enough, they are all Free software; we invite you to improve them as much as you like.

If you really want to ask questions about it, you should ensure that they are quite specific. What programming language are you writing in, and what completion sources have you tried? What specifically is wrong with the completions provided by this source?

I recommend also reading about the built–in completion system in chapter 20.6 Completion of the Emacs manual. You can access it in a buffer by running completion-at-point, which is bound to C-M-i by default.

2
  • The question is really how do you remove duplicates. I get them from completion-at-point and dabbrev ie from the syntax checker type completion and from what you have typed recently
    – mmmmmm
    Dec 31, 2021 at 16:20
  • @mmmmmm I've added a response to a related question you recently upvoted. You can add further comments there.
    – Dmitry
    Jan 3 at 3:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.