[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] [emacs] 01/01: Fix indentation before `!=' and after `+='
From: |
Dmitry Gutov |
Subject: |
[Emacs-diffs] [emacs] 01/01: Fix indentation before `!=' and after `+=' |
Date: |
Sun, 16 Nov 2014 12:19:43 +0000 |
dgutov pushed a commit to branch emacs-24
in repository emacs.
commit c613f4d6c12ad7a8ebbc88dcef48949c6a775996
Author: Dmitry Gutov <address@hidden>
Date: Sun Nov 16 14:19:16 2014 +0200
Fix indentation before `!=' and after `+='
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 | 8 ++++++++
lisp/progmodes/js.el | 4 ++--
test/indent/js.js | 8 ++++++++
3 files changed, 18 insertions(+), 2 deletions(-)
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ea9c8c6..442b8f6 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,11 @@
+2014-11-16 Dmitry Gutov <address@hidden>
+
+ 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 <address@hidden>
* window.el (handle-select-window): Deactivate shift-region (bug#19003).
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index a8f0d55..56569e1 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -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 ()
diff --git a/test/indent/js.js b/test/indent/js.js
index d623a0d..1924094 100644
--- a/test/indent/js.js
+++ b/test/indent/js.js
@@ -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