doomemacs/modules/lang/java/config.el
Henrik Lissner a3e262c7ac
💥 Refactor add-hook! macro & change arg order
This update may potentially break your usage of add-hook! if you pass
the :local or :append properties to it. This is how they used to work:

  (add-hook! :append 'some-mode-hook #'do-something)

Thsoe properties must now follow the hooks, e.g.

  (add-hook! 'some-mode-hook :append #'do-something)

Other changes:
- Various add-hook calls have been renamed to add-hook! because I
  incorrectly assumed `defun` always returned its definition's symbol,
  when in fact, its return value is "undefined" (so sayeth the
  documentation). This should fix #1597.
- This update adds the ability to add multiple functions to hooks
  without a list:

    (add-hook! 'some-mode-hook
               #'do-something
               #'do-something-else)

- The indentation logic has been changed so that consecutive function
  symbols at indented at the same level as the first argument, but forms
  are indent like a defun.

    (add-hook! 'some-mode-hook
               #'do-something
               #'do-something-else)

    (add-hook! 'some-mode-hook
      (message "Hello"))
2019-07-26 20:17:29 +02:00

47 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-hook groovy-mode-hook nxml-mode-hook)
#'+java-android-mode-maybe-h)
:config
(set-yas-minor-mode! 'android-mode))
(use-package! groovy-mode
:mode "\\.g\\(?:radle\\|roovy\\)$"
:config
(set-eval-handler! 'groovy-mode "groovy"))