Skip to content

Commit

Permalink
Special case when an argument is called with no args in the line
Browse files Browse the repository at this point in the history
  • Loading branch information
dakrone committed Oct 28, 2015
1 parent 490cdfa commit 2c16adb
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion .dir-locals.el
Original file line number Diff line number Diff line change
Expand Up @@ -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)
'+
Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 2c16adb

Please sign in to comment.