[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/geiser-guile 3a80209 164/284: Guile: evaluation warnings
From: |
Philip Kaludercic |
Subject: |
[nongnu] elpa/geiser-guile 3a80209 164/284: Guile: evaluation warnings |
Date: |
Sun, 1 Aug 2021 18:29:37 -0400 (EDT) |
branch: elpa/geiser-guile
commit 3a80209b93ef0b7f9bad0fbce2d976c6b5b89e5f
Author: Jose Antonio Ortega Ruiz <jao@gnu.org>
Commit: Jose Antonio Ortega Ruiz <jao@gnu.org>
Guile: evaluation warnings
---
geiser/evaluation.scm | 49 +++++++++++++++++++++++++++++++------------------
1 file changed, 31 insertions(+), 18 deletions(-)
diff --git a/geiser/evaluation.scm b/geiser/evaluation.scm
index a0007c4..aba0cfe 100644
--- a/geiser/evaluation.scm
+++ b/geiser/evaluation.scm
@@ -19,6 +19,7 @@
#:use-module (srfi srfi-1)
#:use-module (language tree-il)
#:use-module (system base compile)
+ #:use-module (system base message)
#:use-module (system base pmatch)
#:use-module (system vm program)
#:use-module (ice-9 pretty-print))
@@ -38,31 +39,43 @@
(write (list (cons 'result result) (cons 'output output)))
(newline))
+(define compile-opts '(#:warnings (arity-mismatch unbound-variable)))
+
+(define (call-with-result thunk)
+ (letrec* ((result #f)
+ (output
+ (with-output-to-string
+ (lambda ()
+ (with-fluids ((*current-warning-port* (current-output-port)))
+ (set! result (thunk)))))))
+ (write-result result output)))
+
(define (ge:compile form module-name)
(let* ((module (or (find-module module-name) (current-module)))
- (result #f)
(ev (lambda ()
- (set! result
- (call-with-values
- (lambda ()
- (let* ((o (compile form
- #:to 'objcode #:env module))
- (thunk (make-program o)))
- (start-stack 'geiser-evaluation-stack
- (eval `(,thunk) module))))
- (lambda vs (map object->string vs)))))))
- (let ((output (with-output-to-string ev)))
- (write-result result output))))
+ (call-with-values
+ (lambda ()
+ (let* ((o (compile form
+ #:to 'objcode
+ #:env module
+ #:opts compile-opts))
+ (thunk (make-program o)))
+ (start-stack 'geiser-evaluation-stack
+ (eval `(,thunk) module))))
+ (lambda vs (map object->string vs))))))
+ (call-with-result ev)))
(define ge:eval ge:compile)
(define (ge:compile-file path)
- (write-result
- (let ((cr (compile-file path #:canonicalization 'absolute)))
- (and cr
- (list (object->string (save-module-excursion
- (lambda () (load-compiled cr)))))))
- ""))
+ (call-with-result
+ (lambda ()
+ (let ((cr (compile-file path
+ #:canonicalization 'absolute
+ #:opts compile-opts)))
+ (and cr
+ (list (object->string (save-module-excursion
+ (lambda () (load-compiled cr))))))))))
(define ge:load-file ge:compile-file)
- [nongnu] elpa/geiser-guile 6c9efbc 233/284: Guile: Fix subr argument name retrieval for Guile >= 2.0.9., (continued)
- [nongnu] elpa/geiser-guile 6c9efbc 233/284: Guile: Fix subr argument name retrieval for Guile >= 2.0.9., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 3bf45a4 249/284: Clean up indentation rules, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 9d0d38a 237/284: Guile: augmenting %load-compiled-path too, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile a1078b9 254/284: Fixing guile 2.2 compatibility, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile ef3fb34 264/284: Really fix #252, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 8bf1a8b 268/284: Fix indentation, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile ba4c1a9 276/284: adjustments to scheme load path, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 700ac98 282/284: Use new implementation extension declarator., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 5e2c874 139/284: Golfing., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 06d7cf5 144/284: Guile: taking advantage of the patterns property in macro transformers., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 3a80209 164/284: Guile: evaluation warnings,
Philip Kaludercic <=
- [nongnu] elpa/geiser-guile 7563473 167/284: Guile: configurable warning level, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 17ebbec 183/284: Autodoc: fix for improper macro arglists scanning, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 04fd67f 185/284: Always fallback to edit-module in M-., Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile cd2cfae 190/284: Guile: better meta-command args handling, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile c8dcc24 202/284: Make do with a single connection, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile fef0d8a 209/284: Document browser improvements, and Racket using them, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 190290b 213/284: Guile: fixes for documentation display, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile 6d69176 216/284: No more interning in the scheme reader, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile b9a8980 224/284: Guile: what if i do what i meant to do?, Philip Kaludercic, 2021/08/01
- [nongnu] elpa/geiser-guile d6fca59 232/284: guile: lambda* indentation, Philip Kaludercic, 2021/08/01