Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to show all possible completions hippie-expand command creates in Emacs?

I want to list all items that hippie-expand creates, then choose from them by moving the cursor and hitting RET. Is there any way to do this?

like image 805
Kei Minagawa Avatar asked Jan 09 '14 13:01

Kei Minagawa


2 Answers

Here's what I'm using for this purpose:

(global-set-key (kbd "M-i") 'complete-with-helm)
(require 'ac-helm)
(require 'auto-complete-config)
(ac-config-default)
(defun ac-complete-with-helm-auto ()
  "Select `auto-complete' candidates by `helm'.
It is useful to narrow candidates."
  (interactive)
  (let ((c (ac-candidates)))
    (if (= (length c) 1)
        (ac-expand)
      (when ac-completing
        (with-helm-show-completion ac-point ac-last-point
          (helm :sources 'helm-source-auto-complete-candidates
                :buffer  "*helm auto-complete*"))))))
(defun complete-with-helm ()
  (interactive)
  (ignore-errors
    (call-interactively 'auto-complete)
    (call-interactively 'ac-complete-with-helm-auto)))

Necessary packages are auto-complete, helm, and ac-helm. All of them you can get from the package manager.

like image 91
abo-abo Avatar answered Sep 30 '22 12:09

abo-abo


use company-mode. all the UI issues already resolved in company-mode

like image 21
chen bin Avatar answered Sep 30 '22 12:09

chen bin