branch: elpa/lua-mode
commit aee46da90413a3706fbafee5e5291f1415e65e32
Author: edam <[email protected]>
Commit: edam <[email protected]>
added lua-indent-nested-block-content-align var
---
README.md | 3 ++-
lua-mode.el | 13 ++++++++++++-
2 files changed, 14 insertions(+), 2 deletions(-)
diff --git a/README.md b/README.md
index d2bcee5..536d482 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,7 @@ modules to your Emacs and keeping them up-to-date. Once you
have **el-get** set
and updating is no more than
<M-x> el-get-update "lua-mode"`
-
+
Please, consult with [el-get
documentation](https://github.com/dimitri/el-get/blob/master/README.md) for
further information.
### MANUAL INSTALLATION
@@ -53,6 +53,7 @@ The following variables are available for customization (see
more via `M-x custo
- Var `lua-indent-level` (default `3`): indentation offset in spaces
- Var `lua-indent-string-contents` (default `nil`): set to `t` if you like to
have contents of multiline strings to be indented like comments
+- Var `lua-indent-nested-block-content-align` (default `t`) set to `nil` to
stop aligning the content of nested blocks with the open parenthesis
- Var `lua-mode-hook`: list of functions to execute when lua-mode is
initialized
- Var `lua-documentation-url` (default
`"http://www.lua.org/manual/5.1/manual.html#pdf-"`): base URL for documentation
lookup
- Var `lua-documentation-function` (default `browse-url`): function used to
show documentation (`eww` is a viable alternative for Emacs 25)
diff --git a/lua-mode.el b/lua-mode.el
index af94a13..ed8484d 100644
--- a/lua-mode.el
+++ b/lua-mode.el
@@ -52,6 +52,9 @@
;; - Var `lua-indent-string-contents':
;; set to `t` if you like to have contents of multiline strings to be
;; indented like comments
+;; - Var `lua-indent-nested-block-content-align':
+;; set to `nil' to stop aligning the content of nested blocks with the
+;; open parenthesis
;; - Var `lua-mode-hook':
;; list of functions to execute when lua-mode is initialized
;; - Var `lua-documentation-url':
@@ -359,6 +362,13 @@ Otherwise leading amount of whitespace on each line is
preserved."
:group 'lua
:type 'boolean)
+(defcustom lua-indent-nested-block-content-align t
+ "If non-nil, the contents of nested blocks are indented to
+align with the column of the opening parenthesis, rather than
+just forward by `lua-indent-level'."
+ :group 'lua
+ :type 'boolean)
+
(defcustom lua-jump-on-traceback t
"*Jump to innermost traceback location in *lua* buffer. When this
variable is non-nil and a traceback occurs when running Lua code in a
@@ -1260,7 +1270,8 @@ use standalone."
(cons 'relative lua-indent-level))
;; block openers
- ((member found-token (list "{" "(" "["))
+ ((and lua-indent-nested-block-content-align
+ (member found-token (list "{" "(" "[")))
(save-excursion
(let ((found-bol (line-beginning-position)))
(forward-comment (point-max))