GNU bug report logs - #39642
[PATCH 1/3] ui: Only display link in capable terminals.

Previous Next

Package: guix-patches;

Reported by: Pierre Neidhardt <mail <at> ambrevar.xyz>

Date: Mon, 17 Feb 2020 13:41:01 UTC

Severity: normal

Tags: patch

Done: Pierre Neidhardt <mail <at> ambrevar.xyz>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 39642 in the body.
You can then email your comments to 39642 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to guix-patches <at> gnu.org:
bug#39642; Package guix-patches. (Mon, 17 Feb 2020 13:41:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Pierre Neidhardt <mail <at> ambrevar.xyz>:
New bug report received and forwarded. Copy sent to guix-patches <at> gnu.org. (Mon, 17 Feb 2020 13:41:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: guix-patches <at> gnu.org
Subject: [PATCH 1/3] ui: Only display link in capable terminals.
Date: Mon, 17 Feb 2020 14:40:27 +0100
From: zimoun <zimon.toutoune <at> gmail.com>

* guix/ui.scm (display-generation): Display generation path on new line.
* guix/scripts/describe.scm (channel-commit-hyperlink): Add TRANSFORMER argument.
(display-profile-content): Use TRANSFORMER argument to display URL explicitly
when terminal does not support hyperlinks.
---
 guix/scripts/describe.scm | 16 ++++++++++++----
 guix/ui.scm               |  2 +-
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/guix/scripts/describe.scm b/guix/scripts/describe.scm
index f13f221da9..9a7bd52163 100644
--- a/guix/scripts/describe.scm
+++ b/guix/scripts/describe.scm
@@ -201,7 +201,12 @@ way and displaying details about the channel's source code."
                    (format #t (G_ "    commit: ~a~%")
                            (if (supports-hyperlinks?)
                                (channel-commit-hyperlink channel commit)
-                               commit))))
+                               commit))
+                   (when (not (supports-hyperlinks?)
+                              )
+                     (format #t (G_ "    URL: ~a~%")
+                             (channel-commit-hyperlink channel commit
+                                                       (lambda (url msg) url))))))
                 (_ #f)))
 
             ;; Show most recently installed packages last.
@@ -233,9 +238,12 @@ way and displaying details about the channel's source code."
 
 (define* (channel-commit-hyperlink channel
                                    #:optional
-                                   (commit (channel-commit channel)))
+                                   (commit (channel-commit channel))
+                                   (transformer hyperlink))
   "Return a hyperlink for COMMIT in CHANNEL, using COMMIT as the hyperlink's
-text.  The hyperlink links to a web view of COMMIT, when available."
+text.  The hyperlink links to a web view of COMMIT, when available.
+TRANSFORMER is a procedure of 2 arguments, a URI and text, and returns a
+string for display."
   (let* ((url  (channel-url channel))
          (uri  (string->uri url))
          (host (and uri (uri-host uri))))
@@ -244,7 +252,7 @@ text.  The hyperlink links to a web view of COMMIT, when available."
           (#f
            commit)
           ((_ template)
-           (hyperlink (template url commit) commit)))
+           (transformer (template url commit) commit)))
         commit)))
 
 
