]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix indentation before `!=' and after `+='
authorDmitry Gutov <dgutov@yandex.ru>
Sun, 16 Nov 2014 12:19:16 +0000 (14:19 +0200)
committerDmitry Gutov <dgutov@yandex.ru>
Sun, 16 Nov 2014 12:19:16 +0000 (14:19 +0200)
Originally reported in https://github.com/mooz/js2-mode/issues/174.
* lisp/progmodes/js.el (js--indent-operator-re): Make assignments and
(in)equality operator a separate case.
(js--continued-expression-p): Escape the second `+' in the regexp.

lisp/ChangeLog
lisp/progmodes/js.el
test/indent/js.js

index ea9c8c6b2cbdd174b56b3dfd36c71b6fa2fb4243..442b8f69e59297890dabf4d352480f036765bce5 100644 (file)
@@ -1,3 +1,11 @@
+2014-11-16  Dmitry Gutov  <dgutov@yandex.ru>
+
+       Fix indentation before `!=' and after `+='.  Originally reported
+       in https://github.com/mooz/js2-mode/issues/174.
+       * progmodes/js.el (js--indent-operator-re): Make assignments and
+       (in)equality operator a separate case.
+       (js--continued-expression-p): Escape the second `+' in the regexp.
+
 2014-11-16  Stefan Monnier  <monnier@iro.umontreal.ca>
 
        * window.el (handle-select-window): Deactivate shift-region (bug#19003).
index a8f0d556ec417e96f93beb3acd4cac087ba182fb..56569e1f97205ecd5eefb910ceb570f323659935 100644 (file)
@@ -1685,7 +1685,7 @@ This performs fontification according to `js--class-styles'."
   "Regular expression matching variable declaration keywords.")
 
 (defconst js--indent-operator-re
-  (concat "[-+*/%<>=&^|?:.]\\([^-+*/]\\|$\\)\\|"
+  (concat "[-+*/%<>&^|?:.]\\([^-+*/]\\|$\\)\\|!?=\\|"
           (js--regexp-opt-symbol '("in" "instanceof")))
   "Regexp matching operators that affect indentation of continued expressions.")
 
@@ -1712,7 +1712,7 @@ This performs fontification according to `js--class-styles'."
                     (save-excursion (backward-char) (not (looking-at "[/*]/")))
                     (js--looking-at-operator-p)
                    (and (progn (backward-char)
-                               (not (looking-at "++\\|--\\|/[/*]"))))))))))
+                               (not (looking-at "+\\+\\|--\\|/[/*]"))))))))))
 
 
 (defun js--end-of-do-while-loop-p ()
index d623a0dc5bcac89237199311a169f659d4f0465d..1924094e9d860778b9e137d16c471be731db89cf 100644 (file)
@@ -47,3 +47,11 @@ var p = {
 
 var evens = [e for each (e in range(0, 21))
                if (ed % 2 == 0)];
+
+!b
+  !=b
+  !==b
+
+a++
+b +=
+  c