aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorIngo Lohmar2017-07-01 13:09:20 +0200
committerIngo Lohmar2017-07-03 20:06:27 +0200
commit9ac7dccc51ee834b06cdabf6a5746eb375f984f0 (patch)
treee828d23bc109d4576169f782dba1982c840f822c /lisp
parentcaf92449802ea2250d6ac30a01797b0554d71dc3 (diff)
downloademacs-9ac7dccc51ee834b06cdabf6a5746eb375f984f0.tar.gz
emacs-9ac7dccc51ee834b06cdabf6a5746eb375f984f0.zip
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')
-rw-r--r--lisp/progmodes/js.el8
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."
475 :type 'boolean 475 :type 'boolean
476 :group 'js) 476 :group 'js)
477 477
478(defcustom js-indent-align-list-continuation t
479 "Align continuation of non-empty ([{ lines in `js-mode'."
480 :type 'boolean
481 :group 'js)
482
478(defcustom js-comment-lineup-func #'c-lineup-C-comments 483(defcustom js-comment-lineup-func #'c-lineup-C-comments
479 "Lineup function for `cc-mode-style', for C comments in `js-mode'." 484 "Lineup function for `cc-mode-style', for C comments in `js-mode'."
480 :type 'function 485 :type 'function
@@ -2092,7 +2097,8 @@ indentation is aligned to that column."
2092 (switch-keyword-p (looking-at "default\\_>\\|case\\_>[^:]")) 2097 (switch-keyword-p (looking-at "default\\_>\\|case\\_>[^:]"))
2093 (continued-expr-p (js--continued-expression-p))) 2098 (continued-expr-p (js--continued-expression-p)))
2094 (goto-char (nth 1 parse-status)) ; go to the opening char 2099 (goto-char (nth 1 parse-status)) ; go to the opening char
2095 (if (looking-at "[({[]\\s-*\\(/[/*]\\|$\\)") 2100 (if (or (not js-indent-align-list-continuation)
2101 (looking-at "[({[]\\s-*\\(/[/*]\\|$\\)"))
2096 (progn ; nothing following the opening paren/bracket 2102 (progn ; nothing following the opening paren/bracket
2097 (skip-syntax-backward " ") 2103 (skip-syntax-backward " ")
2098 (when (eq (char-before) ?\)) (backward-list)) 2104 (when (eq (char-before) ?\)) (backward-list))