[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 4/4] load: Display modules depth in output when using %loa
From: |
Maxime Devos |
Subject: |
Re: [PATCH v2 4/4] load: Display modules depth in output when using %load-verbosely. |
Date: |
Mon, 25 Sep 2023 12:40:18 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 |
Op 10-09-2023 om 16:46 schreef Maxim Cournoyer:
- (force-output)))))
+(define (%load-announce file depth)
+ (when %load-verbosely
+ (with-output-to-port (current-warning-port)
+ (lambda ()
+ (let* ((pad-count (- 3 (string-length (number->string depth))))
+ (pad (if (> pad-count 0)
+ (make-string pad-count #\space)
+ ""))
+ (visual-depth (if (> pad-count 0)
+ (make-string depth #\space)
+ "")))
+ (format #t ";;; loading ~a~a ~a~a~%" pad depth visual-depth file)
+ (force-output))))))
I recommend removing that with-output-to-port and instead replace #t in
(format #t ...) by (current-warning-port) and adding the relevant
argument to force-output.
Sure, it probably usually won't matter much in practice, but who knows,
maybe someone will do a system-async-mark (*) that happens to be run
inside the with-output-to-port and which uses (current-output-port), in
which case (with-output-to-port ...) would interfere.
(Note: if you do a system-async-mark that prints output, when possible I
recommend that the interrupt procedure doesn't assume the port isn't
temporarily changed.)
(*) Roughly similar to C signal handlers.
(I now see there is a v3, but the v3 does the same thing ...)
Best regards,
Maxime Devos.
OpenPGP_0x49E3EE22191725EE.asc
Description: OpenPGP public key
OpenPGP_signature
Description: OpenPGP digital signature
- [PATCH 0/4] Add module depth information to %load-verbosely output, Maxim Cournoyer, 2023/09/10
- [PATCH 1/4] (ice-9 boot-9): Fix typo., Maxim Cournoyer, 2023/09/10
- [PATCH 2/4] .dir-locals: Set c-basic-offset to 2 for c-mode., Maxim Cournoyer, 2023/09/10
- [PATCH 3/4] guix.scm: Update guile package native inputs., Maxim Cournoyer, 2023/09/10
- [PATCH 4/4] load: Display modules depth in output when using %load-verbosely., Maxim Cournoyer, 2023/09/10
- [PATCH v2 0/4] Add module depth information to %load-verbosely output, Maxim Cournoyer, 2023/09/10
- [PATCH v2 1/4] (ice-9 boot-9): Fix typo., Maxim Cournoyer, 2023/09/10
- [PATCH v2 2/4] .dir-locals: Set c-basic-offset to 2 for c-mode., Maxim Cournoyer, 2023/09/10
- [PATCH v2 3/4] guix.scm: Update guile package native inputs., Maxim Cournoyer, 2023/09/10
- [PATCH v2 4/4] load: Display modules depth in output when using %load-verbosely., Maxim Cournoyer, 2023/09/10
- Re: [PATCH v2 4/4] load: Display modules depth in output when using %load-verbosely.,
Maxime Devos <=
- [PATCH v3 0/4] Add module depth information to %load-verbosely output, Maxim Cournoyer, 2023/09/10