summary refs log tree commit diff stats
path: root/user/emacs
diff options
context:
space:
mode:
authorAlan Pearce2023-04-23 22:38:24 +0200
committerAlan Pearce2023-04-30 19:38:15 +0200
commitdb728f16997c045162041920e359666dc413ea00 (patch)
tree6b55c582378c527dcef8093adf701baa08f0fa0f /user/emacs
parent215ad38f56fd49904c20af0d38233fc61d4d51ba (diff)
downloadnixfiles-db728f16997c045162041920e359666dc413ea00.tar.lz
nixfiles-db728f16997c045162041920e359666dc413ea00.tar.zst
nixfiles-db728f16997c045162041920e359666dc413ea00.zip
emacs: replace company-tabnine with tabnine-capf
Diffstat (limited to 'user/emacs')
-rw-r--r--user/emacs/init.el27
1 files changed, 8 insertions, 19 deletions
diff --git a/user/emacs/init.el b/user/emacs/init.el
index d75b2025..480c411b 100644
--- a/user/emacs/init.el
+++ b/user/emacs/init.el
@@ -516,27 +516,16 @@ _p_rev       _u_pper              _=_: upper/lower       _r_esolve
   :defer t
   :config (setq all-the-icons-color-icons nil))
 
-(defmacro company-set-secondary-backend-for-mode (mode backend)
-  (let ((hook-fn-name (intern (concat "ap/set-local-backend-" (symbol-name mode)))))
-    `(progn
-       (defun ,hook-fn-name ()
-         (make-local-variable 'company-backends)
-         (setq company-backends (append
-                                 (list
-                                  'company-tabnine
-                                  ,backend)
-                                 (copy-tree (remq 'company-tabnine company-backends)))))
-       (add-hook ',(derived-mode-hook-name mode) #',hook-fn-name))))
-
-(use-package company-tabnine
-  :commands (company-tabnine)
+(use-package tabnine-capf
+  :commands (tabnine-completion-at-point)
   :after (company)
-  :config (setq company-tabnine-binaries-folder "~/.local/tabnine")
-  :general ("<M-tab>" #'company-tabnine-call-other-backends
-            "<C-tab>" #'company-tabnine-call-other-backends)
+  :config (setq tabnine-capf-binaries-folder "~/.local/tabnine")
+  ;; use tabnine-capf-with-disabled
+  :general ("<M-tab>" #'tabnine-capf-call-other-backends
+            "<C-tab>" #'tabnine-capf-call-other-backends)
   :init (progn
-          (advice-add 'company-tabnine-start-process :around #'quiet)
-          (add-to-list 'company-backends #'company-tabnine)))
+          (advice-add 'tabnine-capf-start-process :around #'quiet)
+          (add-to-list 'company-backends #'tabnine-completion-at-point)))
 
 ;;; Documentation