Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions lua-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,15 @@ for Emacsen that doesn't contain one (pre-23.3)."
:type 'integer
:group 'lua)

(defcustom lua-hanging-indent-level 3
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why this is not called lua-continuation-indent-level?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Wed, Sep 23, 2015 at 9:40 AM, dennis again notifications@github.com wrote:

In lua-mode.el:

@@ -230,6 +230,15 @@ for Emacsen that doesn't contain one (pre-23.3)."
:type 'integer
:group 'lua)

+(defcustom lua-hanging-indent-level 3

Any reason why this is not called lua-continuation-indent-level?

I used a different word because not all line continuations are
indented this way. In particular:

local foo = functionName(varOne, varTwo,
                         varThree, varFour)

Feel free to change it, if you prefer something else.

Cheers,
Gabor

"Amount by which Lua line continuations are indented. This
affects multi-line statements in general, including lines
following an (, [ or { character at the end of the line, but not
those with an opening paren followed by non-whitespace characters
on the same line."
:type 'integer
:group 'lua)

(defcustom lua-comment-start "-- "
"Default value of `comment-start'."
:type 'string
Expand Down Expand Up @@ -1314,7 +1323,7 @@ use standalone."
(if (and (zerop (count-lines found-bol (line-beginning-position)))
(not (looking-at lua-indentation-modifier-regexp)))
(cons 'absolute (current-column))
(cons 'relative lua-indent-level)))))
(cons 'relative lua-hanging-indent-level)))))

;; These are not really block starters. They should not add to indentation.
;; The corresponding "then" and "do" handle the indentation.
Expand Down Expand Up @@ -1437,7 +1446,8 @@ and relative each, and the shift/column to indent to."
(if (lua-is-continuing-statement-p)
;; if it's the first continuation line, add one level
(unless (eq (car (car indentation-info)) 'continued-line)
(push (cons 'continued-line lua-indent-level) indentation-info))
(push (cons 'continued-line lua-hanging-indent-level)
indentation-info))

;; if it's the first non-continued line, subtract one level
(when (eq (car (car indentation-info)) 'continued-line)
Expand Down