1 ((java-mode 2 . 3 ((eval 4 . 5 (progn 6 (defun my/point-in-defun-declaration-p () 7 (let ((bod (save-excursion (c-beginning-of-defun) 8 (point)))) 9 (<= bod 10 (point) 11 (save-excursion (goto-char bod) 12 (re-search-forward "{") 13 (point))))) 14 15 (defun my/is-string-concatenation-p () 16 "Returns true if the previous line is a string concatenation" 17 (save-excursion 18 (let ((start (point))) 19 (forward-line -1) 20 (if (re-search-forward " \\\+$" start t) t nil)))) 21 22 (defun my/inside-java-lambda-p () 23 "Returns true if point is the first statement inside of a lambda" 24 (save-excursion 25 (c-beginning-of-statement-1) 26 (let ((start (point))) 27 (forward-line -1) 28 (if (search-forward " -> {" start t) t nil)))) 29 30 (defun my/trailing-paren-p () 31 "Returns true if point is a training paren and semicolon" 32 (save-excursion 33 (end-of-line) 34 (let ((endpoint (point))) 35 (beginning-of-line) 36 (if (re-search-forward "[ ]*);$" endpoint t) t nil)))) 37 38 (defun my/prev-line-call-with-no-args-p () 39 "Return true if the previous line is a function call with no arguments" 40 (save-excursion 41 (let ((start (point))) 42 (forward-line -1) 43 (if (re-search-forward ".($" start t) t nil)))) 44 45 (defun my/arglist-cont-nonempty-indentation (arg) 46 (if (my/inside-java-lambda-p) 47 '+ 48 (if (my/is-string-concatenation-p) 49 16 50 (unless (my/point-in-defun-declaration-p) '++)))) 51 52 (defun my/statement-block-intro (arg) 53 (if (and (c-at-statement-start-p) (my/inside-java-lambda-p)) 0 '+)) 54 55 (defun my/block-close (arg) 56 (if (my/inside-java-lambda-p) '- 0)) 57 58 (defun my/arglist-close (arg) (if (my/trailing-paren-p) 0 '--)) 59 60 (defun my/arglist-intro (arg) 61 (if (my/prev-line-call-with-no-args-p) '++ 0)) 62 63 (c-set-offset 'inline-open 0) 64 (c-set-offset 'topmost-intro-cont '+) 65 (c-set-offset 'statement-block-intro 'my/statement-block-intro) 66 (c-set-offset 'block-close 'my/block-close) 67 (c-set-offset 'knr-argdecl-intro '+) 68 (c-set-offset 'substatement-open '+) 69 (c-set-offset 'substatement-label '+) 70 (c-set-offset 'case-label '+) 71 (c-set-offset 'label '+) 72 (c-set-offset 'statement-case-open '+) 73 (c-set-offset 'statement-cont '++) 74 (c-set-offset 'arglist-intro 'my/arglist-intro) 75 (c-set-offset 'arglist-cont-nonempty '(my/arglist-cont-nonempty-indentation c-lineup-arglist)) 76 (c-set-offset 'arglist-close 'my/arglist-close) 77 (c-set-offset 'inexpr-class 0) 78 (c-set-offset 'access-label 0) 79 (c-set-offset 'inher-intro '++) 80 (c-set-offset 'inher-cont '++) 81 (c-set-offset 'brace-list-intro '+) 82 (c-set-offset 'func-decl-cont '++) 83 )) 84 (c-basic-offset . 4) 85 (c-comment-only-line-offset . (0 . 0)) 86 (fill-column . 140) 87 (fci-rule-column . 140) 88 (compile-command . "gradle compileTestJava"))))