branch: master
commit 49954ea8e35aa51f0f0bc08502414171597933d6
Author: Dmitry Gutov <[email protected]>
Commit: Dmitry Gutov <[email protected]>
Use idle timer to reparse, even when the buffer's just been opened
Fixes #20, in yet another way.
Also speeds up Emacs 25's xref-find-references and project-find-regexp.
---
js2-mode.el | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/js2-mode.el b/js2-mode.el
index 7c30a1c..167851e 100644
--- a/js2-mode.el
+++ b/js2-mode.el
@@ -1076,6 +1076,7 @@ Not currently used."
"Face used to highlight undeclared variable identifiers.")
(defcustom js2-init-hook nil
+ ;; FIXME: We don't really need this anymore.
"List of functions to be called after `js2-mode' or
`js2-minor-mode' has initialized all variables, before parsing
the buffer for the first time."
@@ -11566,7 +11567,9 @@ Selecting an error will jump it to the corresponding
source-buffer error.
(run-hooks 'js2-init-hook)
- (js2-reparse))
+ (let ((js2-idle-timer-delay 0))
+ ;; Schedule parsing for after when the mode hooks run.
+ (js2-mode-reset-timer)))
;; We may eventually want js2-jsx-mode to derive from js-jsx-mode, but that'd
be
;; a bit more complicated and it doesn't net us much yet.