GNU bug report logs -
#26070
26.0.50; js-mode slash insertion bug
Previous Next
Reported by: Richard Copley <rcopley <at> gmail.com>
Date: Sun, 12 Mar 2017 10:25:02 UTC
Severity: normal
Found in version 26.0.50
Done: Tom Tromey <tom <at> tromey.com>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 22 March 2017 at 22:18, Tom Tromey <tom <at> tromey.com> wrote:
>>>>>> "Richard" == Richard Copley <rcopley <at> gmail.com> writes:
>
> Richard> Caught one!
>
> Thank you.
>
> Richard> Insert the text below in a JS-mode buffer, go to the beginning of the
> Richard> blank first line in function h() and type "/". There is an infloop.
>
> How did you find this? I'm very curious.
I didn't go looking. The recipe is reduced from a program I was
writing. The infloop happened when I went to comment out a line.
Would have happened to somebody sooner or later :)
> Anyway, please try this patch on top of the previous one I sent.
Seems good, thanks very much.
> Or if you'd prefer I can send a combined patch.
>
> Tom
>
> diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
> index fa865db..c220353 100644
> --- a/lisp/progmodes/js.el
> +++ b/lisp/progmodes/js.el
> @@ -1722,12 +1722,13 @@ js-syntax-propertize-regexp
> (when (eq (nth 3 ppss) ?/)
> ;; A /.../ regexp.
> (goto-char (nth 8 ppss))
> - (when (and (looking-at js--syntax-propertize-regexp-regexp)
> - ;; Don't touch text after END.
> - (or (not (match-end 1)) (<= (match-end 1) end)))
> - (put-text-property (match-beginning 1) (or (match-end 1) (match-end 0))
> + (when (looking-at js--syntax-propertize-regexp-regexp)
> + ;; Don't touch text after END.
> + (when (> end (match-end 1))
> + (setq end (match-end 1)))
> + (put-text-property (match-beginning 1) end
> 'syntax-table (string-to-syntax "\"/"))
> - (goto-char (match-end 0))))))
> + (goto-char end)))))
>
> (defun js-syntax-propertize (start end)
> ;; JavaScript allows immediate regular expression objects, written /.../.
This bug report was last modified 8 years and 51 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.