From d83e843404e065eeeec535ebffe0ee72643cb488 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Tue, 11 Jun 2019 08:12:01 -0700 Subject: [PATCH] =?UTF-8?q?Enable=20=E2=80=98auto-fill-mode=E2=80=99=20in?= =?UTF-8?q?=20Java?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- oni-java.el | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/oni-java.el b/oni-java.el index 319b2a2..73a254a 100644 --- a/oni-java.el +++ b/oni-java.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 20190528071542 +;; Version: 20190611081136 ;; 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 @@ -33,6 +33,10 @@ "Format the buffer before save." (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 (oni-data-dir-locate "lsp-java/server/")) @@ -42,11 +46,13 @@ (setq lsp-java-workspace-cache-dir (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-pair-local-mode) (add-hook 'java-mode-hook 'fci-mode) (add-hook 'java-mode-hook 'lsp) -(add-hook 'java-mode-hook 'oni-java-enable-buffer-formatting) (add-to-list 'company-backends 'company-lsp)