From patchwork Fri Apr 1 15:01:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 38269 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 11A9727BBEA; Fri, 1 Apr 2022 16:09:33 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 6A06A27BBE9 for ; Fri, 1 Apr 2022 16:09:32 +0100 (BST) Received: from localhost ([::1]:34216 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1naIu3-0003Fo-HO for patchwork@mira.cbaines.net; Fri, 01 Apr 2022 11:09:31 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45520) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1naInm-0000hX-0p for guix-patches@gnu.org; Fri, 01 Apr 2022 11:03:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49167) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1naInl-000639-Ni for guix-patches@gnu.org; Fri, 01 Apr 2022 11:03:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1naInl-0002rH-Ki for guix-patches@gnu.org; Fri, 01 Apr 2022 11:03:01 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#54668] [PATCH 1/3] ui: Move hyperlink facilities to (guix colors). References: <20220401145955.32347-1-ludo@gnu.org> In-Reply-To: <20220401145955.32347-1-ludo@gnu.org> Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 01 Apr 2022 15:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54668 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 54668@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 54668-submit@debbugs.gnu.org id=B54668.164882532410885 (code B ref 54668); Fri, 01 Apr 2022 15:03:01 +0000 Received: (at 54668) by debbugs.gnu.org; 1 Apr 2022 15:02:04 +0000 Received: from localhost ([127.0.0.1]:43053 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1naImp-0002pQ-GV for submit@debbugs.gnu.org; Fri, 01 Apr 2022 11:02:04 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57566) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1naImn-0002oY-Cn for 54668@debbugs.gnu.org; Fri, 01 Apr 2022 11:02:01 -0400 Received: from [2001:470:142:3::e] (port=54944 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1naImi-0005tA-4D; Fri, 01 Apr 2022 11:01:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:Subject:To:From:in-reply-to: references; bh=o9Y9mhSe6+jgIV/RfzgHZ2JB99LVQmbg3CNXwXucQ2w=; b=NEs9znv4wMNNgk NHyU3Oi0j2v2LD5bz+Qb036nz/3/KW4oX5F6oQk30rcY7lPP1uMdAXTCFdoZJuqwE6ds0aOYo0rSu pGQf3fMpBJWFYSKzyNo2jskcCHAT8IkrFxfo9AFT0b16SXcG3tMcmx7v5hrnI6YuPonSH1gWRm3i7 Bu1dxfVFc0HxJcjWhTmBgXxLkDCt+UBkMi9eqdm3nROhj9ze0JB/aV7/94/lPvvH0ym+AKNdqKhhr KZ/kHihvzib8HKHC7P04Dl5/Hp0tsjaZSl8LprL19mwTHcljgjCcuvUnifeBRehBmu2ptZ7Ku5ryG gvGZzlwMcuCb9PT9vE2w==; Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=38740 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1naImh-0005LG-Nw; Fri, 01 Apr 2022 11:01:55 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Fri, 1 Apr 2022 17:01:44 +0200 Message-Id: <20220401150146.32529-1-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * guix/ui.scm (supports-hyperlinks?, file-hyperlink, hyperlink): Move to... * guix/colors.scm: ... here. * guix/scripts/home.scm, guix/scripts/system.scm, guix/scripts/system/search.scm: Adjust imports accordingly. --- guix/colors.scm | 35 +++++++++++++++++++++++++++++++++- guix/scripts/home.scm | 1 + guix/scripts/system.scm | 1 + guix/scripts/system/search.scm | 3 ++- guix/ui.scm | 27 -------------------------- 5 files changed, 38 insertions(+), 29 deletions(-) diff --git a/guix/colors.scm b/guix/colors.scm index ae0a583d94..2b3a7c9032 100644 --- a/guix/colors.scm +++ b/guix/colors.scm @@ -26,6 +26,7 @@ (define-module (guix colors) #:use-module (srfi srfi-9 gnu) #:use-module (ice-9 match) #:use-module (ice-9 regex) + #:autoload (web uri) (encode-and-join-uri-path) #:export (color color? @@ -36,7 +37,11 @@ (define-module (guix colors) color-rules color-output? - isatty?*)) + isatty?* + + supports-hyperlinks? + file-hyperlink + hyperlink)) ;;; Commentary: ;;; @@ -191,3 +196,31 @@ (define-syntax color-rules ((_ (regexp colors ...) ...) (colorize-matches `((,(make-regexp regexp) ,(color colors) ...) ...))))) + + +;;; +;;; Hyperlinks. +;;; + +(define (hyperlink uri text) + "Return a string that denotes a hyperlink using an OSC escape sequence as +documented at +." + (string-append "\x1b]8;;" uri "\x1b\\" + text "\x1b]8;;\x1b\\")) + +(define* (supports-hyperlinks? #:optional (port (current-output-port))) + "Return true if PORT is a terminal that supports hyperlink escapes." + ;; Note that terminals are supposed to ignore OSC escapes they don't + ;; understand (this is the case of xterm as of version 349, for instance.) + ;; However, Emacs comint as of 26.3 does not ignore it and instead lets it + ;; through, hence the 'INSIDE_EMACS' special case below. + (and (isatty?* port) + (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)) diff --git a/guix/scripts/home.scm b/guix/scripts/home.scm index af2643014d..341d83943d 100644 --- a/guix/scripts/home.scm +++ b/guix/scripts/home.scm @@ -45,6 +45,7 @@ (define-module (guix scripts home) #:use-module (guix channels) #:use-module (guix derivations) #:use-module (guix ui) + #:autoload (guix colors) (supports-hyperlinks? file-hyperlink) #:use-module (guix grafts) #:use-module (guix packages) #:use-module (guix profiles) diff --git a/guix/scripts/system.scm b/guix/scripts/system.scm index 067bf999f1..73e3c299c1 100644 --- a/guix/scripts/system.scm +++ b/guix/scripts/system.scm @@ -29,6 +29,7 @@ (define-module (guix scripts system) #:use-module (guix config) #:use-module (guix ui) + #:autoload (guix colors) (supports-hyperlinks? file-hyperlink) #:use-module ((guix status) #:select (with-status-verbosity)) #:use-module (guix store) #:autoload (guix base16) (bytevector->base16-string) diff --git a/guix/scripts/system/search.scm b/guix/scripts/system/search.scm index bf49ea2341..ff2ea7652c 100644 --- a/guix/scripts/system/search.scm +++ b/guix/scripts/system/search.scm @@ -1,5 +1,5 @@ ;;; GNU Guix --- Functional package management for GNU -;;; Copyright © 2017, 2018, 2019 Ludovic Courtès +;;; Copyright © 2017-2019, 2022 Ludovic Courtès ;;; Copyright © 2018 Clément Lassieur ;;; ;;; This file is part of GNU Guix. @@ -20,6 +20,7 @@ (define-module (guix scripts system search) #:use-module (guix ui) #:use-module (guix utils) + #:autoload (guix colors) (supports-hyperlinks?) #:use-module (gnu services) #:use-module (gnu services shepherd) #:use-module (srfi srfi-1) diff --git a/guix/ui.scm b/guix/ui.scm index 6c194eb3c9..6f2fe62784 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -76,7 +76,6 @@ (define-module (guix ui) #:autoload (ice-9 popen) (open-pipe* close-pipe) #:autoload (system repl repl) (start-repl) #:autoload (system repl debug) (make-debug stack->vector) - #:autoload (web uri) (encode-and-join-uri-path) #:use-module (texinfo) #:use-module (texinfo plain-text) #:use-module (texinfo string-utils) @@ -119,9 +118,6 @@ (define-module (guix ui) package->recutils package-specification->name+version+output - supports-hyperlinks? - hyperlink - file-hyperlink location->hyperlink pager-wrapped-port @@ -1488,29 +1484,6 @@ (define (string->recutils str) '() str))) -(define (hyperlink uri text) - "Return a string that denotes a hyperlink using an OSC escape sequence as -documented at -." - (string-append "\x1b]8;;" uri "\x1b\\" - text "\x1b]8;;\x1b\\")) - -(define* (supports-hyperlinks? #:optional (port (current-output-port))) - "Return true if PORT is a terminal that supports hyperlink escapes." - ;; Note that terminals are supposed to ignore OSC escapes they don't - ;; understand (this is the case of xterm as of version 349, for instance.) - ;; However, Emacs comint as of 26.3 does not ignore it and instead lets it - ;; through, hence the 'INSIDE_EMACS' special case below. - (and (isatty?* port) - (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) "Return a string corresponding to LOCATION, with escapes for a hyperlink." (let ((str (location->string location)) From patchwork Fri Apr 1 15:01:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 38267 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id B2CCD27BBEA; Fri, 1 Apr 2022 16:07:59 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 6EFFC27BBE9 for ; Fri, 1 Apr 2022 16:07:59 +0100 (BST) Received: from localhost ([::1]:57950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1naIsY-00007t-KA for patchwork@mira.cbaines.net; Fri, 01 Apr 2022 11:07:58 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45522) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1naInm-0000jA-CU for guix-patches@gnu.org; Fri, 01 Apr 2022 11:03:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49168) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1naInm-00063E-3c for guix-patches@gnu.org; Fri, 01 Apr 2022 11:03:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1naInm-0002rO-0k for guix-patches@gnu.org; Fri, 01 Apr 2022 11:03:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#54668] [PATCH 2/3] ui: Move 'location->hyperlink' to (guix diagnostics). Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 01 Apr 2022 15:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54668 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 54668@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 54668-submit@debbugs.gnu.org id=B54668.164882532410892 (code B ref 54668); Fri, 01 Apr 2022 15:03:01 +0000 Received: (at 54668) by debbugs.gnu.org; 1 Apr 2022 15:02:04 +0000 Received: from localhost ([127.0.0.1]:43055 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1naImq-0002pW-3Z for submit@debbugs.gnu.org; Fri, 01 Apr 2022 11:02:04 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57574) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1naImo-0002oZ-2R for 54668@debbugs.gnu.org; Fri, 01 Apr 2022 11:02:02 -0400 Received: from [2001:470:142:3::e] (port=54946 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1naImi-0005tf-Op; Fri, 01 Apr 2022 11:01:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=hVegxZiF76OrAkfB6Ve+trkVS5caVaJ+szK0zurSDFg=; b=kzgAzbFp307nYunyAzcq EmX6K6phH7wSYvM9Onim1axhRsBYXNNdDkxWWpxA45KVklTnIAeK3NdxbFa+zeJ6iGx/yp8QqfYYo CX6iNDZvwVSK6sREbbFpwrtudoWIzfclZMOTB4vxy5V6bA+UcqFNf5uUgLGfYwq6VILT/ZYAEdNzx 9myysEYU/J9xpFFOTP+EMWltLR4/cMl0FEX1gLPC9dIEF+dUlx8LhU7OIXIy/LoPqjblTWAzN0mVj /fX+ziVjren0S/RkW0buBGN03vjKJ2alRaR2fTPcPyZ3UW3QAKtocuyWKStEupnckh6mrORXncOZo 1NL+APWH26UIVQ==; Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=38740 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1naImi-0005LG-Bj; Fri, 01 Apr 2022 11:01:56 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Fri, 1 Apr 2022 17:01:45 +0200 Message-Id: <20220401150146.32529-2-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220401150146.32529-1-ludo@gnu.org> References: <20220401150146.32529-1-ludo@gnu.org> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * guix/ui.scm (location->hyperlink): Move to... * guix/diagnostics.scm: ... here. * guix/scripts/system/search.scm: Adjust imports accordingly. --- guix/diagnostics.scm | 11 +++++++++++ guix/scripts/system/search.scm | 1 + guix/ui.scm | 12 ------------ 3 files changed, 12 insertions(+), 12 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 @@ (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) (($ 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)) ; diff --git a/guix/scripts/system/search.scm b/guix/scripts/system/search.scm index ff2ea7652c..93c9fc5644 100644 --- a/guix/scripts/system/search.scm +++ b/guix/scripts/system/search.scm @@ -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) diff --git a/guix/ui.scm b/guix/ui.scm index 6f2fe62784..37d24030e4 100644 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -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)) From patchwork Fri Apr 1 15:01:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 38268 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 4919D27BBEA; Fri, 1 Apr 2022 16:08:06 +0100 (BST) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id 104DD27BBE9 for ; Fri, 1 Apr 2022 16:08:06 +0100 (BST) Received: from localhost ([::1]:58378 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1naIsf-0000TG-6A for patchwork@mira.cbaines.net; Fri, 01 Apr 2022 11:08:05 -0400 Received: from eggs.gnu.org ([209.51.188.92]:45524) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1naInm-0000kV-O7 for guix-patches@gnu.org; Fri, 01 Apr 2022 11:03:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:49169) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1naInm-00063K-FS for guix-patches@gnu.org; Fri, 01 Apr 2022 11:03:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1naInm-0002rW-D8 for guix-patches@gnu.org; Fri, 01 Apr 2022 11:03:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#54668] [PATCH 3/3] diagnostics: Turn diagnostic locations into hyperlinks. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Fri, 01 Apr 2022 15:03:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54668 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 54668@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= Received: via spool by 54668-submit@debbugs.gnu.org id=B54668.164882532410898 (code B ref 54668); Fri, 01 Apr 2022 15:03:02 +0000 Received: (at 54668) by debbugs.gnu.org; 1 Apr 2022 15:02:04 +0000 Received: from localhost ([127.0.0.1]:43057 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1naImq-0002pd-GT for submit@debbugs.gnu.org; Fri, 01 Apr 2022 11:02:04 -0400 Received: from eggs.gnu.org ([209.51.188.92]:57580) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1naImo-0002od-Ky for 54668@debbugs.gnu.org; Fri, 01 Apr 2022 11:02:02 -0400 Received: from [2001:470:142:3::e] (port=54948 helo=fencepost.gnu.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1naImj-0005uM-C9; Fri, 01 Apr 2022 11:01:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=t2nOHOuCrjPcN/1u0JP7Nhz51Y+XNnAyLNAScfRluvE=; b=FunJ22EqKb2zb6a07TdV dyY9vFbL8S1w+lI9R5GI6dLEJYDcclvxp2mB+ckTOffmf1ewqWGVUJ8B7lSCuj1FCpxj4TgxJ0JT+ pKcIoLhKdSBiJjD1M3GN6B5561ogxNCZYhFOnQRr5kUnJm23jlTfNunmYDuXB7NheJgolRvJvFumI WBYGsr8XPnUd1tCMlc/AXALJV3EiY6h3AnuYS8Suri+XuSFmM0qNmy8h6iejrdfXLqzAsBwac7W8H Fg5F1xfGlNxZ9siJcNDcg3oshSPQv7C2GRti3Pt8FZx7a9WJZLF58N66BtGlY8Hh3Iakvf1rKKqr1 CtnHgjV2yD/dJg==; Received: from [2001:660:6102:320:e120:2c8f:8909:cdfe] (port=38740 helo=gnu.org) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1naImi-0005LG-VW; Fri, 01 Apr 2022 11:01:57 -0400 From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Fri, 1 Apr 2022 17:01:46 +0200 Message-Id: <20220401150146.32529-3-ludo@gnu.org> X-Mailer: git-send-email 2.34.0 In-Reply-To: <20220401150146.32529-1-ludo@gnu.org> References: <20220401150146.32529-1-ludo@gnu.org> MIME-Version: 1.0 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org Sender: "Guix-patches" X-getmail-retrieved-from-mailbox: Patches * guix/diagnostics.scm (print-diagnostic-prefix): Use 'location->hyperlink' when 'supports-hyperlinks?' returns true. --- guix/diagnostics.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/guix/diagnostics.scm b/guix/diagnostics.scm index 2b8cee1ccb..bf1ced8140 100644 --- a/guix/diagnostics.scm +++ b/guix/diagnostics.scm @@ -204,7 +204,10 @@ (define prefix-color (gettext prefix %gettext-domain)))) (if location (format (guix-warning-port) "~a: ~a" - (location-color (location->string location)) + (location-color + (if (supports-hyperlinks? (guix-warning-port)) + (location->hyperlink location) + (location->string location))) (prefix-color prefix)) (format (guix-warning-port) "~:[~*~;guix ~a: ~]~a" (program-name) (program-name)