monsanto / readline-complete.el

autocomplete in shell mode buffers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bad interaction with inferior-emacs-lisp-mode using company

ackalker opened this issue · comments

In my .emacs I have (company-global-mode t), set up my shell etc., and set up realine-complete for use with company using:

(add-to-list 'company-backends 'company-readline)
(add-hook 'rlc-no-readline-hook (lambda () (company-mode -1)))

The problem: when I do M-x ielm to start using inferior-emacs-lisp-mode, typing any char after a ( caues company to shut down instantly, without showing any completion candidates.

I have traced the problem to the ordering of my company backends, which happened to have readline-complete added last, causing it to be at the head of the list of backends which company tries for completions.
This ordering shouldn't make a difference, completion backends should check if they can perform completions at all. It appears that company-readline does not check whether there is actually a readline-enabled process running in the current buffer.

I would suggest doing something like what is done in the company-bbdb backend: create a (customizable) variable which lists in which modes readline-complete can do completions, and in the completion backend do a test whether the conditions for attempting completion are satisfied, i.e. return nil when completion using this backend is not possible.

Thanks for the report. Would you be interested in submitting a PR? I'm not actively maintaining rlc anymore and I am trying to get more people familiar with the (small) codebase.

I was using readline-complete in Ubuntu with company mode on emacs shells and it was working like a charm; but now I switched to Arch and company shuts down instantantly without showing any completion candidate.
I must note though that I had Emacs 25.1.2 in Ubuntu and now I have Emacs 25.1.1 in Arch.
Is it due to changes in emacs' shell.el? any clues of why is this happening?