Fix indentation for trailing parentheses

(people shouldn't write trailing parentheses anyway!)
This commit is contained in:
Lee Hinman 2015-10-22 10:54:01 -06:00
parent 182fda73c6
commit 490cdfac5c
1 changed files with 11 additions and 1 deletions

View File

@ -27,6 +27,14 @@
(forward-line -1) (forward-line -1)
(if (search-forward " -> {" start t) t nil)))) (if (search-forward " -> {" start t) t nil))))
(defun my/trailing-paren-p ()
"Returns true if point is a training paren and semicolon"
(save-excursion
(end-of-line)
(let ((endpoint (point)))
(beginning-of-line)
(if (re-search-forward "[ ]*);$" endpoint t) t nil))))
(defun my/arglist-cont-nonempty-indentation (arg) (defun my/arglist-cont-nonempty-indentation (arg)
(if (my/inside-java-lambda-p) (if (my/inside-java-lambda-p)
'+ '+
@ -40,6 +48,8 @@
(defun my/block-close (arg) (defun my/block-close (arg)
(if (my/inside-java-lambda-p) '- 0)) (if (my/inside-java-lambda-p) '- 0))
(defun my/arglist-close (arg) (if (my/trailing-paren-p) 0 '--))
(c-set-offset 'inline-open 0) (c-set-offset 'inline-open 0)
(c-set-offset 'topmost-intro-cont '+) (c-set-offset 'topmost-intro-cont '+)
(c-set-offset 'statement-block-intro 'my/statement-block-intro) (c-set-offset 'statement-block-intro 'my/statement-block-intro)
@ -53,7 +63,7 @@
(c-set-offset 'statement-cont '++) (c-set-offset 'statement-cont '++)
(c-set-offset 'arglist-intro 0) (c-set-offset 'arglist-intro 0)
(c-set-offset 'arglist-cont-nonempty '(my/arglist-cont-nonempty-indentation c-lineup-arglist)) (c-set-offset 'arglist-cont-nonempty '(my/arglist-cont-nonempty-indentation c-lineup-arglist))
(c-set-offset 'arglist-close '--) (c-set-offset 'arglist-close 'my/arglist-close)
(c-set-offset 'inexpr-class 0) (c-set-offset 'inexpr-class 0)
(c-set-offset 'access-label 0) (c-set-offset 'access-label 0)
(c-set-offset 'inher-intro '++) (c-set-offset 'inher-intro '++)