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" == 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.
Anyway, please try this patch on top of the previous one I sent.
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.