unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
From: Jan Nieuwenhuizen <janneke@gnu.org>
To: "Dr. Arne Babenhauserheide" <arne_bab@web.de>
Cc: Olivier Dion <olivier.dion@polymtl.ca>,  guile-devel@gnu.org
Subject: Re: A Guile debugger workgroup?
Date: Fri, 03 Mar 2023 11:30:51 +0100	[thread overview]
Message-ID: <87sfem1604.fsf@gnu.org> (raw)
In-Reply-To: <87wn3y1644.fsf@gnu.org> (Janneke Nieuwenhuizen's message of "Fri, 03 Mar 2023 11:28:27 +0100")

[-- Attachment #1: Type: text/plain, Size: 60 bytes --]

Janneke Nieuwenhuizen writes:

Fixing typos in peek-error.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-peek-error-pke.patch --]
[-- Type: text/x-patch, Size: 1140 bytes --]

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


[-- Attachment #3: Type: text/plain, Size: 164 bytes --]


-- 
Janneke Nieuwenhuizen <janneke@gnu.org>  | GNU LilyPond https://LilyPond.org
Freelance IT https://www.JoyOfSource.com | Avatar® https://AvatarAcademy.com

      reply	other threads:[~2023-03-03 10:30 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-29 17:21 A Guile debugger workgroup? Olivier Dion via Developers list for Guile, the GNU extensibility library
2022-11-29 17:58 ` Neil Jerram
2023-03-01 15:59   ` Maxim Cournoyer
2022-11-29 20:18 ` Damien Mattei
2023-03-02  6:18 ` Jannneke Nieuwenhuizen
2023-03-02  7:54   ` Dr. Arne Babenhauserheide
2023-03-03 10:28     ` Janneke Nieuwenhuizen
2023-03-03 10:30       ` Jan Nieuwenhuizen [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87sfem1604.fsf@gnu.org \
    --to=janneke@gnu.org \
    --cc=arne_bab@web.de \
    --cc=guile-devel@gnu.org \
    --cc=olivier.dion@polymtl.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).