Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Using company-mode-backends with hippie-expand #328

Closed
jwiegley opened this Issue Mar 20, 2015 · 2 comments

Comments

Projects
None yet
2 participants

Is there any way to get company-mode's backends to feed completion candidates to hippie-expand?

Owner

dgutov commented Mar 20, 2015

Not that I know of. There's an adapter for Helm, which is an entirely different interface. Maybe someone can use a similar approach for hippie-expand.

This seems to work well enough:

  (defun my-try-expand-company (old)
    (unless company-candidates
      (company-auto-begin))
    (if (not old)
        (progn
          (he-init-string (he-lisp-symbol-beg) (point))
          (if (not (he-string-member he-search-string he-tried-table))
              (setq he-tried-table (cons he-search-string he-tried-table)))
          (setq he-expand-list
                (and (not (equal he-search-string ""))
                     company-candidates))))
    (while (and he-expand-list
                (he-string-member (car he-expand-list) he-tried-table))
      (setq he-expand-list (cdr he-expand-list)))
    (if (null he-expand-list)
        (progn
          (if old (he-reset-string))
          ())
      (progn
    (he-substitute-string (car he-expand-list))
    (setq he-expand-list (cdr he-expand-list))
    t)))

@jwiegley jwiegley closed this Mar 21, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment