From: Tom Tromey <tom@tromey.com>
To: Richard Copley <rcopley@gmail.com>
Cc: 26070@debbugs.gnu.org, tom@tromey.com
Subject: bug#26070: 26.0.50; js-mode slash insertion bug
Date: Mon, 13 Mar 2017 14:50:56 +0100 [thread overview]
Message-ID: <87wpbt8ev3.fsf@pokyo> (raw)
In-Reply-To: <CAPM58ojxkorL5Q1dp8f4SL0jsipp5XQa5d0zpidFE+3yBY956g@mail.gmail.com> (Richard Copley's message of "Sun, 12 Mar 2017 10:23:28 +0000")
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))))))
next prev parent reply other threads:[~2017-03-13 13:50 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-12 10:23 bug#26070: 26.0.50; js-mode slash insertion bug Richard Copley
2017-03-13 13:50 ` Tom Tromey [this message]
2017-03-13 19:12 ` Richard Copley
2017-03-14 5:56 ` Dmitry Gutov
2017-03-14 11:06 ` Tom Tromey
2017-03-19 11:22 ` Richard Copley
2017-03-22 22:18 ` Tom Tromey
2017-03-23 7:00 ` Richard Copley
2017-03-24 3:53 ` Tom Tromey
2017-03-31 7:53 ` Dmitry Gutov
2017-04-01 21:15 ` bug#26070: fixed Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wpbt8ev3.fsf@pokyo \
--to=tom@tromey.com \
--cc=26070@debbugs.gnu.org \
--cc=rcopley@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).