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#25215: 25.1.90; js--proper-indentation is affected by the value of forward-sexp-function Date: Fri, 16 Dec 2016 14:58:35 +0200 Message-ID: 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 1481906301 5963 195.159.176.226 (16 Dec 2016 16:38:21 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Fri, 16 Dec 2016 16:38:21 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:50.0) Gecko/20100101 Thunderbird/50.0 To: 25215@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri Dec 16 17:38:18 2016 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 1cHvWP-0000SI-LG for geb-bug-gnu-emacs@m.gmane.org; Fri, 16 Dec 2016 17:38:13 +0100 Original-Received: from localhost ([::1]:33134 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cHvWU-0007cs-0y for geb-bug-gnu-emacs@m.gmane.org; Fri, 16 Dec 2016 11:38:18 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:55208) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cHvWJ-0007bV-LF for bug-gnu-emacs@gnu.org; Fri, 16 Dec 2016 11:38:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cHvWE-0004HS-Pu for bug-gnu-emacs@gnu.org; Fri, 16 Dec 2016 11:38:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:57317) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cHvWE-0004HN-Mx for bug-gnu-emacs@gnu.org; Fri, 16 Dec 2016 11:38:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1cHvWE-0003Ij-EA for bug-gnu-emacs@gnu.org; Fri, 16 Dec 2016 11:38:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Dmitry Gutov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 16 Dec 2016 16:38:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 25215 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.148190623112618 (code B ref -1); Fri, 16 Dec 2016 16:38:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 16 Dec 2016 16:37:11 +0000 Original-Received: from localhost ([127.0.0.1]:44483 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cHvVP-0003HQ-DQ for submit@debbugs.gnu.org; Fri, 16 Dec 2016 11:37:11 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:53338) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1cHs6G-0005rx-Mm for submit@debbugs.gnu.org; Fri, 16 Dec 2016 07:59:01 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cHs6A-0005Ci-Im for submit@debbugs.gnu.org; Fri, 16 Dec 2016 07:58:55 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:47047) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cHs6A-0005CL-F8 for submit@debbugs.gnu.org; Fri, 16 Dec 2016 07:58:54 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44304) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cHs68-000131-HP for bug-gnu-emacs@gnu.org; Fri, 16 Dec 2016 07:58:54 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cHs63-00056P-5F for bug-gnu-emacs@gnu.org; Fri, 16 Dec 2016 07:58:52 -0500 Original-Received: from mail.corporatemx.com ([78.140.179.7]:8992) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1cHs62-00054G-Uw for bug-gnu-emacs@gnu.org; Fri, 16 Dec 2016 07:58:47 -0500 Original-Received: from [185.105.173.41] (port=60022 helo=[192.168.1.3]) by mail.corporatemx.com with esmtpsa (TLSv1.2:DES-CBC3-SHA:168) (envelope-from ) id 1cHs5w-000MTi-3t for bug-gnu-emacs@gnu.org; Fri, 16 Dec 2016 13:58:40 +0100 Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Mailman-Approved-At: Fri, 16 Dec 2016 11:37:10 -0500 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:127094 Archived-At: js2-mode derives from js-mode and, starting with Emacs 25.1, inherits its indentation function. However, forward-sexp-function in js2-mode can be slow because it uses the AST, and when the current parsing pass had been interrupted by user input, it's forced to finish. Which is slow in large files. And its subtleties aren't really needed by the intentation code. So in the various bits of code we've brought over from js2-mode we have kept the forward-sexp-function->nil binding. We've missed it in js--multi-line-declaration-indentation, hovewer. And in js--maybe-goto-declaration-keyword-end (though that one only comes into play with a non-default value of js-indent-first-init). The patch is below. diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 6d995a0..9aa459d 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -1851,7 +1851,8 @@ js--multi-line-declaration-indentation "Helper function for `js--proper-indentation'. Return the proper indentation of the current line if it belongs to a declaration statement spanning multiple lines; otherwise, return nil." - (let (at-opening-bracket) + (let (forward-sexp-function ; Use Lisp version. + at-opening-bracket) (save-excursion (back-to-indentation) (when (not (looking-at js--declaration-keyword-re)) @@ -1928,6 +1929,7 @@ js--maybe-goto-declaration-keyword-end (let ((bracket (nth 1 parse-status)) declaration-keyword-end at-closing-bracket-p + forward-sexp-function ; Use Lisp version. comma-p) (when (looking-at js--declaration-keyword-re) (setq declaration-keyword-end (match-end 0))