diff --git a/guix/ui.scm b/guix/ui.scm
index dce97fb7b9..7e3251446f 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -1636,7 +1636,7 @@ DURATION-RELATION with the current time."
     (let* ((file   (generation-file-name profile number))
            (link   (if (supports-hyperlinks?)
                        (cut file-hyperlink file <>)
-                       identity))
+                       (cut format #f (G_ "~a~%file: ~a") <> file)))
            (header (format #f (link (highlight (G_ "Generation ~a\t~a")))
                            number
                            (date->string
-- 
2.25.0





Information forwarded to guix-patches <at> gnu.org:
bug#39642; Package guix-patches. (Mon, 17 Feb 2020 13:43:01 GMT) Full text and rfc822 format available.

Message #8 received at 39642 <at> debbugs.gnu.org (full text, mbox):

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: 39642 <at> debbugs.gnu.org
Subject: [PATCH 2/3] ui: Don't disable colors when INSIDE_EMACS is set.
Date: Mon, 17 Feb 2020 14:42:45 +0100
* guix/colors.scm (color-output?): Remove INSIDE_EMACS condition.
---
 guix/colors.scm | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/guix/colors.scm b/guix/colors.scm
index b63ac37027..3031f54799 100644
--- a/guix/colors.scm
+++ b/guix/colors.scm
@@ -131,8 +131,7 @@ that subsequent output will not have any colors in effect."
 
 (define (color-output? port)
   "Return true if we should write colored output to PORT."
-  (and (not (getenv "INSIDE_EMACS"))
-       (not (getenv "NO_COLOR"))
+  (and (not (getenv "NO_COLOR"))
        (isatty?* port)))
 
 (define (coloring-procedure color)
-- 
2.25.0





Information forwarded to guix-patches <at> gnu.org:
bug#39642; Package guix-patches. (Mon, 17 Feb 2020 13:43:02 GMT) Full text and rfc822 format available.

Message #11 received at 39642 <at> debbugs.gnu.org (full text, mbox):

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: 39642 <at> debbugs.gnu.org
Subject: [PATCH 3/3] ui: Don't truncate search output when inside Emacs.
Date: Mon, 17 Feb 2020 14:42:46 +0100
* guix/ui.scm (display-search-results): Loop over all results when
  INSIDE_EMACS is set.
---
 guix/ui.scm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/guix/ui.scm b/guix/ui.scm
index 7e3251446f..77e538ccfb 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -1472,7 +1472,8 @@ them.  If PORT is a terminal, print at most a full screen of results."
                                  #:hyperlinks? links?
                                  #:extra-fields
                                  `((relevance . ,score)))))))
-         (if (and max-rows
+         (if (and (not (getenv "INSIDE_EMACS"))
+                  max-rows
                   (> (port-line port) first-line) ;print at least one result
                   (> (+ 4 (line-count text) (port-line port))
                      max-rows))
-- 
2.25.0





Information forwarded to guix-patches <at> gnu.org:
bug#39642; Package guix-patches. (Mon, 17 Feb 2020 16:07:02 GMT) Full text and rfc822 format available.

Message #14 received at 39642 <at> debbugs.gnu.org (full text, mbox):

From: zimoun <zimon.toutoune <at> gmail.com>
To: Pierre Neidhardt <mail <at> ambrevar.xyz>
Cc: 39642 <at> debbugs.gnu.org
Subject: Re: [bug#39642] [PATCH 1/3] ui: Only display link in capable
 terminals.
Date: Mon, 17 Feb 2020 17:05:45 +0100
Hi Pierre,

Thank you for looking at. :-)


On Mon, 17 Feb 2020 at 14:41, Pierre Neidhardt <mail <at> ambrevar.xyz> wrote:

> ---
>  guix/scripts/describe.scm | 16 ++++++++++++----
>  guix/ui.scm               |  2 +-
>  2 files changed, 13 insertions(+), 5 deletions(-)
>
> diff --git a/guix/scripts/describe.scm b/guix/scripts/describe.scm
> index f13f221da9..9a7bd52163 100644
> --- a/guix/scripts/describe.scm
> +++ b/guix/scripts/describe.scm
> @@ -201,7 +201,12 @@ way and displaying details about the channel's source code."
>                     (format #t (G_ "    commit: ~a~%")
>                             (if (supports-hyperlinks?)
>                                 (channel-commit-hyperlink channel commit)
> -                               commit))))
> +                               commit))
> +                   (when (not (supports-hyperlinks?)
> +                              )

Issue on the closing parenthesis ')'.
Indent?


> @@ -233,9 +238,12 @@ way and displaying details about the channel's source code."
>
>  (define* (channel-commit-hyperlink channel
>                                     #:optional
> -                                   (commit (channel-commit channel)))
> +                                   (commit (channel-commit channel))
> +                                   (transformer hyperlink))
>    "Return a hyperlink for COMMIT in CHANNEL, using COMMIT as the hyperlink's
> -text.  The hyperlink links to a web view of COMMIT, when available."
> +text.  The hyperlink links to a web view of COMMIT, when available.
> +TRANSFORMER is a procedure of 2 arguments, a URI and text, and returns a

I do not have tried with another 'transformer' than 'hyperlink' or
'identity'. :-)


Cheers,
simon




Information forwarded to guix-patches <at> gnu.org:
bug#39642; Package guix-patches. (Mon, 17 Feb 2020 22:20:01 GMT) Full text and rfc822 format available.

Message #17 received at 39642 <at> debbugs.gnu.org (full text, mbox):

From: zimoun <zimon.toutoune <at> gmail.com>
To: Pierre Neidhardt <mail <at> ambrevar.xyz>
Cc: 39642 <at> debbugs.gnu.org
Subject: Re: [bug#39642] [PATCH 1/3] ui: Only display link in capable
 terminals.
Date: Mon, 17 Feb 2020 23:19:12 +0100
Hi Pierre,

On which commit, do you apply this patch?
Maybe I am doing wrong, but it is not the file
'guix/scripts/describe.scm' but instead 'guix/scripts/describe.scm'.


On Mon, 17 Feb 2020 at 14:41, Pierre Neidhardt <mail <at> ambrevar.xyz> wrote:

> diff --git a/guix/scripts/describe.scm b/guix/scripts/describe.scm
> index f13f221da9..9a7bd52163 100644
> --- a/guix/scripts/describe.scm
> +++ b/guix/scripts/describe.scm
> @@ -201,7 +201,12 @@ way and displaying details about the channel's source code."

This does not apply on master. What do I miss?
Because on my checkout, the file which is impacted is 'guix/scripts/pull.scm'.

[...]

> diff --git a/guix/ui.scm b/guix/ui.scm
> index dce97fb7b9..7e3251446f 100644
> --- a/guix/ui.scm
> +++ b/guix/ui.scm
> @@ -1636,7 +1636,7 @@ DURATION-RELATION with the current time."

This seems correct.


All the best,
simon




Information forwarded to guix-patches <at> gnu.org:
bug#39642; Package guix-patches. (Tue, 18 Feb 2020 07:23:02 GMT) Full text and rfc822 format available.

Message #20 received at 39642 <at> debbugs.gnu.org (full text, mbox):

From: Pierre Neidhardt <mail <at> ambrevar.xyz>
To: zimoun <zimon.toutoune <at> gmail.com>
Cc: 39642 <at> debbugs.gnu.org
Subject: Re: [bug#39642] [PATCH 1/3] ui: Only display link in capable
 terminals.
Date: Tue, 18 Feb 2020 08:21:56 +0100
[Message part 1 (text/plain, inline)]
zimoun <zimon.toutoune <at> gmail.com> writes:

> Hi Pierre,
>
> On which commit, do you apply this patch?
> Maybe I am doing wrong, but it is not the file
> 'guix/scripts/describe.scm' but instead 'guix/scripts/describe.scm'.

I think you wrote this wrong! :)

A few days ago, Ludo moved the code from pull.scm to describe.scm.
Update master, you should see the changes.

-- 
Pierre Neidhardt
https://ambrevar.xyz/
[signature.asc (application/pgp-signature, inline)]

Information forwarded to guix-patches <at> gnu.org:
bug#39642; Package guix-patches. (Tue, 18 Feb 2020 08:05:01 GMT) Full text and rfc822 format available.

Message #23 received at 39642 <at> debbugs.gnu.org (full text, mbox):

From: zimoun <zimon.toutoune <at> gmail.com>
To: Pierre Neidhardt <mail <at> ambrevar.xyz>
Cc: 39642 <at> debbugs.gnu.org
Subject: Re: [bug#39642] [PATCH 1/3] ui: Only display link in capable
 terminals.
Date: Tue, 18 Feb 2020 09:04:09 +0100
On Tue, 18 Feb 2020 at 08:21, Pierre Neidhardt <mail <at> ambrevar.xyz> wrote:

> A few days ago, Ludo moved the code from pull.scm to describe.scm.
> Update master, you should see the changes.

Right. On Tuesday 11.
This old model of one way sending patches by email and other way
pushing silently does not scale. Whatever!


If you fix the closing parenthesis, it is fine with me.

Cheers,
simon




bug closed, send any further explanations to 39642 <at> debbugs.gnu.org and Pierre Neidhardt <mail <at> ambrevar.xyz> Request was from Pierre Neidhardt <mail <at> ambrevar.xyz> to control <at> debbugs.gnu.org. (Mon, 24 Feb 2020 10:19:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Mon, 23 Mar 2020 11:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 85 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.