From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master b01a429: js--re-search-backward-inner: Fix infloop Date: Fri, 1 Feb 2019 03:27:20 +0300 Message-ID: <6f4122fb-8dcc-836d-9b80-388d417f8cc2@yandex.ru> References: <20190201000223.22803.66102@vcs0.savannah.gnu.org> <20190201000224.6638E20B45@vcs0.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="198876"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:65.0) Gecko/20100101 Thunderbird/65.0 To: emacs-devel@gnu.org, Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 01 01:27:47 2019 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1gpMgK-000pZo-Eg for ged-emacs-devel@m.gmane.org; Fri, 01 Feb 2019 01:27:44 +0100 Original-Received: from localhost ([127.0.0.1]:34917 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gpMgJ-0002ZN-DC for ged-emacs-devel@m.gmane.org; Thu, 31 Jan 2019 19:27:43 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:48098) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gpMgD-0002ZB-9G for emacs-devel@gnu.org; Thu, 31 Jan 2019 19:27:38 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gpMgB-00061T-QL for emacs-devel@gnu.org; Thu, 31 Jan 2019 19:27:37 -0500 Original-Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]:38900) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gpMg6-0005zN-0g; Thu, 31 Jan 2019 19:27:31 -0500 Original-Received: by mail-lf1-x134.google.com with SMTP id a8so3763699lfk.5; Thu, 31 Jan 2019 16:27:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:from:to:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=fsP2E3paFfQY/ZNZ83GjIXwKAtauUrZMkrZkJKtQX0g=; b=KwZzt+OXBadduFJ0rJ6hCihB9DRiqQURCWuVQYfTZ5B5mNlhMfKW0HV4rnlBWYnNPJ WaJbPOs4C847G2QM5SPF8o//lt6fxGu1J10MCOvfDTr/lH+oQjQ83F3Eb59ZUltsPn5O 7Ajrnab3RwxQ+m/+898h2o3i6vPhOEo1QnkiC0hehT1NLPqpVEB/X03uz+LjWi7Rq5ic xo0hakEao3k8KAV31jWypfNRmIzUqLVmctqepi+VsoYm15hdxbNvcUi/Ab3JZ4yvtvVJ 8V7/TQd2nQKvb58M40Epoq2xR4HUQY2llbKyCaz1hpNhU965qcR+fVX1Lm0eevNrrfJt QYUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:from:to:references:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=fsP2E3paFfQY/ZNZ83GjIXwKAtauUrZMkrZkJKtQX0g=; b=a+8ssQz0sW8XQs5KJKvlucUWr/FfChJHIgh8Qzi5n8bdnoFInIRq+TImiqb+kjQCw9 d5dOs5QNxP1p/K4l+nL54Mdpzo8tAKwGVQ7/gTsC+a2EMClGDTNP0Vv723Z8RePPEWcH AcT5+RGfks0m22rntXk0GgCicdp5iP86RFW4NfaihISVBTH42Xmhhss4EueYoSjWU7PF kp0C67QmEyxvEnoYXYo9+uSYLL3HjH45PP+6IddmWguwHah3swhKnc87T9EnfzvbGCnh j5yBMlres+LxyHgEg90hT/zPZ0Re7dgLhZubm9xhEm8Dhc6e9Xd4sgdEOGVxo4XRUNja sE4A== X-Gm-Message-State: AJcUukfQN4f8uWZgT51xnIapppk939rHGtZTxtlwIm2pbRFF1rOWdwWu RNWpBB/OvyIgbwbMV4IlnnozvJ98 X-Google-Smtp-Source: ALg8bN6r0QgVziFsEffz+brJzCf9xhXW6C0deur1eL8xsDNykDzeZUGa9ohC9jBay9IQf5dDq8H/hw== X-Received: by 2002:a19:f510:: with SMTP id j16mr30767481lfb.35.1548980843229; Thu, 31 Jan 2019 16:27:23 -0800 (PST) Original-Received: from [192.168.0.108] ([79.175.3.65]) by smtp.googlemail.com with ESMTPSA id s62sm1101281lfg.34.2019.01.31.16.27.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 31 Jan 2019 16:27:22 -0800 (PST) In-Reply-To: <20190201000224.6638E20B45@vcs0.savannah.gnu.org> Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::134 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.org gmane.emacs.devel:232874 Archived-At: Hi Eli, Any chance I may backport this to emacs-26? The bug was reported only recently, but it seems pretty annoying (infloop during indentation), and the fix is simple. On 01.02.2019 03:02, Dmitry Gutov wrote: > branch: master > commit b01a4295c2f9bb58858880e4e28b05cc8396791c > Author: Dmitry Gutov > Commit: Dmitry Gutov > > js--re-search-backward-inner: Fix infloop > > Fix JS indentation infloop reported in > https://github.com/mooz/js2-mode/issues/513. > > * lisp/progmodes/js.el (js--re-search-backward-inner): Account for > multiline string literals. > * test/manual/indent/js.js: New test example. > --- > lisp/progmodes/js.el | 9 +-------- > test/manual/indent/js.js | 7 +++++++ > 2 files changed, 8 insertions(+), 8 deletions(-) > > diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el > index e55539c..a94a2fe 100644 > --- a/lisp/progmodes/js.el > +++ b/lisp/progmodes/js.el > @@ -785,7 +785,6 @@ macro as normal text." > (defun js--re-search-backward-inner (regexp &optional bound count) > "Auxiliary function for `js--re-search-backward'." > (let ((parse) > - str-terminator > (orig-macro-start > (save-excursion > (and (js--beginning-of-macro) > @@ -796,13 +795,7 @@ macro as normal text." > (save-excursion (backward-char) (looking-at "/[/*]"))) > (forward-char)) > (setq parse (syntax-ppss)) > - (cond ((setq str-terminator (nth 3 parse)) > - (when (eq str-terminator t) > - (setq str-terminator ?/)) > - (re-search-backward > - (concat "\\([^\\]\\|^\\)" (string str-terminator)) > - (point-at-bol) t)) > - ((nth 7 parse) > + (cond ((nth 8 parse) > (goto-char (nth 8 parse))) > ((or (nth 4 parse) > (and (eq (char-before) ?/) (eq (char-after) ?*))) > diff --git a/test/manual/indent/js.js b/test/manual/indent/js.js > index b0d8bca..df79098 100644 > --- a/test/manual/indent/js.js > +++ b/test/manual/indent/js.js > @@ -144,6 +144,13 @@ bar( > /abc/ > ) > > +// No infloop inside js--re-search-backward-inner > +let b = { > + a : ` > + //1 > + ` > +} > + > // Local Variables: > // indent-tabs-mode: nil > // js-indent-level: 2 > > _______________________________________________ > Emacs-diffs mailing list > Emacs-diffs@gnu.org > https://lists.gnu.org/mailman/listinfo/emacs-diffs >