 (defsubst geiser-syntax--read/keyword-value (s)
   (and (consp s) (eq (car s) :keyword) (cdr s)))
 
+(defsubst geiser-syntax--form-after-point (&optional boundary)
+  (let ((geiser-syntax--read/buffer-limit (and (numberp boundary) boundary)))
+    (save-excursion (values (geiser-syntax--read) (point)))))
+
  
 ;;; Code parsing:


(defsubst geiser-syntax--read/eos ()
  (or (eobp)
      (and (numberp geiser-syntax--read/buffer-limit)
           (<= geiser-syntax--read/buffer-limit (point)))))

(defsubst geiser-syntax--read/next-char ()

                      path))))))
      (nreverse path))))

(defun geiser-syntax--scan-locals (form partial locals)
  (flet ((if-symbol (x) (and (symbolp x) x))
         (if-list (x) (and (listp x) x))
         (normalize (vars) (mapcar (lambda (i) (if (listp i) (car i) i)) vars)))
    (cond ((or (null form) (not (listp form))) (normalize locals))
          ((not (memq (car form) '(define let let* letrec lambda)))
           (geiser-syntax--scan-locals (car (last form)) partial locals))
          (t
           (let* ((head (car form))
                  (name (if-symbol (cadr form)))
                  (names (if name (if-list (caddr form)) (if-list (cadr form))))
                  (rest (if name (cdddr form) (cddr form)))
                  (use-names (or (eq head 'let*) (not partial) rest)))
             (when name (push name locals))
             (when use-names (dolist (n names) (push n locals)))
             (dolist (f (butlast rest))
               (when (eq (car f) 'define) (push (cadr f) locals)))
             (geiser-syntax--scan-locals (car (last (or rest names)))
                                         partial
                                         locals))))))

(defun geiser-syntax--locals-around-point ()
  (when (eq major-mode 'scheme-mode)
    (save-excursion
      (geiser-syntax--skip-comment/string)
      (let ((boundary (point)))
        (while (not (zerop (geiser-syntax--nesting-level)))
          (backward-up-list))
        (multiple-value-bind (form end)
            (geiser-syntax--form-after-point boundary)
          (geiser-syntax--scan-locals form (> end boundary) '()))))))


