[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#25215: 25.1.90; js--proper-indentation is affected by the value of f

From: Dmitry Gutov
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
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:50.0) Gecko/20100101 Thunderbird/50.0

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)
       (when (not (looking-at js--declaration-keyword-re))
@@ -1928,6 +1929,7 @@ js--maybe-goto-declaration-keyword-end
     (let ((bracket (nth 1 parse-status))
+          forward-sexp-function ; Use Lisp version.
       (when (looking-at js--declaration-keyword-re)
         (setq declaration-keyword-end (match-end 0))

reply via email to

[Prev in Thread] Current Thread [Next in Thread]