diff options
| author | Dmitry Gutov | 2015-10-15 22:34:18 +0300 |
|---|---|---|
| committer | Dmitry Gutov | 2015-10-15 22:36:08 +0300 |
| commit | 360d1d8caa1db0ffa7d0c02d4f03a4c921155c5a (patch) | |
| tree | 30b87cc589d07a639882410cc273dffa17ff0bc9 /lisp | |
| parent | b4c00f9ac9d57eca8f2a4950fca6198065dbdcd0 (diff) | |
| download | emacs-360d1d8caa1db0ffa7d0c02d4f03a4c921155c5a.tar.gz emacs-360d1d8caa1db0ffa7d0c02d4f03a4c921155c5a.zip | |
js-mode: Don't misindent generator methods
* lisp/progmodes/js.el (js--looking-at-operator-p): Distinguish
generator methods from multiplication operator
(https://github.com/mooz/js2-mode/issues/275).
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/progmodes/js.el | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index f2140159e64..5a4f383337e 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el | |||
| @@ -1751,11 +1751,18 @@ This performs fontification according to `js--class-styles'." | |||
| 1751 | "Return non-nil if point is on a JavaScript operator, other than a comma." | 1751 | "Return non-nil if point is on a JavaScript operator, other than a comma." |
| 1752 | (save-match-data | 1752 | (save-match-data |
| 1753 | (and (looking-at js--indent-operator-re) | 1753 | (and (looking-at js--indent-operator-re) |
| 1754 | (or (not (looking-at ":")) | 1754 | (or (not (eq (char-after) ?:)) |
| 1755 | (save-excursion | 1755 | (save-excursion |
| 1756 | (and (js--re-search-backward "[?:{]\\|\\_<case\\_>" nil t) | 1756 | (and (js--re-search-backward "[?:{]\\|\\_<case\\_>" nil t) |
| 1757 | (looking-at "?"))))))) | 1757 | (eq (char-after) ??)))) |
| 1758 | 1758 | (not (and | |
| 1759 | (eq (char-after) ?*) | ||
| 1760 | (looking-at (concat "\\* *" js--name-re " *(")) | ||
| 1761 | (save-excursion | ||
| 1762 | (goto-char (1- (match-end 0))) | ||
| 1763 | (let (forward-sexp-function) (forward-sexp)) | ||
| 1764 | (js--forward-syntactic-ws) | ||
| 1765 | (eq (char-after) ?{))))))) | ||
| 1759 | 1766 | ||
| 1760 | (defun js--continued-expression-p () | 1767 | (defun js--continued-expression-p () |
| 1761 | "Return non-nil if the current line continues an expression." | 1768 | "Return non-nil if the current line continues an expression." |