[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: A Guile debugger workgroup?
From: |
Jan Nieuwenhuizen |
Subject: |
Re: A Guile debugger workgroup? |
Date: |
Fri, 03 Mar 2023 11:30:51 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) |
Janneke Nieuwenhuizen writes:
Fixing typos in peek-error.
>From bf0f03090d73ea87f1be772010d6209b4372e78b Mon Sep 17 00:00:00 2001
From: "Jan (janneke) Nieuwenhuizen" <janneke@gnu.org>
Date: Fri, 3 Mar 2023 11:26:34 +0100
Subject: [PATCH] Add peek-error, pke.
Debuging using `pk' is popular in Guile, but not really usable if your
program is as (pseudo-)filter, i.e., writing its output to stdout.
* module/ice-9/boot-9.scm (peek-error, pke): New procedures.
---
module/ice-9/boot-9.scm | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/module/ice-9/boot-9.scm b/module/ice-9/boot-9.scm
index dc3537063..4868f6f3c 100644
--- a/module/ice-9/boot-9.scm
+++ b/module/ice-9/boot-9.scm
@@ -183,6 +183,16 @@ This is handy for tracing function calls, e.g.:
(define pk peek)
+(define (peek-error . stuff)
+ "Like PEEK (PK), writing to (CURRENT-ERROR-PORT)."
+ (newline (current-error-port))
+ (display ";;; " (current-error-port))
+ (write stuff (current-error-port))
+ (newline (current-error-port))
+ (car (last-pair stuff)))
+
+(define pke peek-error)
+
(define (warn . stuff)
(newline (current-warning-port))
(display ";;; WARNING " (current-warning-port))
--
2.39.1
--
Janneke Nieuwenhuizen <janneke@gnu.org> | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | AvatarĀ® https://AvatarAcademy.com