summaryrefslogtreecommitdiff
path: root/guix/diagnostics.scm
diff options
context:
space:
mode:
Diffstat (limited to 'guix/diagnostics.scm')
-rw-r--r--guix/diagnostics.scm11
1 files changed, 11 insertions, 0 deletions
diff --git a/guix/diagnostics.scm b/guix/diagnostics.scm
index 337a73c1a2..2b8cee1ccb 100644
--- a/guix/diagnostics.scm
+++ b/guix/diagnostics.scm
@@ -39,6 +39,7 @@
source-properties->location
location->source-properties
location->string
+ location->hyperlink
&error-location
error-location?
@@ -259,6 +260,16 @@ a location object."
(($ <location> file line column)
(format #f "~a:~a:~a" file line column))))
+(define (location->hyperlink location)
+ "Return a string corresponding to LOCATION, with escapes for a hyperlink."
+ (let ((str (location->string location))
+ (file (if (string-prefix? "/" (location-file location))
+ (location-file location)
+ (search-path %load-path (location-file location)))))
+ (if file
+ (file-hyperlink file str)
+ str)))
+
(define-condition-type &error-location &error
error-location?
(location error-location)) ;<location>