diff options
author | Dan Leslie <dan@ironoxide.ca> | 2015-12-02 21:47:23 -0800 |
---|---|---|
committer | Dan Leslie <dan@ironoxide.ca> | 2015-12-05 06:52:05 -0800 |
commit | 49da44f6373718400833585dd494a35f71205d6e (patch) | |
tree | 23513c439fd2a9f860fb9cd250eab36d59345b9e | |
parent | d44d5cbda1013b682ab6c3a3938c7d484e3ce885 (diff) | |
download | geiser-guile-49da44f6373718400833585dd494a35f71205d6e.tar.gz geiser-guile-49da44f6373718400833585dd494a35f71205d6e.tar.bz2 |
Fixes for Literals, Errors and Modules
If literals were present chicken wouldn't provide any autodocumentation
due to an error. Module evaluation was failing due to poor
input. Chicken's Error output was failing to parse
- Filter out all non-symbols from the autodoc set
- Properly escape module names
- Add "Error" to the set of accepted error prefixes
-rw-r--r-- | elisp/geiser-chicken.el | 5 | ||||
-rw-r--r-- | elisp/geiser-connection.el | 2 | ||||
-rw-r--r-- | scheme/chicken/geiser/emacs.scm | 37 |
3 files changed, 25 insertions, 19 deletions
diff --git a/elisp/geiser-chicken.el b/elisp/geiser-chicken.el index a68ab7b..88d60cf 100644 --- a/elisp/geiser-chicken.el +++ b/elisp/geiser-chicken.el @@ -143,8 +143,9 @@ This function uses `geiser-chicken-init-file' if it exists." (defun geiser-chicken--geiser-procedure (proc &rest args) (case proc ((eval compile) - (let ((form (mapconcat 'identity (cdr args) " "))) - (format "(geiser-eval %s '%s)" (or (car args) "#f") form))) + (let ((form (mapconcat 'identity (cdr args) " ")) + (module (if (car args) (concat "'" (car args)) "#f"))) + (format "(geiser-eval %s '%s)" module form))) ((load-file compile-file) (format "(geiser-load-file %s)" (car args))) ((no-values) diff --git a/elisp/geiser-connection.el b/elisp/geiser-connection.el index e466cd3..8a3de31 100644 --- a/elisp/geiser-connection.el +++ b/elisp/geiser-connection.el @@ -202,7 +202,7 @@ `((error (key . geiser-debugger)) (output . ,answer)) (condition-case err - (let ((start (string-match "((\\(?:result)?\\|error\\) " answer))) + (let ((start (string-match "((\\(?:result)?\\|error\\|Error\\) " answer))) (or (and start (car (read-from-string answer start))) `((error (key . retort-syntax)) (output . ,answer)))) (error `((error (key . geiser-con-error)) diff --git a/scheme/chicken/geiser/emacs.scm b/scheme/chicken/geiser/emacs.scm index 401eb90..f31bba9 100644 --- a/scheme/chicken/geiser/emacs.scm +++ b/scheme/chicken/geiser/emacs.scm @@ -432,21 +432,20 @@ ;; Builds a signature list from an identifier (define (find-signatures sym) - (let ((str (->string sym))) + (map + (cut fmt sym <>) + (filter + (lambda (v) + (eq? (car v) sym)) (map - (cut fmt sym <>) - (filter - (lambda (v) - (eq? (car v) sym)) - (map - (lambda (s) - ;; Remove egg name and add module - (let-values - (((name module) (remove-internal-name-mangling (car s)))) - (cons (string->symbol name) - (cons (if (string? module) (string->symbol module) module) - (cdr s))))) - (apropos-information-list sym #:macros? #t)))))) + (lambda (s) + ;; Remove egg name and add module + (let-values + (((name module) (remove-internal-name-mangling (car s)))) + (cons (string->symbol name) + (cons (if (string? module) (string->symbol module) module) + (cdr s))))) + (apropos-information-list sym #:macros? #t))))) ;; Builds the documentation from Chicken Doc for a specific symbol (define (make-doc symbol #!optional (filter-for-type #f)) @@ -482,14 +481,18 @@ geiser-module-exports geiser-module-path geiser-module-location geiser-module-completions geiser-use-debug-log))) - (when (and module - (not (symbol? module))) + (define (form-has-any-geiser? form) + (string-has-prefix? (->string (car form)) "geiser-")) + + (when (and module (not (symbol? module))) (error "Module should be a symbol")) ;; All calls start at toplevel (let* ((is-module? (form-has-module? form)) + (is-geiser? (form-has-any-geiser? form)) (is-safe-geiser? (form-has-safe-geiser? form)) (host-module (and (not is-module?) + (not is-geiser?) (any (cut equal? module <>) (list-modules)) module)) (thunk (lambda () (eval form)))) @@ -567,6 +570,8 @@ ((null? ids) '()) ((not (list? ids)) (geiser-autodoc (list ids))) + ((not (symbol? (car ids))) + (geiser-autodoc (cdr ids))) (else (let ((details (find-signatures (car ids)))) (if (null? details) |