1
0
Fork 0

Enable ‘auto-fill-mode’ in Java

This commit is contained in:
Tom Willemse 2019-06-11 08:12:01 -07:00
parent 585e6b4e76
commit d83e843404

View file

@ -4,7 +4,7 @@
;; Author: Tom Willemse <tom@ryuslash.org> ;; Author: Tom Willemse <tom@ryuslash.org>
;; Keywords: local ;; Keywords: local
;; Version: 20190528071542 ;; Version: 20190611081136
;; Package-Requires: (oni-fci oni-data-dir lsp-java company-lsp lsp-ui) ;; Package-Requires: (oni-fci oni-data-dir lsp-java company-lsp lsp-ui)
;; This program is free software; you can redistribute it and/or modify ;; This program is free software; you can redistribute it and/or modify
@ -33,6 +33,10 @@
"Format the buffer before save." "Format the buffer before save."
(add-hook 'before-save-hook 'lsp-format-buffer nil :local)) (add-hook 'before-save-hook 'lsp-format-buffer nil :local))
(defun oni-java-only-fill-comments ()
"Set `comment-auto-fill-only-comments' to true locally."
(setq-local comment-auto-fill-only-comments t))
(setq lsp-java-server-install-dir (setq lsp-java-server-install-dir
(oni-data-dir-locate "lsp-java/server/")) (oni-data-dir-locate "lsp-java/server/"))
@ -42,11 +46,13 @@
(setq lsp-java-workspace-cache-dir (setq lsp-java-workspace-cache-dir
(oni-data-dir-locate "lsp-java/workspace/cache/")) (oni-data-dir-locate "lsp-java/workspace/cache/"))
(add-hook 'java-mode-hook 'electric-pair-local-mode) (add-hook 'java-mode-hook #'oni-java-enable-buffer-formatting)
(add-hook 'java-mode-hook #'oni-java-only-fill-comments)
(add-hook 'java-mode-hook 'auto-fill-mode)
(add-hook 'java-mode-hook 'electric-indent-local-mode) (add-hook 'java-mode-hook 'electric-indent-local-mode)
(add-hook 'java-mode-hook 'electric-pair-local-mode)
(add-hook 'java-mode-hook 'fci-mode) (add-hook 'java-mode-hook 'fci-mode)
(add-hook 'java-mode-hook 'lsp) (add-hook 'java-mode-hook 'lsp)
(add-hook 'java-mode-hook 'oni-java-enable-buffer-formatting)
(add-to-list 'company-backends 'company-lsp) (add-to-list 'company-backends 'company-lsp)