From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.bugs Subject: bug#26070: 26.0.50; js-mode slash insertion bug Date: Tue, 14 Mar 2017 07:56:35 +0200 Message-ID: References: <87wpbt8ev3.fsf@pokyo> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1489471247 18903 195.159.176.226 (14 Mar 2017 06:00:47 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 14 Mar 2017 06:00:47 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.0 Cc: 26070@debbugs.gnu.org To: Tom Tromey , Richard Copley Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Tue Mar 14 07:00:42 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 1cnfVg-0003z1-5X for geb-bug-gnu-emacs@m.gmane.org; Tue, 14 Mar 2017 07:00:40 +0100 Original-Received: from localhost ([::1]:56551 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnfVi-0003OO-UD for geb-bug-gnu-emacs@m.gmane.org; Tue, 14 Mar 2017 02:00:42 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36924) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cnfSD-0001Q1-1f for bug-gnu-emacs@gnu.org; Tue, 14 Mar 2017 01:57:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cnfSA-00059a-0r for bug-gnu-emacs@gnu.org; Tue, 14 Mar 2017 01:57:05 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:56449) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cnfS9-00059W-SU for bug-gnu-emacs@gnu.org; Tue, 14 Mar 2017 01:57:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cnfS9-00059E-LZ for bug-gnu-emacs@gnu.org; Tue, 14 Mar 2017 01:57:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 14 Mar 2017 05:57:01 +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: Original-Received: via spool by 26070-submit@debbugs.gnu.org id=B26070.148947100619763 (code B ref 26070); Tue, 14 Mar 2017 05:57:01 +0000 Original-Received: (at 26070) by debbugs.gnu.org; 14 Mar 2017 05:56:46 +0000 Original-Received: from localhost ([127.0.0.1]:54648 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cnfRu-00058h-Lb for submit@debbugs.gnu.org; Tue, 14 Mar 2017 01:56:46 -0400 Original-Received: from mail-wm0-f68.google.com ([74.125.82.68]:35597) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cnfRs-00058U-D0 for 26070@debbugs.gnu.org; Tue, 14 Mar 2017 01:56:44 -0400 Original-Received: by mail-wm0-f68.google.com with SMTP id z63so13048244wmg.2 for <26070@debbugs.gnu.org>; Mon, 13 Mar 2017 22:56:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=4KWu7fjsCJqCN90GYPjsCB8KfsY+afJXFksPnsE3ilo=; b=qZYLtvkJSfLnYQTwUOiD1uYAYiC1Z8XhOvRmvF9Rm2LbgRbrjlK5HjFH5sAYjBQkJg EWAbQvXDbikz5bPLzXtmmO5peymT2cjYcP6bn+1yCG0tVglIXVQGBkvHnPWxnt5HPsRX yQr+kO+sthKcGyJEo6Fp1wgcdXFI7LARpZz3VvxSL6122v11SuyxNBYQE4bqi0HLp4Q4 poDrWcHullfsBIQFPn7Zs0U1xe1G9NmhlSWuAm6z+urIdCTlXSOkpQ84SAcE+JtX0Zha hWP2F7y3tL6P7nyvFFPoGjFsKTtWM1vXVArlzU9V+xgl36vVnhMqZmOMaQ6xqGT+TYnr J8nw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:cc:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=4KWu7fjsCJqCN90GYPjsCB8KfsY+afJXFksPnsE3ilo=; b=YuICNhquD2ICVwuZ/pZofge7Afu0P9yguJXm4hO1PMC4D93XPaubi2UcVD9l9oi6NG uFSwZ6rceIEAowxNX8mm16REqu3PCS2WX4yZKGQQ31GFTMqARqunWYakY0gn47FHB9G9 R3ZUGqkTZUliAL96STdPBkdRujU5lgpyanEb4eaKoZ2vX6XdEqQTAYWjQFzGIzZnZ1ij Woqgwe+ZMwtG6alNhA94HX6VfdZbzEU3toq+Ma5hnlY1E6ViMRhlnisIw+Y5xatf7iSq TTA+FhJc4XzmWRL8nvq4tFOROuzd9cVE7BcvPkUUzrU6cPUs9GHysIkQn591BmE42T13 CM7w== X-Gm-Message-State: AFeK/H28t4yOH4AJxKCLH6EQ4PJXN3rKuEEH+dEqFUr0oZeAozalQtbUf47QAQk6m4Qi/g== X-Received: by 10.28.94.2 with SMTP id s2mr11951599wmb.127.1489470998420; Mon, 13 Mar 2017 22:56:38 -0700 (PDT) Original-Received: from [192.168.1.3] ([185.105.173.41]) by smtp.googlemail.com with ESMTPSA id l41sm27602521wre.23.2017.03.13.22.56.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Mar 2017 22:56:37 -0700 (PDT) In-Reply-To: <87wpbt8ev3.fsf@pokyo> Content-Language: en-US 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:130567 Archived-At: 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 /.../.