From 16280bd4f81ab3fddeefc894cbeb6b46c86c0759 Mon Sep 17 00:00:00 2001 From: Ricardo Wurmus Date: Mon, 3 Jun 2019 23:46:28 +0200 Subject: spec: Add ignore-errors helper. * modules/language/python/spec.scm (ignore-errors): Add procedure. (int, in): Use it. --- modules/language/python/spec.scm | 26 +++++++++++++------------- 1 file 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" -- cgit v1.2.3