From c4ee4c1456c2daaa90817fbb8ba8a214e0bd9a94 Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Mon, 7 Jun 2021 12:46:58 +0200 Subject: [PATCH] SLY: Re-enable company completion. Seems better overall, just need to make sure we don't miss symbols. --- .emacs.d/lisp/init-sly.el | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/.emacs.d/lisp/init-sly.el b/.emacs.d/lisp/init-sly.el index 54bbd7ac..bac8b63c 100644 --- a/.emacs.d/lisp/init-sly.el +++ b/.emacs.d/lisp/init-sly.el @@ -237,25 +237,29 @@ Good substitute for `sly-mrepl-indent-and-complete-symbol'." (when (require 'helm-sly nil 'noerror) (add-hook 'sly-mrepl-hook #'helm-sly-disable-internal-completion) ;; REVIEW: Company completion has the benefit of having annotations. - ;; (when (require 'helm-company nil :noerror) - ;; (add-hook 'lisp-mode-hook #'company-mode) - ;; (define-key lisp-mode-map (kbd "") 'ambrevar/indent-and-helm-company) - ;; (define-key lisp-mode-map (kbd "M-") 'ambrevar/indent-and-helm-company) - ;; (defun ambrevar/sly-set-keys () - ;; (define-key sly-mrepl-mode-map (kbd "") 'ambrevar/indent-and-helm-company) - ;; (define-key sly-mrepl-mode-map (kbd "M-") 'ambrevar/indent-and-helm-company)) - ;; (add-hook 'sly-mrepl-hook #'ambrevar/sly-set-keys) - ;; (add-hook 'sly-mrepl-hook #'company-mode)) - ) -;; Cons of internal completion vs. company completion. + (when (require 'helm-company nil :noerror) + (setq helm-company-initialize-pattern-with-prefix t) + (add-hook 'lisp-mode-hook #'company-mode) + (define-key lisp-mode-map (kbd "") 'ambrevar/indent-and-helm-company) + (define-key lisp-mode-map (kbd "M-") 'ambrevar/indent-and-helm-company) + (defun ambrevar/sly-set-keys () + (define-key sly-mrepl-mode-map (kbd "") 'ambrevar/indent-and-helm-company) + (define-key sly-mrepl-mode-map (kbd "M-") 'ambrevar/indent-and-helm-company)) + (add-hook 'sly-mrepl-hook #'ambrevar/sly-set-keys) + (add-hook 'sly-mrepl-hook #'company-mode))) +;; Pros and cons of internal completion vs. company completion. +;; Cons: ;; - Internal does not support spaces like Helm does. ;; - Word order matters. ;; - Cannot complete against current package. ;; - [ ] File completion does not work. ;; Pros: -;; - Current suffix is included. +;; - [X] Current prefix is included in completion input. +;; Fix: (setq helm-company-initialize-pattern-with-prefix t) ;; - Less config. - +;; - Company seem to miss some symbols? +;; Problem with cache? +;; https://github.com/joaotavora/sly/issues/328 (when (require 'helm-selector nil :noerror) (require 'init-sly-selector))