From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Richard Copley Newsgroups: gmane.emacs.bugs Subject: bug#26070: 26.0.50; js-mode slash insertion bug Date: Thu, 23 Mar 2017 07:00:58 +0000 Message-ID: References: <87wpbt8ev3.fsf@pokyo> <87fuig86ed.fsf@pokyo> <87lgrx0xch.fsf@tromey.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: blaine.gmane.org 1490252543 4070 195.159.176.226 (23 Mar 2017 07:02:23 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 23 Mar 2017 07:02:23 +0000 (UTC) Cc: 26070@debbugs.gnu.org, Dmitry Gutov To: Tom Tromey Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Mar 23 08:02:18 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 1cqwl7-000864-Vb for geb-bug-gnu-emacs@m.gmane.org; Thu, 23 Mar 2017 08:02:10 +0100 Original-Received: from localhost ([::1]:54567 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqwlC-0000v5-8G for geb-bug-gnu-emacs@m.gmane.org; Thu, 23 Mar 2017 03:02:14 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41128) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cqwl5-0000ui-GS for bug-gnu-emacs@gnu.org; Thu, 23 Mar 2017 03:02:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cqwl0-00054F-Hq for bug-gnu-emacs@gnu.org; Thu, 23 Mar 2017 03:02:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:41873) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cqwl0-000544-Do for bug-gnu-emacs@gnu.org; Thu, 23 Mar 2017 03:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cqwkz-0001Oo-Sv for bug-gnu-emacs@gnu.org; Thu, 23 Mar 2017 03:02:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Richard Copley Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 23 Mar 2017 07:02: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.14902524965343 (code B ref 26070); Thu, 23 Mar 2017 07:02:01 +0000 Original-Received: (at 26070) by debbugs.gnu.org; 23 Mar 2017 07:01:36 +0000 Original-Received: from localhost ([127.0.0.1]:40072 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cqwkZ-0001O7-R1 for submit@debbugs.gnu.org; Thu, 23 Mar 2017 03:01:35 -0400 Original-Received: from mail-ua0-f178.google.com ([209.85.217.178]:33136) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cqwkY-0001Nv-3M for 26070@debbugs.gnu.org; Thu, 23 Mar 2017 03:01:34 -0400 Original-Received: by mail-ua0-f178.google.com with SMTP id u30so89008410uau.0 for <26070@debbugs.gnu.org>; Thu, 23 Mar 2017 00:01:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=AaHOlGjVqhjB32IQZGsEez50hnMVSMZH6x26GnYzE54=; b=mcQfoRyGSuRljzEhII5JWSCogil6jsX/ulG2Y0rB/EfCq9qwQmlqjpk+VnjaWp/oiL VOUkpGCiyA2peMJguShFQKsDHS7AF6jngtJwD6ND0GYamAZgNiNbrvIObiMEbyffcRaq bH/6z+yZwZZIiEy3rcxYFE5IiX1W92oCA375Q4aYBI1OEuS2bwxJdwuqXMdV+kw8J9nT 6uC9ZorT7+8yzeAIz3PxoGuBWOhrbN+CTTQ2n2GC4kAJiDhMbuLhfNkw4O3DdZyaDGyV ui6pRZksLKLvYSih4Q5q5d3UYmm3NL+cCc1GzWBobx4NpeYjm7W74yWltZspGCGhNJlT YkXQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=AaHOlGjVqhjB32IQZGsEez50hnMVSMZH6x26GnYzE54=; b=fRQqm/VzwzZjqF0+p/aqufnfe4hMJNyKbmI9jBqCBv/WSo3CjavDfmIDXHiP8CAYYA OBkV6Yc22p8aOydQCY/8XXe6jgjB68XCL2lu7jUtQygajBKpFclH6ns6vvNZAybcDzmO 4mU205OTrtPcXZU185sFg9XQX8WAnLFCARCp0sDDmONqCQULNxA7AETdpb1ynXz50RdG 4JfC+MGsmK7XFG3ODZbLBIixlwlCdPG6f5R8IwTSxISz5JAI7PsZd4XmivuoC7CbSnNS PdKJJ8A8psktQ1OH+13SyulI+yt+UPoviqOEeuku+RkOGJoiiqLPuRVlMXsUm0hdAQa4 Ti1w== X-Gm-Message-State: AFeK/H1120La5XWVDlXHjtdNzCJ3EnlMcANYPwvI21pkNR14eHRRSoRk28s5b6DujlYFRWVwTUH3GhkwuWNv6Q== X-Received: by 10.159.48.87 with SMTP id i23mr463180uab.52.1490252488335; Thu, 23 Mar 2017 00:01:28 -0700 (PDT) Original-Received: by 10.176.71.214 with HTTP; Thu, 23 Mar 2017 00:00:58 -0700 (PDT) In-Reply-To: <87lgrx0xch.fsf@tromey.com> 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:130832 Archived-At: On 22 March 2017 at 22:18, Tom Tromey wrote: >>>>>> "Richard" == Richard Copley 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. I didn't go looking. The recipe is reduced from a program I was writing. The infloop happened when I went to comment out a line. Would have happened to somebody sooner or later :) > Anyway, please try this patch on top of the previous one I sent. Seems good, thanks very much. > 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 /.../.