Calling this pivotal macro "def-package!" has frequently been a source of confusion. It is a thin wrapper around use-package, and it should be obvious that it is so. For this reason, and to match the naming convention used with other convenience macros/wrappers, it is now use-package!. Also changes def-package-hook! -> use-package-hook! The old macros are now marked obsolete and will be removed when straight integration is merged.
45 lines
1.4 KiB
EmacsLisp
45 lines
1.4 KiB
EmacsLisp
;;; lang/java/config.el -*- lexical-binding: t; -*-
|
|
|
|
(defvar +java-project-package-roots (list "java/" "test/" "main/" "src/" 1)
|
|
"A list of relative directories (strings) or depths (integer) used by
|
|
`+java-current-package' to delimit the namespace from the current buffer's full
|
|
file path. Each root is tried in sequence until one is found.
|
|
|
|
If a directory is encountered in the file path, everything before it (including
|
|
it) will be ignored when converting the path into a namespace.
|
|
|
|
An integer depth is how many directories to pop off the start of the relative
|
|
file path (relative to the project root). e.g.
|
|
|
|
Say the absolute path is ~/some/project/src/java/net/lissner/game/MyClass.java
|
|
The project root is ~/some/project
|
|
If the depth is 1, the first directory in src/java/net/lissner/game/MyClass.java
|
|
is removed: java.net.lissner.game.
|
|
If the depth is 2, the first two directories are removed: net.lissner.game.")
|
|
|
|
|
|
;;
|
|
;; java-mode
|
|
|
|
(add-hook 'java-mode-hook #'rainbow-delimiters-mode)
|
|
|
|
(cond ((featurep! +lsp) (load! "+lsp"))
|
|
((featurep! +meghanada) (load! "+meghanada")))
|
|
|
|
|
|
;;
|
|
;; Common packages
|
|
|
|
(use-package! android-mode
|
|
:commands android-mode
|
|
:init
|
|
(add-hook! (java-mode groovy-mode nxml-mode) #'+java|android-mode-maybe)
|
|
:config
|
|
(set-yas-minor-mode! 'android-mode))
|
|
|
|
|
|
(use-package! groovy-mode
|
|
:mode "\\.g\\(?:radle\\|roovy\\)$"
|
|
:config
|
|
(set-eval-handler! 'groovy-mode "groovy"))
|
|
|