about summary refs log tree commit diff stats
path: root/.emacs.d/lisp
diff options
context:
space:
mode:
authorDavid Morgan <djm_uk@protonmail.com>2022-12-05 12:24:06 +0000
committerDavid Morgan <djm_uk@protonmail.com>2022-12-05 12:24:06 +0000
commit8de452cf8906b63fc58ef9f20dc49d37657dbf30 (patch)
tree7df4f33ef67a16996397250b6fdf3e9bb484112e /.emacs.d/lisp
parentc3ad45ac280a1d52b28a4245b85fe1602434d123 (diff)
downloaddotfiles-8de452cf8906b63fc58ef9f20dc49d37657dbf30.tar.gz
Make cider completion work with corfu
Diffstat (limited to '.emacs.d/lisp')
-rw-r--r--.emacs.d/lisp/init-clojure.el14
1 files changed, 14 insertions, 0 deletions
diff --git a/.emacs.d/lisp/init-clojure.el b/.emacs.d/lisp/init-clojure.el
index 6b3b8e9..0732656 100644
--- a/.emacs.d/lisp/init-clojure.el
+++ b/.emacs.d/lisp/init-clojure.el
@@ -135,6 +135,20 @@
   (unbind-key "C-c C-l" cider-mode-map)
   (unbind-key "C-c C-b" cider-mode-map)
   (unbind-key "C-c C-b" cider-repl-mode-map)
+
+  ;; https://github.com/clojure-emacs/cider/issues/3019#issuecomment-1330342147
+  (defun my/cider-complete-at-point ()
+    "Complete the symbol at point."
+    (when (and (cider-connected-p)
+               (not (cider-in-string-p)))
+      (when-let* ((bounds (bounds-of-thing-at-point 'symbol))
+                  (beg (car bounds))
+                  (end (cdr bounds))
+                  (completion (append (cider-complete (buffer-substring beg end))
+                                      (get-text-property (point) 'cider-locals))))
+        (list beg end (completion-table-dynamic (lambda (_) completion))
+              :annotation-function #'cider-annotate-symbol))))
+  (advice-add 'cider-complete-at-point :override 'my/cider-complete-at-point)
   :bind
   (:map cider-mode-map
         ("C-c M-l" . cider-load-file)