Subject: Re: bug#41811: `guix search` shows control sequences

From: Ludovic Courtès <[email-masked]>
Date: Sat, 13 Jun 2020 22:54:08 +0200

Hi,

Lars-Dominik Braun <[email-masked]> skribis:

> $ env | grep -i less
> LESS=-R -M --shift 5
> LESSOPEN=|lesspipe %s
> PAGER=/usr/bin/less
> $ less --version
> less 551 (PCRE2 regular expressions)
> […]

No control sequences if you do “unset LESS” before hand, right?

I think we’ll just override ‘LESS’ unconditionally as shown below.

Thanks,
Ludo’.

diff --git a/guix/ui.scm b/guix/ui.scm
index 98b30445c8..2595e44062 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -1563,8 +1563,7 @@ zero means that PACKAGE does not match any of REGEXPS."
       ;; Set 'LESS' so that 'less' exits if everything fits on the screen (F),
       ;; lets ANSI escapes through (r), does not send the termcap
       ;; initialization string (X).
-      (let ((pager (with-environment-variables `(("LESS"
-                                                  ,(or (getenv "LESS") "FrX")))
+      (let ((pager (with-environment-variables `(("LESS" "FrX"))
                      (open-pipe* OPEN_WRITE
                                  (or (getenv "GUIX_PAGER") (getenv "PAGER")
                                      "less")))))