diff options
-rw-r--r-- | elisp/geiser-chicken.el | 15 | ||||
-rw-r--r-- | scheme/chicken/geiser/emacs.scm | 26 |
2 files changed, 28 insertions, 13 deletions
diff --git a/elisp/geiser-chicken.el b/elisp/geiser-chicken.el index 90f97fe..cb5dbf8 100644 --- a/elisp/geiser-chicken.el +++ b/elisp/geiser-chicken.el @@ -60,6 +60,11 @@ started." :type '(repeat file) :group 'geiser-chicken) +(geiser-custom--defcustom geiser-chicken-compile-geiser-p t + "Non-nil means that the Geiser runtime will be compiled on load." + :type 'boolean + :group 'geiser-chicken) + (geiser-custom--defcustom geiser-chicken-init-file "~/.chicken-geiser" "Initialization file with user code for the Chicken REPL. If all you want is to load ~/.csirc, set @@ -259,9 +264,13 @@ This function uses `geiser-chicken-init-file' if it exists." (defun geiser-chicken--startup (remote) (compilation-setup t) - (let ((geiser-log-verbose-p t)) - (geiser-eval--send/wait (format "(use utils)(compile-file \"%s\")\n" - (expand-file-name "chicken/geiser/emacs.scm" geiser-scheme-dir))))) + (let ((geiser-log-verbose-p t) + (geiser-chicken-load-file (expand-file-name "chicken/geiser/emacs.scm" geiser-scheme-dir))) + (if geiser-chicken-compile-geiser-p + (geiser-eval--send/wait (format "(use utils)(compile-file \"%s\")(import geiser)" + geiser-chicken-load-file)) + (geiser-eval--send/wait (format "(load \"%s\")" + geiser-chicken-load-file))))) ;;; Implementation definition: diff --git a/scheme/chicken/geiser/emacs.scm b/scheme/chicken/geiser/emacs.scm index 05c5101..e4e84c0 100644 --- a/scheme/chicken/geiser/emacs.scm +++ b/scheme/chicken/geiser/emacs.scm @@ -231,11 +231,12 @@ (define (describe-symbol sym #!key (exact? #f)) (let* ((str (symbol->string sym)) (found (apropos-information-list (regexp (make-apropos-regex str)) #:macros? #t))) - (if exact? - (filter (lambda (v) - (equal? str (string-substitute ".*#([^#]+)" "\\1" (symbol->string (car v))))) - found) - found))) + (delete-duplicates + (if exact? + (filter (lambda (v) + (equal? str (string-substitute ".*#([^#]+)" "\\1" (symbol->string (car v))))) + found) + found)))) ;; Wraps output from geiser functions (define (call-with-result module thunk) @@ -255,9 +256,14 @@ (switch-module original-module) - (set! result (if (list? result) - (map (lambda (v) (with-output-to-string (lambda () (write v)))) result) - (list (with-output-to-string (lambda () (write result)))))) + (set! result + (cond + ((list? result) + (map (lambda (v) (with-output-to-string (lambda () (write v)))) result)) + ((eq? result (if #f #t)) + (list output)) + (else + (list (with-output-to-string (lambda () (write result))))))) (let ((out-form `((result ,@result) @@ -415,7 +421,7 @@ (map fmt (find sym))) - ;; Builds the documentation from Chicken Doc for a specific ymbol + ;; Builds the documentation from Chicken Doc for a specific symbol (define (make-doc symbol #!optional (filter-for-type #f)) (with-output-to-string (lambda () @@ -590,7 +596,7 @@ (let* ((directory (if (symbol? directory) (symbol->string directory) directory)) - (directory (if (not (equal? #\/ (string-ref directory (- (string-length directory 1))))) + (directory (if (not (equal? #\/ (string-ref directory (- (string-length directory))))) (string-append directory "/") directory))) (call-with-result #f |