Racket: configurable image cache directory
[geiser.git] / scheme / racket / geiser / completions.rkt
blob0ed18d11cded120f0f4c9a2babaed548337297aa
1 ;;; completions.rkt -- completion support
3 ;; Copyright (C) 2009, 2010 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: Sun Apr 26, 2009 19:02
12 #lang racket
14 (provide symbol-completions
15          module-completions)
17 (require srfi/13 geiser/utils geiser/modules)
19 (define (filter-prefix prefix lst sort?)
20   (filter (lambda (s) (string-prefix? prefix s))
21           (if sort? (sort lst string<?) lst)))
23 (define (symbol-completions prefix)
24   (filter-prefix prefix
25                  (map symbol->string (namespace-mapped-symbols))
26                  #t))
28 (define (module-completions prefix)
29   (filter-prefix prefix (module-list) #f))