[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#15582: notes on js-mode indentation bug
From: |
Dmitry Gutov |
Subject: |
bug#15582: notes on js-mode indentation bug |
Date: |
Sat, 14 Jan 2017 06:51:25 +0300 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:51.0) Gecko/20100101 Thunderbird/51.0 |
On 10.01.2017 08:03, Tom Tromey wrote:
It would be helpful to know when the continued-expr-p branch really is
supposed to trigger. Or, if there is an informal corpus of indentation
tests, it would be nice to put them all into js-tests.el.
It triggers, for instance, in this example:
b +=
c
But you have probably found it already.
Tom
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 1484b79..0551f2a 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -1771,6 +1771,24 @@ js--looking-at-operator-p
;; return NaN anyway. Shouldn't be a problem.
(memq (char-before) '(?, ?} ?{))))))))
+(defun js--find-newline-backward ()
+ "Move backward to the nearest newline that is not in a block comment."
You might want to phrase it like "Move ... ignoring comments.", meaning
treating the openers of non-block comments as newlines, and the contents
of block comments as entirely invisible.
BTW, here are a couple of examples that the new fix doesn't handle:
b += /* found */
c
b += /*
*/
c
(I think they suggest that the block comment-related behavior of the new
function might be tweaked a little).
Thanks.