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 | c34d04293ed5e2e67e4ed9422dbea54abd5d7f38 (patch) | |
tree | b9f74dabaafd129cd8e3248d584906df089b11cf /geiser | |
parent | 0e5a52b971109d42b691a44a0c80a0c6cdc0e46b (diff) | |
download | geiser-guile-c34d04293ed5e2e67e4ed9422dbea54abd5d7f38.tar.gz geiser-guile-c34d04293ed5e2e67e4ed9422dbea54abd5d7f38.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 'geiser')
-rw-r--r-- | geiser/completion.scm | 25 |
1 files changed, 3 insertions, 22 deletions
diff --git a/geiser/completion.scm b/geiser/completion.scm index f4342bb..564b8f5 100644 --- a/geiser/completion.scm +++ b/geiser/completion.scm @@ -31,28 +31,9 @@ #:use-module (ice-9 session) #:use-module (ice-9 regex)) -(define (completions prefix . context) - (let ((context (and (not (null? context)) (car context))) - (prefix (string-append "^" (regexp-quote prefix)))) - (append (filter (lambda (s) (string-match prefix s)) - (map symbol->string (local-bindings context))) - (sort! (map symbol->string (apropos-internal prefix)) string<?)))) - -(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 (completions prefix) + (let ((prefix (string-append "^" (regexp-quote prefix)))) + (sort! (map symbol->string (apropos-internal prefix)) string<?))) (define (module-completions prefix) (let* ((prefix (string-append "^" (regexp-quote prefix))) |