From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Tom Tromey Newsgroups: gmane.emacs.bugs Subject: bug#26070: 26.0.50; js-mode slash insertion bug Date: Mon, 13 Mar 2017 14:50:56 +0100 Message-ID: <87wpbt8ev3.fsf@pokyo> References: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1489413138 16719 195.159.176.226 (13 Mar 2017 13:52:18 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 13 Mar 2017 13:52:18 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: 26070@debbugs.gnu.org, tom@tromey.com To: Richard Copley Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Mar 13 14:52:14 2017 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cnQON-0003Ga-8u for geb-bug-gnu-emacs@m.gmane.org; Mon, 13 Mar 2017 14:52:07 +0100 Original-Received: from localhost ([::1]:52257 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnQOT-00039h-BF for geb-bug-gnu-emacs@m.gmane.org; Mon, 13 Mar 2017 09:52:13 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:46030) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnQOM-00039N-SN for bug-gnu-emacs@gnu.org; Mon, 13 Mar 2017 09:52:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnQOI-0007hK-Rb for bug-gnu-emacs@gnu.org; Mon, 13 Mar 2017 09:52:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:55167) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnQOI-0007hD-O6 for bug-gnu-emacs@gnu.org; Mon, 13 Mar 2017 09:52:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cnQOI-0006hp-H4 for bug-gnu-emacs@gnu.org; Mon, 13 Mar 2017 09:52:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tom Tromey Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 13 Mar 2017 13:52:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 26070 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-Cc: "bug-gnu-emacs@gnu.org" , tom@tromey.com Original-Received: via spool by submit@debbugs.gnu.org id=B.148941311425761 (code B ref -1); Mon, 13 Mar 2017 13:52:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Mar 2017 13:51:54 +0000 Original-Received: from localhost ([127.0.0.1]:53366 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cnQO7-0006hP-5G for submit@debbugs.gnu.org; Mon, 13 Mar 2017 09:51:53 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:54978) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cnQO5-0006hD-CD for submit@debbugs.gnu.org; Mon, 13 Mar 2017 09:51:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnQNz-0007WT-6l for submit@debbugs.gnu.org; Mon, 13 Mar 2017 09:51:44 -0400 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:51383) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cnQNz-0007WN-3Y for submit@debbugs.gnu.org; Mon, 13 Mar 2017 09:51:43 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45942) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnQNx-00038g-Op for bug-gnu-emacs@gnu.org; Mon, 13 Mar 2017 09:51:42 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnQNt-0007QD-Q1 for bug-gnu-emacs@gnu.org; Mon, 13 Mar 2017 09:51:41 -0400 Original-Received: from gproxy2-pub.mail.unifiedlayer.com ([69.89.18.3]:39387) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1cnQNt-0007AY-BE for bug-gnu-emacs@gnu.org; Mon, 13 Mar 2017 09:51:37 -0400 Original-Received: (qmail 16478 invoked by uid 0); 13 Mar 2017 13:51:06 -0000 Original-Received: from unknown (HELO CMOut01) (10.0.90.82) by gproxy2.mail.unifiedlayer.com with SMTP; 13 Mar 2017 13:51:06 -0000 Original-Received: from box522.bluehost.com ([74.220.219.122]) by CMOut01 with id vRr21u00v2f2jeq01Rr5G8; Mon, 13 Mar 2017 07:51:06 -0600 X-Authority-Analysis: v=2.1 cv=Ath9goNP c=1 sm=1 tr=0 a=GsOEXm/OWkKvwdLVJsfwcA==:117 a=GsOEXm/OWkKvwdLVJsfwcA==:17 a=L9H7d07YOLsA:10 a=9cW_t1CCXrUA:10 a=s5jvgZ67dGcA:10 a=6Iz7jQTuP9IA:10 a=7vox6WFfMepEhlYO6NgA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date: References:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=5GkDMrFwB5DJRolUxabHTeHa6ON1JQpKwNAqXD7P3H8=; b=wvvoGOVsqbQ1IvzKl4GVRiEV/r UygusOhVKDAZt2kM2uZPFn0x83Zo1p65tlJRmeRH0lnpkLn5tF3/tYmnIfcHwUAp5QTYf+te238uV FLFjThTG8ABU0UEJlkwe0Kqjy; Original-Received: from [89.202.203.52] (port=1737 helo=pokyo) by box522.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.87) (envelope-from ) id 1cnQNJ-0000Bi-D7; Mon, 13 Mar 2017 07:51:02 -0600 X-Attribution: Tom In-Reply-To: (Richard Copley's message of "Sun, 12 Mar 2017 10:23:28 +0000") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box522.bluehost.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 89.202.203.52 X-Exim-ID: 1cnQNJ-0000Bi-D7 X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: (pokyo) [89.202.203.52]:1737 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTIyLmJsdWVob3N0LmNvbQ== X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:130536 Archived-At: 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))))))