ui: Add 'file-hyperlink'.
* guix/ui.scm (file-hyperlink): New procedure. (location->hyperlink): Use it.master
parent
73765c91ce
commit
fa983b8257
13
guix/ui.scm
13
guix/ui.scm
|
@ -111,6 +111,7 @@
|
||||||
package-specification->name+version+output
|
package-specification->name+version+output
|
||||||
|
|
||||||
supports-hyperlinks?
|
supports-hyperlinks?
|
||||||
|
file-hyperlink
|
||||||
location->hyperlink
|
location->hyperlink
|
||||||
|
|
||||||
relevance
|
relevance
|
||||||
|
@ -1255,6 +1256,13 @@ documented at
|
||||||
(and (isatty?* port)
|
(and (isatty?* port)
|
||||||
(not (getenv "INSIDE_EMACS"))))
|
(not (getenv "INSIDE_EMACS"))))
|
||||||
|
|
||||||
|
(define* (file-hyperlink file #:optional (text file))
|
||||||
|
"Return TEXT with escapes for a hyperlink to FILE."
|
||||||
|
(hyperlink (string-append "file://" (gethostname)
|
||||||
|
(encode-and-join-uri-path
|
||||||
|
(string-split file #\/)))
|
||||||
|
text))
|
||||||
|
|
||||||
(define (location->hyperlink location)
|
(define (location->hyperlink location)
|
||||||
"Return a string corresponding to LOCATION, with escapes for a hyperlink."
|
"Return a string corresponding to LOCATION, with escapes for a hyperlink."
|
||||||
(let ((str (location->string location))
|
(let ((str (location->string location))
|
||||||
|
@ -1262,10 +1270,7 @@ documented at
|
||||||
(location-file location)
|
(location-file location)
|
||||||
(search-path %load-path (location-file location)))))
|
(search-path %load-path (location-file location)))))
|
||||||
(if file
|
(if file
|
||||||
(hyperlink (string-append "file://" (gethostname)
|
(file-hyperlink file str)
|
||||||
(encode-and-join-uri-path
|
|
||||||
(string-split file #\/)))
|
|
||||||
str)
|
|
||||||
str)))
|
str)))
|
||||||
|
|
||||||
(define* (package->recutils p port #:optional (width (%text-width))
|
(define* (package->recutils p port #:optional (width (%text-width))
|
||||||
|
|
Reference in New Issue