diff options
author | Ricardo Wurmus <rekado@elephly.net> | 2019-06-03 23:46:28 +0200 |
---|---|---|
committer | Ricardo Wurmus <rekado@elephly.net> | 2019-06-04 00:05:16 +0200 |
commit | 16280bd4f81ab3fddeefc894cbeb6b46c86c0759 (patch) | |
tree | 57c9099e3eb4135d0656f78b678c833e1bd4c8af /modules | |
parent | 82554e6990aa55dea4bf0b1cc1c2ca7cd46ef778 (diff) |
spec: Add ignore-errors helper.
* modules/language/python/spec.scm (ignore-errors): Add procedure.
(int, in): Use it.
Diffstat (limited to 'modules')
-rw-r--r-- | modules/language/python/spec.scm | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/modules/language/python/spec.scm b/modules/language/python/spec.scm index f1fc78b..46b46e8 100644 --- a/modules/language/python/spec.scm +++ b/modules/language/python/spec.scm @@ -37,18 +37,19 @@ (define (e x) (eval (c #t x) (current-module))) +(define (ignore-errors proc) + "Run PROC and ignore all errors." + (catch #t (lambda () (proc)) (const #f))) (define (int) - (catch #t - (lambda () - (not (fluid-ref (@@ (system base compile) %in-compile)))) - (const #f))) + (ignore-errors + (lambda () + (not (fluid-ref (@@ (system base compile) %in-compile)))))) (define (in) - (catch #t - (lambda () - (fluid-set! (@@ (system base compile) %in-compile) #t)) - (const #f))) + (ignore-errors + (lambda () + (fluid-set! (@@ (system base compile) %in-compile) #t)))) (define mapper (make-weak-key-hash-table)) @@ -66,11 +67,10 @@ (hash-set! mapper port port2) (lp port2))))))) -(catch #t - (lambda () - (set! (@@ (ice-9 readline) *readline-completion-function*) - (complete-python e))) - (const #f)) +(ignore-errors + (lambda () + (set! (@@ (ice-9 readline) *readline-completion-function*) + (complete-python e)))) (define-language python #:title "python" |