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
Richard> I couldn't see what code is running, because C-g doesn't enter the
Richard> debugger in this situation even when debug-on-quit is true, but I
Richard> bisected it to this commit:
Thanks for finding this and bisecting it.
At first I thought the problem was that the regexp literal matching code
in js-syntax-propertize should leave point after the construct.
However, the call to js-syntax-propertize really ought to do that... but
this code is always requiring the trailing "/", which is what is going
wrong.
I think once js-syntax-propertize is called, the regexp should always
succeed, so this patch makes the trailing "/" optional.
Can you try this and let me know if it works for you?
Tom
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index 84c9111..fa865db 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -1714,7 +1714,7 @@ js--syntax-propertize-regexp-regexp
(not (any ?\] ?\\))
(and "\\" not-newline)))
"]")))
- (group "/"))
+ (group (zero-or-one "/")))
"Regular expression matching a JavaScript regexp literal.")
(defun js-syntax-propertize-regexp (end)
@@ -1724,8 +1724,8 @@ js-syntax-propertize-regexp
(goto-char (nth 8 ppss))
(when (and (looking-at js--syntax-propertize-regexp-regexp)
;; Don't touch text after END.
- (<= (match-end 1) end))
- (put-text-property (match-beginning 1) (match-end 1)
+ (or (not (match-end 1)) (<= (match-end 1) end)))
+ (put-text-property (match-beginning 1) (or (match-end 1) (match-end 0))
'syntax-table (string-to-syntax "\"/"))
(goto-char (match-end 0))))))
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.