* [PATCH] Properly display locations in "source vector" form.
@ 2022-08-26 9:50 Andrew Whatson
2022-08-26 10:50 ` lloda
0 siblings, 1 reply; 3+ messages in thread
From: Andrew Whatson @ 2022-08-26 9:50 UTC (permalink / raw)
To: guile-devel; +Cc: Andrew Whatson
Locations are stored in tree-il records in "source vector" form, but
`location-string' was rendering these as <unknown-location>.
* module/system/base/message.scm (location-string): Support locations
passed as a file/line/column vector.
---
module/system/base/message.scm | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/module/system/base/message.scm b/module/system/base/message.scm
index 3cd862bd4..869afa783 100644
--- a/module/system/base/message.scm
+++ b/module/system/base/message.scm
@@ -41,12 +41,19 @@
;;;
(define (location-string loc)
- (if (pair? loc)
- (format #f "~a:~a:~a"
- (or (assoc-ref loc 'filename) "<stdin>")
- (1+ (assoc-ref loc 'line))
- (assoc-ref loc 'column))
- "<unknown-location>"))
+ (define (format-loc file line column)
+ (format #f "~a:~a:~a"
+ (or file "<stdin>")
+ (1+ line)
+ column))
+ (match loc
+ (#(file line column)
+ (format-loc file line column))
+ ((? pair? loc)
+ (format-loc (assoc-ref loc 'filename)
+ (assoc-ref loc 'line)
+ (assoc-ref loc 'column)))
+ (_ "<unknown-location>")))
\f
;;;
--
2.37.2
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Properly display locations in "source vector" form.
2022-08-26 9:50 [PATCH] Properly display locations in "source vector" form Andrew Whatson
@ 2022-08-26 10:50 ` lloda
2022-08-26 10:54 ` Jean Abou Samra
0 siblings, 1 reply; 3+ messages in thread
From: lloda @ 2022-08-26 10:50 UTC (permalink / raw)
To: Andrew Whatson; +Cc: guile-devel
Ah this one has been bugging me. Applied in eb5ecf4944cd646341f7e47dda5396cf96a4b8a3.
Thank you!
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Properly display locations in "source vector" form.
2022-08-26 10:50 ` lloda
@ 2022-08-26 10:54 ` Jean Abou Samra
0 siblings, 0 replies; 3+ messages in thread
From: Jean Abou Samra @ 2022-08-26 10:54 UTC (permalink / raw)
To: lloda, Andrew Whatson; +Cc: guile-devel
Le 26/08/2022 à 12:50, lloda a écrit :
> Ah this one has been bugging me. Applied in eb5ecf4944cd646341f7e47dda5396cf96a4b8a3.
>
> Thank you!
This likely fixes https://debbugs.gnu.org/cgi/bugreport.cgi?bug=56493.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-08-26 10:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-26 9:50 [PATCH] Properly display locations in "source vector" form Andrew Whatson
2022-08-26 10:50 ` lloda
2022-08-26 10:54 ` Jean Abou Samra
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).