@@ -39,6 +39,7 @@ (define-module (guix diagnostics)
source-properties->location
location->source-properties
location->string
+ location->hyperlink
&error-location
error-location?
@@ -259,6 +260,16 @@ (define (location->string loc)
(($ <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>
@@ -21,6 +21,7 @@ (define-module (guix scripts system search)
#:use-module (guix ui)
#:use-module (guix utils)
#:autoload (guix colors) (supports-hyperlinks?)
+ #:autoload (guix diagnostics) (location->hyperlink)
#:use-module (gnu services)
#:use-module (gnu services shepherd)
#:use-module (srfi srfi-1)
@@ -118,8 +118,6 @@ (define-module (guix ui)
package->recutils
package-specification->name+version+output
- location->hyperlink
-
pager-wrapped-port
with-paginated-output-port
relevance
@@ -1484,16 +1482,6 @@ (define (string->recutils str)
'()
str)))
-(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* (package->recutils p port #:optional (width (%text-width))
#:key
(hyperlinks? (supports-hyperlinks? port))