diff options
| author | Ingo Lohmar <i.lohmar@gmail.com> | 2017-07-01 13:09:20 +0200 |
|---|---|---|
| committer | Ingo Lohmar <i.lohmar@gmail.com> | 2017-07-03 20:06:27 +0200 |
| commit | 9ac7dccc51ee834b06cdabf6a5746eb375f984f0 (patch) | |
| tree | e828d23bc109d4576169f782dba1982c840f822c /lisp/progmodes/js.el | |
| parent | caf92449802ea2250d6ac30a01797b0554d71dc3 (diff) | |
| download | emacs-9ac7dccc51ee834b06cdabf6a5746eb375f984f0.tar.gz | |
Offer non-aligned indentation in lists in js-mode (Bug#27503)
* lisp/progmodes/js.el (js--proper-indentation):
New customization option 'js-indent-align-list-continuation'.
Affects argument lists as well as arrays and object properties.
* test/manual/indent/js-indent-align-list-continuation-nil.js:
Test the change.
Diffstat (limited to 'lisp/progmodes/js.el')
| -rw-r--r-- | lisp/progmodes/js.el | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index bae9e52bf0f..e6ffe4d75a6 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -475,6 +475,11 @@ This applies to function movement, marking, and so on." :type 'boolean :group 'js) +(defcustom js-indent-align-list-continuation t + "Align continuation of non-empty ([{ lines in `js-mode'." + :type 'boolean + :group 'js) + (defcustom js-comment-lineup-func #'c-lineup-C-comments "Lineup function for `cc-mode-style', for C comments in `js-mode'." :type 'function @@ -2092,7 +2097,8 @@ indentation is aligned to that column." (switch-keyword-p (looking-at "default\\_>\\|case\\_>[^:]")) (continued-expr-p (js--continued-expression-p))) (goto-char (nth 1 parse-status)) ; go to the opening char - (if (looking-at "[({[]\\s-*\\(/[/*]\\|$\\)") + (if (or (not js-indent-align-list-continuation) + (looking-at "[({[]\\s-*\\(/[/*]\\|$\\)")) (progn ; nothing following the opening paren/bracket (skip-syntax-backward " ") (when (eq (char-before) ?\)) (backward-list)) |
