GNU bug report logs - #15582
js-mode indent bug

Previous Next

Package: emacs;

Reported by: Jakub Jankiewicz <jcubic <at> onet.pl>

Date: Thu, 10 Oct 2013 12:39:01 UTC

Severity: minor

Done: Tom Tromey <tom <at> tromey.com>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 15582 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: Tom Tromey <tom <at> tromey.com>, 15582 <at> debbugs.gnu.org
Cc: Daniel Colascione <dan.colascione <at> gmail.com>
Subject: Re: bug#15582: notes on js-mode indentation bug
Date: Sat, 14 Jan 2017 06:51:25 +0300
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.




This bug report was last modified 8 years and 179 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.