From e1ff5ceda59a2a524ce76b6e7473c013f2e11316 Mon Sep 17 00:00:00 2001 From: Tom Willemse Date: Tue, 23 Jul 2019 22:53:51 -0700 Subject: [PATCH] Add auto-insert setting for Java --- oni-java.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/oni-java.el b/oni-java.el index 7ad0e83..f680698 100644 --- a/oni-java.el +++ b/oni-java.el @@ -4,7 +4,7 @@ ;; Author: Tom Willemse ;; Keywords: local -;; Version: 20190710075522 +;; Version: 20190723225257 ;; Package-Requires: (oni-fci oni-data-dir lsp-java company-lsp lsp-ui hydra) ;; This program is free software; you can redistribute it and/or modify @@ -26,6 +26,7 @@ ;;; Code: +(require 'autoinsert) (require 'hydra) (require 'lsp-java) (require 'oni-data-dir) @@ -63,6 +64,14 @@ (define-key java-mode-map (kbd "C-c r") 'java-refactor-hydra/body) +(add-to-list 'auto-insert-alist + '("\\.java\\'" + () "public class " + (file-name-sans-extension + (file-name-nondirectory (buffer-file-name))) " {\n" + (indent-for-tab-command) _ "\n" + "}")) + ;;;###autoload(with-eval-after-load 'cc-mode (require 'oni-java)) (provide 'oni-java)