Racket: fix for module compilation for recent rackets
[geiser.git] / scheme / guile / geiser / completion.scm
blob3f76a275cf8db97f1c8aebde4abcf46bd00f5857
1 ;;; completion.scm -- completing known symbols and module names
3 ;; Copyright (C) 2009 Jose Antonio Ortega Ruiz
5 ;; This program is free software; you can redistribute it and/or
6 ;; modify it under the terms of the Modified BSD License. You should
7 ;; have received a copy of the license along with this program. If
8 ;; not, see <http://www.xfree86.org/3.3.6/COPYRIGHT2.html#5>.
10 ;; Start date: Mon Mar 02, 2009 02:22
12 (define-module (geiser completion)
13   #:export (completions module-completions)
14   #:use-module (geiser utils)
15   #:use-module (geiser modules)
16   #:use-module (ice-9 session)
17   #:use-module (ice-9 regex))
19 (define (completions prefix)
20   (let ((prefix (string-append "^" (regexp-quote prefix))))
21     (sort! (map symbol->string (apropos-internal prefix)) string<?)))
23 (define (module-completions prefix)
24   (let* ((prefix (string-append "^" (regexp-quote prefix)))
25          (matcher (lambda (s) (string-match prefix s)))
26          (names (filter matcher (all-modules))))
27     (sort! names string<?)))
29 ;;; completion.scm ends here