diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-06-12 00:03:28 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2010-06-12 00:03:28 +0200 |
commit | 31df91e17edf9e8eea742b5a6f674a20868ec827 (patch) | |
tree | 29737fd3d078dd9d761743c1ac572764a916dcd3 /elisp/geiser-syntax.el | |
parent | 4428e92f1ea97ac1443740c97e0ad8db6d0259fa (diff) | |
download | geiser-chez-31df91e17edf9e8eea742b5a6f674a20868ec827.tar.gz geiser-chez-31df91e17edf9e8eea742b5a6f674a20868ec827.tar.bz2 |
New buttons (source, forward/backward) in document browser.
Diffstat (limited to 'elisp/geiser-syntax.el')
-rw-r--r-- | elisp/geiser-syntax.el | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/elisp/geiser-syntax.el b/elisp/geiser-syntax.el index e0d9634..040e122 100644 --- a/elisp/geiser-syntax.el +++ b/elisp/geiser-syntax.el @@ -205,23 +205,25 @@ (defsubst geiser-syntax--pair-length (p) (if (cdr (last p)) (1+ (safe-length p)) (length p))) -(defun geiser-syntax--scan-sexps () +(defun geiser-syntax--scan-sexps (&optional begin) (let ((path)) (save-excursion - (geiser-syntax--skip-comment/string) - (while (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-1 (1- (geiser-syntax--pair-length form))) - (prev (and (> len-1 1) (nth (1- len-1) form))) - (prev (and (keywordp prev) (list prev)))) - (push `(,(car form) ,len-1 ,@prev) path))))))) - (if path (nreverse path) - (let ((fst (symbol-at-point))) - (and fst `((,fst 0))))))) + (save-restriction + (narrow-to-region (or begin (point-min)) (1+ (point))) + (geiser-syntax--skip-comment/string) + (while (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-1 (1- (geiser-syntax--pair-length form))) + (prev (and (> len-1 1) (nth (1- len-1) form))) + (prev (and (keywordp prev) (list prev)))) + (push `(,(car form) ,len-1 ,@prev) path)))))) + (if path (nreverse path) + (let ((fst (symbol-at-point))) + (and fst `((,fst 0))))))))) (defsubst geiser-syntax--binding-form-p (bfs sbfs f) (or (memq f '(define define* lambda let let* letrec)) |