emacs/user-lisp/langs/icejam-lang-java.el
Maciej Szlosarczyk ff0abe9f2e
All checks were successful
/ Test config on 20 (push) Successful in 24s
Set font differently
2026-06-28 11:23:09 +03:00

49 lines
1.5 KiB
EmacsLisp

;;; java -- summary -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:
(eval-when-compile
(declare-function column-enforce-n 'column-enforce-mode (number))
(declare-function icejam-set-indent 'icejam-prog-mode)
(declare-function icejam-set-eglot-capfs 'icejam-complete-at-point)
(declare-function transient-define-prefix 'transient)
(defvar icejam-java-lang-menu)
(defvar icejam-language-transient-alist))
(add-to-list 'auto-mode-alist '("\\.java\\'" . java-ts-mode))
;; (use-package eglot-java :ensure t)
(transient-define-prefix icejam-java-lang-menu ()
[[:description
(lambda ()
(concat (propertize "Code actions for " 'face 'transient-heading)
(propertize (format "%s" major-mode) 'face 'transient-key)
(propertize ":\n" 'face 'transient-heading)))
("m" "iMenu" consult-imenu)
("r" "Reload buffer" icejam-revert-buffer-no-confirm)
("e" "Show errors" flymake-show-buffer-diagnostics)
("f" "Format" eglot-format-buffer)
("q" "Quit" keyboard-quit)]])
(dolist (mode '(java-ts-mode))
(add-to-list 'icejam-language-transient-alist
`(,mode . icejam-java-lang-menu)))
(defun icejam-activate-java-mode ()
"Java mode overrides."
;; Set indentation to two spaces
(icejam-set-indent 2)
(setq-local java-ts-mode-indent-offset tab-width)
(eglot-ensure)
(column-enforce-n 80)
(icejam-set-eglot-capfs))
;; (add-hook 'java-ts-mode-hook 'eglot-java-mode)
(add-hook 'java-ts-mode-hook 'icejam-activate-java-mode)
(provide 'icejam-lang-java)
;;; icejam-lang-java.el ends here