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

3

6

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?

Cryptic answered 9/1, 2014 at 13:13 Comment(0)
P
2

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.

Psoriasis answered 9/1, 2014 at 13:20 Comment(1)
It's so complicated and over spec. But it seems useful. I will use it. Thanks.Cryptic
P
2

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

Pawl answered 27/3, 2015 at 13:44 Comment(0)
C
1

I wrote the following answer to a similar question a while ago. It uses the ido interface for selection, but it should be straightforward to adapt to another selection interface.

How to configure emacs to have it complete the path automatically like vim?

Cackle answered 9/1, 2014 at 14:2 Comment(1)
It seems what I wanted. I need some hacks on hippie-exp.el. It's very hard for me. Anyway thanks.Cryptic

© 2022 - 2024 — McMap. All rights reserved.