diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2009-08-18 06:16:57 +0200 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2009-08-18 06:16:57 +0200 |
commit | 5a7373cd2da209e8a58b35060c0b29bd18398957 (patch) | |
tree | 93f54fbdd0c63dae576e8f71fc40c1453c9c2f59 /scheme/plt/geiser | |
parent | 203c989e07b43afb34f2c795cbda8126e9c0d327 (diff) | |
download | geiser-chez-5a7373cd2da209e8a58b35060c0b29bd18398957.tar.gz geiser-chez-5a7373cd2da209e8a58b35060c0b29bd18398957.tar.bz2 |
Yet another deklugdification: locals scanning moved to elisp.
... and say goodbye to the ugly parse partial sexp, reducing not only
sloppy code, but also duplication and data transfers.
Diffstat (limited to 'scheme/plt/geiser')
-rw-r--r-- | scheme/plt/geiser/completions.ss | 27 |
1 files changed, 4 insertions, 23 deletions
diff --git a/scheme/plt/geiser/completions.ss b/scheme/plt/geiser/completions.ss index 4537feb..15bc081 100644 --- a/scheme/plt/geiser/completions.ss +++ b/scheme/plt/geiser/completions.ss @@ -35,29 +35,10 @@ (filter (lambda (s) (string-prefix? prefix s)) (if sort? (sort lst string<?) lst))) -(define (symbol-completions prefix (context #f)) - (append (filter-prefix prefix - (map symbol->string (local-bindings context)) - #f) - (filter-prefix prefix - (map symbol->string (namespace-mapped-symbols)) - #t))) - -(define (local-bindings form) - (define (body f) (if (> (length f) 2) (cddr f) '())) - (let loop ((form form) (bindings '())) - (cond ((not (pair? form)) bindings) - ((list? (car form)) - (loop (cdr form) (append (local-bindings (car form)) bindings))) - ((and (list? form) (< (length form) 2)) bindings) - ((memq (car form) '(define define* lambda)) - (loop (body form) (append (pair->list (cadr form)) bindings))) - ((and (memq (car form) '(let let* letrec letrec*)) - (list? (cadr form))) - (loop (body form) (append (map car (cadr form)) bindings))) - ((and (eq? 'let (car form)) (symbol? (cadr form))) - (loop (cons 'let (body form)) (cons (cadr form) bindings))) - (else (loop (cdr form) bindings))))) +(define (symbol-completions prefix) + (filter-prefix prefix + (map symbol->string (namespace-mapped-symbols)) + #t)) (define (module-completions prefix) (filter-prefix prefix (module-list) #f)) |