From 2c16adb78430c544dedf02cc8c8306e3dba1e127 Mon Sep 17 00:00:00 2001 From: Lee Hinman Date: Wed, 28 Oct 2015 15:46:13 -0600 Subject: [PATCH] Special case when an argument is called with no args in the line --- .dir-locals.el | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.dir-locals.el b/.dir-locals.el index 9b0d487fb62..68db3a9248b 100644 --- a/.dir-locals.el +++ b/.dir-locals.el @@ -35,6 +35,13 @@ (beginning-of-line) (if (re-search-forward "[ ]*);$" endpoint t) t nil)))) + (defun my/prev-line-call-with-no-args-p () + "Return true if the previous line is a function call with no arguments" + (save-excursion + (let ((start (point))) + (forward-line -1) + (if (re-search-forward ".($" start t) t nil)))) + (defun my/arglist-cont-nonempty-indentation (arg) (if (my/inside-java-lambda-p) '+ @@ -50,6 +57,9 @@ (defun my/arglist-close (arg) (if (my/trailing-paren-p) 0 '--)) + (defun my/arglist-intro (arg) + (if (my/prev-line-call-with-no-args-p) '++ 0)) + (c-set-offset 'inline-open 0) (c-set-offset 'topmost-intro-cont '+) (c-set-offset 'statement-block-intro 'my/statement-block-intro) @@ -61,7 +71,7 @@ (c-set-offset 'label '+) (c-set-offset 'statement-case-open '+) (c-set-offset 'statement-cont '++) - (c-set-offset 'arglist-intro 0) + (c-set-offset 'arglist-intro 'my/arglist-intro) (c-set-offset 'arglist-cont-nonempty '(my/arglist-cont-nonempty-indentation c-lineup-arglist)) (c-set-offset 'arglist-close 'my/arglist-close) (c-set-offset 'inexpr-class 0)