about summary refs log tree commit diff
path: root/.emacs.d/lang
diff options
context:
space:
mode:
Diffstat (limited to '.emacs.d/lang')
-rw-r--r--.emacs.d/lang/clojure.el26
-rw-r--r--.emacs.d/lang/java.el38
-rw-r--r--.emacs.d/lang/lisp.el9
-rw-r--r--.emacs.d/lang/lua.el11
4 files changed, 84 insertions, 0 deletions
diff --git a/.emacs.d/lang/clojure.el b/.emacs.d/lang/clojure.el
new file mode 100644
index 0000000..804fcc7
--- /dev/null
+++ b/.emacs.d/lang/clojure.el
@@ -0,0 +1,26 @@
+(use-package cider
+  :ensure t)
+
+(add-hook 'cider-repl-mode-hook (lambda () (display-line-numbers-mode -1)))
+(add-hook 'cider-repl-mode-hook #'smartparens-mode)
+(add-hook 'clojure-mode #'eglot-ensure t)
+
+(setq-default cider-eldoc-display-for-symbol-at-point nil)
+
+(defun mu-cider-disable-eldoc ()
+  "Let LSP handle ElDoc instead of CIDER."
+  (remove-hook 'eldoc-documentation-functions #'cider-eldoc t))
+
+(add-hook 'cider-mode-hook #'mu-cider-disable-eldoc)
+
+(defun mu-cider-disable-eldoc ()
+  "Let LSP handle ElDoc instead of CIDER."
+  (remove-hook 'eldoc-documentation-functions #'cider-eldoc t))
+
+(add-hook 'cider-mode-hook #'mu-cider-disable-eldoc)
+
+(defun mu-cider-disable-completion ()
+  "Let LSP handle completion instead of CIDER."
+  (remove-hook 'completion-at-point-functions #'cider-complete-at-point t))
+
+(add-hook 'cider-mode-hook #'mu-cider-disable-completion)
diff --git a/.emacs.d/lang/java.el b/.emacs.d/lang/java.el
new file mode 100644
index 0000000..5d41a0c
--- /dev/null
+++ b/.emacs.d/lang/java.el
@@ -0,0 +1,38 @@
+;; Emacs Configuration for Java
+
+; JDT URI fix for JDTLS from https://www.reddit.com/r/emacs/comments/1ibkh2h/comment/m9slw00/
+(with-eval-after-load 'eglot
+  (add-to-list 'eglot-server-programs
+               `((java-mode java-ts-mode) .
+                 ("jdtls"
+                  :initializationOptions
+                  (:extendedClientCapabilities (:classFileContentsSupport t))))))
+
+(defun jdt-file-name-handler (operation &rest args)
+  "Support Eclipse jdtls `jdt://' uri scheme."
+  (let* ((uri (car args))
+         (cache-dir "/tmp/.eglot")
+         (source-file
+          (expand-file-name
+           (file-name-concat
+            cache-dir
+            (save-match-data
+              (when (string-match "jdt://contents/\\(.*?\\)/\\(.*\\)\.class\\?" uri)
+                (format "%s.java" (replace-regexp-in-string "/" "." (match-string 2 uri) t t))))))))
+    (unless (file-readable-p source-file)
+      (let ((content (jsonrpc-request (eglot-current-server) :java/classFileContents (list :uri uri)))
+            (metadata-file (format "%s.%s.metadata"
+                                   (file-name-directory source-file)
+                                   (file-name-base source-file))))
+        (unless (file-directory-p cache-dir) (make-directory cache-dir t))
+        (with-temp-file source-file (insert content))
+        (with-temp-file metadata-file (insert uri))))
+    source-file))
+(add-to-list 'file-name-handler-alist '("\\`jdt://" . jdt-file-name-handler))
+
+(add-hook 'java-mode-hook #'eglot-ensure t)
+
+(load-file
+   (expand-file-name
+    "pkg/consult-jdt.el"
+    user-emacs-directory))
diff --git a/.emacs.d/lang/lisp.el b/.emacs.d/lang/lisp.el
new file mode 100644
index 0000000..b0aebd3
--- /dev/null
+++ b/.emacs.d/lang/lisp.el
@@ -0,0 +1,9 @@
+(use-package sly
+  :ensure t
+  :config
+  (setq inferior-lisp-program "ros -L sbcl -Q run"
+        browse-url-browser-function '(("hyperspec" . eww-browse-url) ("." . browse-url-default-browser)))
+  (add-hook 'sly-mrepl-mode-hook 'smartparens-mode)
+  (add-hook 'lisp-mode-hook
+            (lambda ()
+              (define-key lisp-mode-map (kbd "C-c d") 'sly-documentation))))
diff --git a/.emacs.d/lang/lua.el b/.emacs.d/lang/lua.el
new file mode 100644
index 0000000..dfc1b19
--- /dev/null
+++ b/.emacs.d/lang/lua.el
@@ -0,0 +1,11 @@
+;; Emacs Configuration for Lua
+
+(use-package lua-mode
+  :ensure t
+  :config
+  (add-hook 'lua-mode-hook #'eglot-ensure t)
+  (setq lua-indent-level 2
+        lua-documentation-url "https://www.lua.org/manual/5.4/manual.html"))
+
+; TODO Try fix this only for lua-mode as that is where the bug is
+(setq eglot-ignored-server-capabilities '(:documentOnTypeFormattingProvider))