1
0
mirror of https://git.savannah.gnu.org/git/emacs.git synced 2025-01-28 19:42:02 +00:00

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.
This commit is contained in:
Dmitry Gutov 2014-11-16 14:19:16 +02:00
parent 202f4941dc
commit c613f4d6c1
3 changed files with 18 additions and 2 deletions

View 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).

View 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 ()

View 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