1

I have recently encountered a problem with autocomplete when used together with linum. When I turn on the global-linum-mode, the emacs only shows part of the popped-up menu of candidates correctly. For example, after typing 'add' at line 11, several lines of the popup menu for autocomplete are blocked by white space after the first letter of the candidate words, as shown in the following figure:

enter image description here

After a few trials, I found the error occurs when the autocomplete is aroused if the word to be completed (in this case the word 'add') starts from the first or second column. In addition, to reproduce the error, the popup menu needs to be overlapped with some text in the document (there are text in line 12-18 in the example).

The following minimum configuration in the .emacs file can be used to reproduce the error:

(add-to-list 'load-path "~/.emacs.d/lisp")   
(require 'auto-complete-config)
(ac-config-default)
(add-to-list 'ac-dictionary-directories "~/.emacs.d/ac-dict") 
(global-auto-complete-mode t)
(defun auto-complete-mode-maybe ()
;  "No maybe for you. Only AC!"
  (unless (minibufferp (current-buffer))
    (auto-complete-mode 1)))

(require 'linum)
(global-linum-mode t)
(setq linum-format "%4d")

I use GNU Emacs 24.5.1 (x86_64-pc-linux-gnu, GTK+ Version 3.16.6) of 2015-09-17 on lgw01-52, modified by Debian on a linux machine (Ubuntu 15.10).

Any help is appreciated and please feel free to let me know if my question is unclear. Thank you.

EDIT: It seems that this is a bug in emacs 24.5, shown by the following link:

https://github.com/auto-complete/auto-complete/issues/402

In addition, the following error messages occur when the popup menu fails to show up completely:

Error running timer `ac-update-greedy': (wrong-type-argument wholenump -259)
Error running timer `ac-show-menu': (wrong-type-argument wholenump -120)

I will keep searching for solutions and update this question if I find one.

river_06
  • 11
  • 2
  • Consider trying Stefan's nlinum-mode instead of the built-in and see if it makes a difference. – lawlist Nov 26 '15 at 22:22
  • Another option (albeit a drastic one) is to try out `company-mode`. In my experience, it has less visual corruption, although that's hardly scientific. – PythonNut Nov 27 '15 at 17:11
  • Hi @lawlist Thank you for your suggestion, but I did not have much luck with nlinum-mode. The same problem persists. – river_06 Nov 27 '15 at 20:02
  • @PythonNut Thank you very much for your comment! I confirm that the company-mode does not have the same issue mentioned in my question. I played with it and I almost succeeded to configure company-mode to work the same way as auto-complete. There is one thing missing though, that I couldn't configure the TAB key to behave in the same way as in auto-complete, i.e., using tab to **select next**, to **complete common** and to **complete selection** at the same time. I guess I need to give up linum if I do not find another way around. – river_06 Nov 27 '15 at 21:05
  • Look a bit more for the solution. If you don't find it, ask another question here. The awesome thing about company is its extensibility. We will find a way. – PythonNut Nov 27 '15 at 21:07

0 Answers0