2

By default to move up (ctrl-p) and to move down (ctrl-n) key bindings are used.

When I am using auto-complete mode, a box with suggested words is pop up. On there when I press ctrl-p or ctrl-n instead of moving within the box, it closes from it. I can move around only by using tab or alt-p or alt-n.

enter image description here

[Q] Inside the box for suggessted word to auto-complete, is there any way to move around by ctrl-p and ctrl-n?

4
  • Not an answer, but a suggestion: If you're new to emacs and don't have any strong feelings either way, I would strongly suggest you move to use company-mode. It has IMO much better traction. I used to use ac-complete btw.
    – RichieHH
    Commented Feb 20, 2020 at 23:47
  • Did you try the vertical arrow keys, <up> and <down>? Often those are used (also or instead) in places where you might expect C-p and C-n, respectively, to be used .
    – Drew
    Commented Feb 21, 2020 at 0:05
  • vertical arrow keys work, but actually I get used to use ctrl-p and ctrl-n all the time @Drew
    – alper
    Commented Feb 21, 2020 at 6:45
  • Then bind C-p and C-n to the commands you want in the relevant keymap (maybe it's auto-complete-mode-map?).
    – Drew
    Commented Feb 21, 2020 at 16:50

1 Answer 1

2

You can configure that behaviour via customize.

Just do M-x customize-option <return> ac-use-menu-map <return>, then set this option to on (non-nil) and save it for future use.

Thats it.

How did I get this information? I looked at the source code. But it was also possible to find this from M-x customize-group <return> auto-complete <return>.


Nevertheless, I would recommend, switching to another completion framework (like company) because auto-complete seems abandoned. With last commit in Jan 2017.

Edit: To enable this behaviour with company, simply bind the keys and corresponding functions in companys keymap:

(with-eval-after-load "company"
  (define-key company-active-map (kbd "C-p") #'company-select-previous-or-abort)
  (define-key company-active-map (kbd "C-n") #'company-select-next-or-abort))
3
  • I can switch to company but same issue exist on it as well. Is there any way to handle it on company too?
    – alper
    Commented Feb 22, 2020 at 19:30
  • @alper yes, I edited my answer
    – jue
    Commented Feb 22, 2020 at 20:57
  • Thanks! It is possible to activate C-h for delete character as well on company? instead of deleting it says No documentation available.
    – alper
    Commented Feb 23, 2020 at 10:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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