From 3da62bf5aa358667621c8c390c755c5bfa45a93f Mon Sep 17 00:00:00 2001 From: Ludovic Courtès Date: Fri, 1 Apr 2022 15:41:00 +0200 Subject: ui: Move 'location->hyperlink' to (guix diagnostics). * guix/ui.scm (location->hyperlink): Move to... * guix/diagnostics.scm: ... here. * guix/scripts/system/search.scm: Adjust imports accordingly. --- guix/diagnostics.scm | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'guix/diagnostics.scm') 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." (($ 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)) ; -- cgit v1.2.3