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
Message #14 received at 26070 <at> debbugs.gnu.org (full text, mbox):
On 13.03.2017 15:50, Tom Tromey wrote:
> I think once js-syntax-propertize is called, the regexp should always
> succeed, so this patch makes the trailing "/" optional.
Does it solve the infloop in the case like:
/x[
as well?
If not, I think the following is a better patch (could use some
tweaking, probably):
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index aed42a8..d9e6ef3 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -1721,12 +1721,14 @@ 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.
- (<= (match-end 1) end))
- (put-text-property (match-beginning 1) (match-end 1)
- 'syntax-table (string-to-syntax "\"/"))
- (goto-char (match-end 0))))))
+ (if (and (looking-at js--syntax-propertize-regexp-regexp)
+ ;; Don't touch text after END.
+ (<= (match-end 1) end))
+ (progn
+ (put-text-property (match-beginning 1) (match-end 1)
+ 'syntax-table (string-to-syntax "\"/"))
+ (goto-char (match-end 0)))
+ (goto-char (1+ (match-beginning 0)))))))
(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.