summaryrefslogtreecommitdiff
path: root/elisp/geiser-syntax.el
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-10-23 01:06:15 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-10-23 01:06:15 +0200
commit145c5c15cdc0345bafa0e172c68f1a481ee3a19e (patch)
tree81ff3597f954705c8ba55b3591d760da56b1cf3c /elisp/geiser-syntax.el
parentbafa50637979082e65300cd985e278076910ba62 (diff)
downloadgeiser-chez-145c5c15cdc0345bafa0e172c68f1a481ee3a19e.tar.gz
geiser-chez-145c5c15cdc0345bafa0e172c68f1a481ee3a19e.tar.bz2
Temporary fix for sluggishness while scanning big forms
Diffstat (limited to 'elisp/geiser-syntax.el')
-rw-r--r--elisp/geiser-syntax.el23
1 files changed, 13 insertions, 10 deletions
diff --git a/elisp/geiser-syntax.el b/elisp/geiser-syntax.el
index f057d9d..f5d8cfa 100644
--- a/elisp/geiser-syntax.el
+++ b/elisp/geiser-syntax.el
@@ -229,22 +229,25 @@
(if (cdr (last p)) (1+ (safe-length p)) (length p)))
(defun geiser-syntax--scan-sexps (&optional begin)
- (let* ((fst (geiser-syntax--symbol-at-point))
+ (let* ((start (point))
+ (go-on t)
+ (fst (geiser-syntax--symbol-at-point))
(smth (or fst (not (looking-at-p "[\s \s)\s>\s<\n]"))))
(path (and fst `((,fst 0)))))
(save-excursion
(geiser-syntax--skip-comment/string)
- (while (not (zerop (geiser-syntax--nesting-level)))
+ (while (and go-on (not (zerop (geiser-syntax--nesting-level))))
(let ((boundary (1+ (point))))
(backward-up-list)
- (let ((form
- (nth-value 0 (geiser-syntax--form-after-point boundary))))
- (when (and (listp form) (car form) (symbolp (car form)))
- (let* ((len (geiser-syntax--pair-length form))
- (pos (if smth (1- len) (progn (setq smth t) len)))
- (prev (and (> pos 1) (nth (1- pos) form)))
- (prev (and (keywordp prev) (list prev))))
- (push `(,(car form) ,pos ,@prev) path)))))))
+ (when (setq go-on (< (- start (point)) 2000))
+ (let ((form
+ (nth-value 0 (geiser-syntax--form-after-point boundary))))
+ (when (and (listp form) (car form) (symbolp (car form)))
+ (let* ((len (geiser-syntax--pair-length form))
+ (pos (if smth (1- len) (progn (setq smth t) len)))
+ (prev (and (> pos 1) (nth (1- pos) form)))
+ (prev (and (keywordp prev) (list prev))))
+ (push `(,(car form) ,pos ,@prev) path))))))))
(nreverse path)))
(defsubst geiser-syntax--binding-form-p (bfs sbfs f)