dotemacs

My Emacs configuration
git clone git://git.entf.net/dotemacs
Log | Files | Refs | LICENSE

completion.scm (1015B)


      1 ;;; completion.scm -- completing known symbols and module names
      2 
      3 ;; Copyright (C) 2009, 2012 Jose Antonio Ortega Ruiz
      4 
      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>.
      9 
     10 ;; Start date: Mon Mar 02, 2009 02:22
     11 
     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))
     18 
     19 (define (completions prefix)
     20   (let ((prefix (string-append "^" (regexp-quote prefix))))
     21     (sort! (map symbol->string (apropos-internal prefix)) string<?)))
     22 
     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<?)))