From 669c414116215981d147f72e519eb92d19d582bf Mon Sep 17 00:00:00 2001 From: Timothy Sample Date: Mon, 20 May 2019 00:30:41 -0400 Subject: [PATCH] Prefer 'if-guile-version-below' to 'cond-expand'. * gash/compat.scm: Use 'if-guile-version-below' over 'cond-expand'. * gash/compat/textual-ports.scm: Ditto. --- gash/compat.scm | 20 +++++++++---------- gash/compat/textual-ports.scm | 36 +++++++++++++++++------------------ 2 files changed, 28 insertions(+), 28 deletions(-) diff --git a/gash/compat.scm b/gash/compat.scm index 60c3545..85c8979 100644 --- a/gash/compat.scm +++ b/gash/compat.scm @@ -57,13 +57,13 @@ (and (integer? x) (exact? x)))) #f) -(cond-expand - ((and guile-2 (not guile-2.2)) - (define* (setvbuf port mode #:optional size) - (let ((mode (match mode - ('none _IONBF) - ('line _IOLBF) - ('block _IOFBF)))) - ((@ (guile) setvbuf) port mode size))) - (export! setvbuf)) - (else #f)) +(if-guile-version-below (2 2 0) + (begin + (define* (setvbuf port mode #:optional size) + (let ((mode (match mode + ('none _IONBF) + ('line _IOLBF) + ('block _IOFBF)))) + ((@ (guile) setvbuf) port mode size))) + (export! setvbuf)) + #f) diff --git a/gash/compat/textual-ports.scm b/gash/compat/textual-ports.scm index 239d2e4..63c55df 100644 --- a/gash/compat/textual-ports.scm +++ b/gash/compat/textual-ports.scm @@ -16,7 +16,8 @@ ;;; You should have received a copy of the GNU General Public License ;;; along with Gash. If not, see . -(define-module (gash compat textual-ports)) +(define-module (gash compat textual-ports) + #:use-module (gash compat)) ;;; Commentary: ;;; @@ -25,20 +26,19 @@ ;;; ;;; Code: -(cond-expand - ((and guile-2 (not guile-2.2)) - (use-modules (rnrs io ports)) - (define (unget-char port char) - (unread-char char port)) - (re-export get-char - get-line - get-string-all - lookahead-char) - (export unget-char)) - (else - (use-modules (ice-9 textual-ports)) - (re-export get-char - get-line - get-string-all - lookahead-char - unget-char))) +(if-guile-version-below (2 2 0) + (begin + (use-modules (rnrs io ports)) + (re-export get-char + get-line + get-string-all + lookahead-char) + (define-public (unget-char port char) + (unread-char char port))) + (begin + (use-modules (ice-9 textual-ports)) + (re-export get-char + get-line + get-string-all + lookahead-char + unget-char)))