all messages for Guix-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Guix search, colors and INSIDE_EMACS
@ 2020-02-04 15:23 Pierre Neidhardt
  2020-02-04 16:12 ` Ricardo Wurmus
  0 siblings, 1 reply; 46+ messages in thread
From: Pierre Neidhardt @ 2020-02-04 15:23 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: text/plain, Size: 866 bytes --]

Hi!

I just discovered the existence of the INSIDE_EMACS variable (thank you,
Zimoun!) which disable the funky characters in `guix describe`,
etc. when run from Eshell or Emacs' M-x shell.

Sadly, it also disables colours.

On a related topic, I think we should disable the
 
--8<---------------cut here---------------start------------->8---
hint: Run `guix search ... | less' to view all the results.
--8<---------------cut here---------------end--------------->8---

feature when run inside Emacs, since Emacs is its own pager.

To sum up, I suggest to send a patch to fix the following:

- Rename it to GUIX_INSIDE_EMACS?
- Document the existence of INSIDE_EMACS.
- Leave colors on when inside Emacs.
- Disable the pager hint and display all research result when inside
  Emacs.

Thoughts?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-04 15:23 Guix search, colors and INSIDE_EMACS Pierre Neidhardt
@ 2020-02-04 16:12 ` Ricardo Wurmus
  2020-02-04 16:37   ` Pierre Neidhardt
  2020-02-04 16:40   ` zimoun
  0 siblings, 2 replies; 46+ messages in thread
From: Ricardo Wurmus @ 2020-02-04 16:12 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: guix-devel


Hi Pierre,

> - Rename it to GUIX_INSIDE_EMACS?
> - Document the existence of INSIDE_EMACS.

The variable is set by Emacs.  As an Emacs feature we should not
document it in Guix, nor should we rename it to GUIX_INSIDE_EMACS.

> - Leave colors on when inside Emacs.

Wouldn’t this mess with font lock in Emacs modes such as M-x shell?  My
colour theme has no place for a garish green :)

For prettier colours in Emacs we already have things like
guix-build-log-mode.

> - Disable the pager hint and display all research result when inside
>   Emacs.

Isn’t it considered best practise to set PAGER=cat when using Emacs as a
shell?  That’s what I do to show man pages (when I’m not using M-x
woman) or to have “git log” do the right thing.

--
Ricardo

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-04 16:12 ` Ricardo Wurmus
@ 2020-02-04 16:37   ` Pierre Neidhardt
  2020-02-04 16:51     ` zimoun
                       ` (3 more replies)
  2020-02-04 16:40   ` zimoun
  1 sibling, 4 replies; 46+ messages in thread
From: Pierre Neidhardt @ 2020-02-04 16:37 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 1640 bytes --]

Hi Ricardo,

> Hi Pierre,
>
>> - Rename it to GUIX_INSIDE_EMACS?
>> - Document the existence of INSIDE_EMACS.
>
> The variable is set by Emacs.  As an Emacs feature we should not
> document it in Guix, nor should we rename it to GUIX_INSIDE_EMACS.

Strange, I don't have this variable in my environment.  I use Emacs 26.3
and EXWM, I don't know if that makes a difference.

>> - Leave colors on when inside Emacs.
>
> Wouldn’t this mess with font lock in Emacs modes such as M-x shell?  My
> colour theme has no place for a garish green :)

In my experience, colors worked perfectly before the INSIDE_EMACS switch
was introduced.  I don't understand what this change tried to fix.
Maybe one fix broke something else.

> For prettier colours in Emacs we already have things like
> guix-build-log-mode.

This does not apply to all guix subcommands.

>> - Disable the pager hint and display all research result when inside
>>   Emacs.
>
> Isn’t it considered best practise to set PAGER=cat when using Emacs as a
> shell?  That’s what I do to show man pages (when I’m not using M-x
> woman) or to have “git log” do the right thing.

--8<---------------cut here---------------start------------->8---
env PAGER=cat guix search emacs
--8<---------------cut here---------------end--------------->8---

or

--8<---------------cut here---------------start------------->8---
export PAGER=cat
guix search emacs
--8<---------------cut here---------------end--------------->8---

still displays the hint for me in M-x shell or Eshell.

Any idea?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-04 16:12 ` Ricardo Wurmus
  2020-02-04 16:37   ` Pierre Neidhardt
@ 2020-02-04 16:40   ` zimoun
  2020-02-10 19:36     ` Pierre Neidhardt
  1 sibling, 1 reply; 46+ messages in thread
From: zimoun @ 2020-02-04 16:40 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: Guix Devel

[-- Attachment #1: Type: text/plain, Size: 748 bytes --]

Hi Ricardo,

On Tue, 4 Feb 2020 at 17:12, Ricardo Wurmus <rekado@elephly.net> wrote:

> > - Rename it to GUIX_INSIDE_EMACS?
> > - Document the existence of INSIDE_EMACS.
>
> The variable is set by Emacs.  As an Emacs feature we should not
> document it in Guix, nor should we rename it to GUIX_INSIDE_EMACS.

This is mitigated by foreign distro using bad packaged terminal, see e.g. [1].

[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=38940

And a couple of days, I was annoyed by this so I patched, see attached.


Note that 'guix system describe' has also the "issue" and do not use
the same function to display, I guess.


Otherwise, the OSC issue should be fixed by Emacs 27, I guess.
So the rename is probably not useful.



Cheers,
simon

[-- Attachment #2: fix-describe.patch --]
[-- Type: text/x-patch, Size: 2542 bytes --]

diff --git a/guix/scripts/pull.scm b/guix/scripts/pull.scm
index cb1be989e1..408db70555 100644
--- a/guix/scripts/pull.scm
+++ b/guix/scripts/pull.scm
@@ -210,9 +210,11 @@ Download and deploy the latest version of Guix.\n"))
 
 (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 allows to control how the uri and text are."
   (let* ((url  (channel-url channel))
          (uri  (string->uri url))
          (host (and uri (uri-host uri))))
@@ -221,7 +223,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)))
 
 (define* (display-profile-news profile #:key concise?
@@ -583,7 +585,11 @@ 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.
diff --git a/guix/ui.scm b/guix/ui.scm
index 4857a88827..ee56c23362 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -1625,7 +1625,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

^ permalink raw reply related	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-04 16:37   ` Pierre Neidhardt
@ 2020-02-04 16:51     ` zimoun
  2020-02-04 19:16     ` Ricardo Wurmus
                       ` (2 subsequent siblings)
  3 siblings, 0 replies; 46+ messages in thread
From: zimoun @ 2020-02-04 16:51 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: Guix Devel

On Tue, 4 Feb 2020 at 17:39, Pierre Neidhardt <mail@ambrevar.xyz> wrote:

> In my experience, colors worked perfectly before the INSIDE_EMACS switch
> was introduced.  I don't understand what this change tried to fix.
> Maybe one fix broke something else.

INSIDE_EMACS fixes the terminals that render OSC character
incorrectly. It appears in Emacs because there is a bug -- should be
fixed in the next release, not sure.
The other terminal deal correctly with this special character; except
if they are configured the bad way as 'terminal-mate' on Trisquel [1].

[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=38940

INSIDE_EMACS turn off 'link' and 'highlight'. Another modification I
did because I was annoyed. But it is broken because the highlight does
not work anymore neither.

--8<---------------cut here---------------start------------->8---
modified   guix/ui.scm
@@ -1625,7 +1625,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
--8<---------------cut here---------------end--------------->8---



Cheers,
simon

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-04 16:37   ` Pierre Neidhardt
  2020-02-04 16:51     ` zimoun
@ 2020-02-04 19:16     ` Ricardo Wurmus
  2020-02-04 19:18     ` Ricardo Wurmus
  2020-02-05 15:13     ` Ludovic Courtès
  3 siblings, 0 replies; 46+ messages in thread
From: Ricardo Wurmus @ 2020-02-04 19:16 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: guix-devel


Pierre Neidhardt <mail@ambrevar.xyz> writes:

>> Isn’t it considered best practise to set PAGER=cat when using Emacs as a
>> shell?  That’s what I do to show man pages (when I’m not using M-x
>> woman) or to have “git log” do the right thing.
>
> --8<---------------cut here---------------start------------->8---
> env PAGER=cat guix search emacs
> --8<---------------cut here---------------end--------------->8---
>
> or
>
> --8<---------------cut here---------------start------------->8---
> export PAGER=cat
> guix search emacs
> --8<---------------cut here---------------end--------------->8---
>
> still displays the hint for me in M-x shell or Eshell.

That’s because Guix doesn’t yet respect the PAGER variable.  But it
should.  Shortly after the hint was introduced and the display was
truncated by default there was a discussion about making Guix respect
PAGER and only display the hint when it wasn’t set.

--
Ricardo

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-04 16:37   ` Pierre Neidhardt
  2020-02-04 16:51     ` zimoun
  2020-02-04 19:16     ` Ricardo Wurmus
@ 2020-02-04 19:18     ` Ricardo Wurmus
  2020-02-06  9:51       ` Pierre Neidhardt
  2020-02-05 15:13     ` Ludovic Courtès
  3 siblings, 1 reply; 46+ messages in thread
From: Ricardo Wurmus @ 2020-02-04 19:18 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: guix-devel


Pierre Neidhardt <mail@ambrevar.xyz> writes:

>>> - Rename it to GUIX_INSIDE_EMACS?
>>> - Document the existence of INSIDE_EMACS.
>>
>> The variable is set by Emacs.  As an Emacs feature we should not
>> document it in Guix, nor should we rename it to GUIX_INSIDE_EMACS.
>
> Strange, I don't have this variable in my environment.  I use Emacs 26.3
> and EXWM, I don't know if that makes a difference.

The Emacs manual says:

--8<---------------cut here---------------start------------->8---
@cindex @env{INSIDE_EMACS} environment variable
  Emacs sets the environment variable @env{INSIDE_EMACS} in the
subshell to @samp{@var{version},comint}, where @var{version} is the
Emacs version (e.g., @samp{24.1}).  Programs can check this variable
to determine whether they are running inside an Emacs subshell.
--8<---------------cut here---------------end--------------->8---

I suppose you are not using a comint-derived mode for your shell then.

>> For prettier colours in Emacs we already have things like
>> guix-build-log-mode.
>
> This does not apply to all guix subcommands.

True, but wouldn’t it be nicer to use font-lock with customizable faces
instead of forcing a certain choice of colours on Emacs users?

--
Ricardo

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-04 16:37   ` Pierre Neidhardt
                       ` (2 preceding siblings ...)
  2020-02-04 19:18     ` Ricardo Wurmus
@ 2020-02-05 15:13     ` Ludovic Courtès
  2020-02-06  9:56       ` Pierre Neidhardt
  3 siblings, 1 reply; 46+ messages in thread
From: Ludovic Courtès @ 2020-02-05 15:13 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: guix-devel

Hi!

Pierre Neidhardt <mail@ambrevar.xyz> skribis:

> In my experience, colors worked perfectly before the INSIDE_EMACS switch
> was introduced.  I don't understand what this change tried to fix.
> Maybe one fix broke something else.

‘INSIDE_EMACS’ has always been honored by (guix colors).  Also, it’s
honored similar by all GNU tools and in particular Coreutils, which I
think is overall a good thing as Ricardo explained!

Now, it’s true that that there are cases where even shell-mode +
guix-build-log-mode doesn’t give you as much highlighting as ‘guix’
outside Emacs (for example for errors or highlights in all the
diagnostics.)  Perhaps we “just” need to enhance comint somehow!  :-)

Ludo’.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-04 19:18     ` Ricardo Wurmus
@ 2020-02-06  9:51       ` Pierre Neidhardt
  2020-02-13  9:30         ` zimoun
  0 siblings, 1 reply; 46+ messages in thread
From: Pierre Neidhardt @ 2020-02-06  9:51 UTC (permalink / raw)
  To: Ricardo Wurmus; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 736 bytes --]

Ricardo Wurmus <rekado@elephly.net> writes:

> I suppose you are not using a comint-derived mode for your shell then.

Precision: It works with M-x shell but not with Eshell.

>>> For prettier colours in Emacs we already have things like
>>> guix-build-log-mode.
>>
>> This does not apply to all guix subcommands.
>
> True, but wouldn’t it be nicer to use font-lock with customizable faces
> instead of forcing a certain choice of colours on Emacs users?

Hmmm, what do you suggest exactly?

M-x shell and Eshell support colors.  I don't see why `guix' should be
treated specially with regard to colors so why not just use them like
every other command line program?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-05 15:13     ` Ludovic Courtès
@ 2020-02-06  9:56       ` Pierre Neidhardt
  2020-02-07 21:33         ` Ludovic Courtès
  0 siblings, 1 reply; 46+ messages in thread
From: Pierre Neidhardt @ 2020-02-06  9:56 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 477 bytes --]

Hi!

Ludovic Courtès <ludo@gnu.org> writes:

> Hi!
>
> ‘INSIDE_EMACS’ has always been honored by (guix colors).  Also, it’s
> honored similar by all GNU tools and in particular Coreutils, which I
> think is overall a good thing as Ricardo explained!

Something did change for me a couple of months ago.  In particular,
`guix describe` used to display properly in Eshell / M-x shell.  It's no
longer the case.

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-06  9:56       ` Pierre Neidhardt
@ 2020-02-07 21:33         ` Ludovic Courtès
  2020-02-08 16:34           ` Pierre Neidhardt
  0 siblings, 1 reply; 46+ messages in thread
From: Ludovic Courtès @ 2020-02-07 21:33 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: guix-devel

Pierre Neidhardt <mail@ambrevar.xyz> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>> Hi!
>>
>> ‘INSIDE_EMACS’ has always been honored by (guix colors).  Also, it’s
>> honored similar by all GNU tools and in particular Coreutils, which I
>> think is overall a good thing as Ricardo explained!
>
> Something did change for me a couple of months ago.  In particular,
> `guix describe` used to display properly in Eshell / M-x shell.  It's no
> longer the case.

‘guix describe’ now produces hyperlink when not INSIDE_EMACS.  Could it
be what you’re seeing in Eshell?

Ludo’.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-07 21:33         ` Ludovic Courtès
@ 2020-02-08 16:34           ` Pierre Neidhardt
  0 siblings, 0 replies; 46+ messages in thread
From: Pierre Neidhardt @ 2020-02-08 16:34 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: guix-devel

[-- Attachment #1: Type: text/plain, Size: 403 bytes --]

Ludovic Courtès <ludo@gnu.org> writes:

> ‘guix describe’ now produces hyperlink when not INSIDE_EMACS.  Could it
> be what you’re seeing in Eshell?

Yes, this is what I'm talking about.  
I just tested again with M-x shell and I cannot reproduce the issue.
I've experienced some issue with M-x shell though, maybe it was
another command.

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-04 16:40   ` zimoun
@ 2020-02-10 19:36     ` Pierre Neidhardt
  2020-02-10 23:24       ` zimoun
  0 siblings, 1 reply; 46+ messages in thread
From: Pierre Neidhardt @ 2020-02-10 19:36 UTC (permalink / raw)
  To: zimoun, Ricardo Wurmus; +Cc: Guix Devel

[-- Attachment #1: Type: text/plain, Size: 643 bytes --]

This patch looks good to me.  If no one objects I'd like to merge it.

> +                                   (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 allows to control how the uri and text are."

uri -> URI.
"are displayed."
We should also tell the arguments TRANSFORMER takes.

Cheers!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-10 19:36     ` Pierre Neidhardt
@ 2020-02-10 23:24       ` zimoun
  2020-02-11  6:22         ` Pierre Neidhardt
  0 siblings, 1 reply; 46+ messages in thread
From: zimoun @ 2020-02-10 23:24 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: Guix Devel

Hi Pierre,

On Mon, 10 Feb 2020 at 20:36, Pierre Neidhardt <mail@ambrevar.xyz> wrote:
>
> This patch looks good to me.  If no one objects I'd like to merge it.

Thank you to give a look.

The issue is that the highlight is not done and I am not happy with it. :-)
Have you a fix for that?


> > +                                   (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 allows to control how the uri and text are."
>
> uri -> URI.
> "are displayed."
> We should also tell the arguments TRANSFORMER takes.

I will send you an update. And it will be up to you to merge it or not. :-)


Cheers,
simon

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-10 23:24       ` zimoun
@ 2020-02-11  6:22         ` Pierre Neidhardt
  2020-02-11 14:11           ` Ludovic Courtès
  2020-02-11 15:06           ` zimoun
  0 siblings, 2 replies; 46+ messages in thread
From: Pierre Neidhardt @ 2020-02-11  6:22 UTC (permalink / raw)
  To: zimoun; +Cc: Guix Devel

[-- Attachment #1: Type: text/plain, Size: 259 bytes --]

zimoun <zimon.toutoune@gmail.com> writes:

> The issue is that the highlight is not done and I am not happy with it. :-)
> Have you a fix for that?

What do you want to do exactly?  Underline the links?


-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-11  6:22         ` Pierre Neidhardt
@ 2020-02-11 14:11           ` Ludovic Courtès
  2020-02-11 14:19             ` Pierre Neidhardt
  2020-02-11 15:11             ` zimoun
  2020-02-11 15:06           ` zimoun
  1 sibling, 2 replies; 46+ messages in thread
From: Ludovic Courtès @ 2020-02-11 14:11 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: Guix Devel

Pierre Neidhardt <mail@ambrevar.xyz> skribis:

> zimoun <zimon.toutoune@gmail.com> writes:
>
>> The issue is that the highlight is not done and I am not happy with it. :-)
>> Have you a fix for that?
>
> What do you want to do exactly?  Underline the links?

It’s up to the terminal emulator to do that (VTE does that, Eterm does
some fancy animation.)

Ludo’.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-11 14:11           ` Ludovic Courtès
@ 2020-02-11 14:19             ` Pierre Neidhardt
  2020-02-11 15:14               ` zimoun
  2020-02-11 15:11             ` zimoun
  1 sibling, 1 reply; 46+ messages in thread
From: Pierre Neidhardt @ 2020-02-11 14:19 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix Devel

[-- Attachment #1: Type: text/plain, Size: 655 bytes --]

Ludovic Courtès <ludo@gnu.org> writes:

> Pierre Neidhardt <mail@ambrevar.xyz> skribis:
>
>> zimoun <zimon.toutoune@gmail.com> writes:
>>
>>> The issue is that the highlight is not done and I am not happy with it. :-)
>>> Have you a fix for that?
>>
>> What do you want to do exactly?  Underline the links?
>
> It’s up to the terminal emulator to do that (VTE does that, Eterm does
> some fancy animation.)

Assuming we spit out right escape characters.  Maybe what Zimoun meant
here is that when INSIDE_EMACS is set, we don't write any escape char,
so Eshell can't color anything here.

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-11  6:22         ` Pierre Neidhardt
  2020-02-11 14:11           ` Ludovic Courtès
@ 2020-02-11 15:06           ` zimoun
  1 sibling, 0 replies; 46+ messages in thread
From: zimoun @ 2020-02-11 15:06 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: Guix Devel

On Tue, 11 Feb 2020 at 07:22, Pierre Neidhardt <mail@ambrevar.xyz> wrote:
> zimoun <zimon.toutoune@gmail.com> writes:

> > The issue is that the highlight is not done and I am not happy with it. :-)
> > Have you a fix for that?
>
> What do you want to do exactly?  Underline the links?

It is not about the 'hyperlink' but about 'highlight'.

'Generation' is written with bold face, see 'display-generation' in
guix/ui.scm' and 'highlight' in 'guix/colors.cm'.
The highlighting is turned off but it is not related to the OSC
special character.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-11 14:11           ` Ludovic Courtès
  2020-02-11 14:19             ` Pierre Neidhardt
@ 2020-02-11 15:11             ` zimoun
  1 sibling, 0 replies; 46+ messages in thread
From: zimoun @ 2020-02-11 15:11 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix Devel

Hi Ludo,

On Tue, 11 Feb 2020 at 15:11, Ludovic Courtès <ludo@gnu.org> wrote:

> >> The issue is that the highlight is not done and I am not happy with it. :-)
> >> Have you a fix for that?
> >
> > What do you want to do exactly?  Underline the links?
>
> It’s up to the terminal emulator to do that (VTE does that, Eterm does
> some fancy animation.)

The (minor) issue is that the OSC is not always supported and some
terminal emulators are not doing the correct thing. For example EShell
or (incorrectly build) Mate of Trisquel.
Therefore, instead of displaying this special character, just print
the full path of the generation file and the commit url.
However, I miss something about the 'highlight' function because when
chaining the bold face of 'Generation' disappears.

Well, it does not matter so much because EShell fixes the issue in the
next release, I guess.


Cheers,
simon

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-11 14:19             ` Pierre Neidhardt
@ 2020-02-11 15:14               ` zimoun
  2020-02-11 16:37                 ` Jack Hill
  0 siblings, 1 reply; 46+ messages in thread
From: zimoun @ 2020-02-11 15:14 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: Guix Devel

On Tue, 11 Feb 2020 at 15:19, Pierre Neidhardt <mail@ambrevar.xyz> wrote:

> Assuming we spit out right escape characters.  Maybe what Zimoun meant
> here is that when INSIDE_EMACS is set, we don't write any escape char,
> so Eshell can't color anything here.

No, coloring and OSC are not related IMHO.
INSIDE_EMACS should turn off OSC but still keep on color.
I mean, the fact that color is turned off by the small patch is not a
feature but a bug. ;-)

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-11 15:14               ` zimoun
@ 2020-02-11 16:37                 ` Jack Hill
  2020-02-11 18:09                   ` zimoun
  2020-02-24 16:18                   ` Ludovic Courtès
  0 siblings, 2 replies; 46+ messages in thread
From: Jack Hill @ 2020-02-11 16:37 UTC (permalink / raw)
  To: Guix Devel

Hi Guix,

I've been trying to follow this discussion as I have observed problems 
with the linking characters in eshell. However, it seems I am having 
seeing different behavior than others. In both Emacs 26.3 and Emacs-next 
27.0.50, running as `emacs -q`, INSIDE_EMACS is not being set in eshell 
so, guix describe looks like

guix describe
]8;;file://lib-its13/var/guix/profiles/per-user/install/current-guix-66-link\Generation 66	Feb 07 2020 10:38:56]8;;\	(current)
   guix 232f344
     repository URL: https://git.savannah.gnu.org/git/guix.git
     branch: master
     commit: ]8;;https://git.savannah.gnu.org/cgit/guix.git/commit/?id=232f344f9b9dc775fe8f9c7db2e45ba20431b071\232f344f9b9dc775fe8f9c7db2e45ba20431b071]8;;\

In shell and term mode, INSIDE_EMACS is being set, and everything looks fine 
(although without any highlighting).

Is something wrong with my emacs that INSIDE_EMACS is not being set?

Is there some other way that guix can detect if it is running from eshell?

Best,
Jack

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-11 16:37                 ` Jack Hill
@ 2020-02-11 18:09                   ` zimoun
  2020-02-11 19:04                     ` Jack Hill
  2020-02-12 13:39                     ` Pierre Neidhardt
  2020-02-24 16:18                   ` Ludovic Courtès
  1 sibling, 2 replies; 46+ messages in thread
From: zimoun @ 2020-02-11 18:09 UTC (permalink / raw)
  To: Jack Hill; +Cc: Guix Devel

Hi Jack,

On Tue, 11 Feb 2020 at 17:37, Jack Hill <jackhill@jackhill.us> wrote:

> I've been trying to follow this discussion as I have observed problems
> with the linking characters in eshell. However, it seems I am having
> seeing different behavior than others. In both Emacs 26.3 and Emacs-next
> 27.0.50, running as `emacs -q`, INSIDE_EMACS is not being set in eshell
> so, guix describe looks like
>
> guix describe
> ]8;;file://lib-its13/var/guix/profiles/per-user/install/current-guix-66-link\Generation 66      Feb 07 2020 10:38:56]8;;\       (current)

We are discussing the character ]8;; which is the special character OSC.
The terminal emulator should either provide an hyperlink, either do
nothing and ignore what is inside the special character.
As you see, the terminal emulator does not render it correctly.
Setting INSIDE_EMACS turn off that. If it is by default is another story. :-)

However, I thought that it was fixed in Emacs 27. Ouch!


>      commit: ]8;;https://git.savannah.gnu.org/cgit/guix.git/commit/?id=232f344f9b9dc775fe8f9c7db2e45ba20431b071\232f344f9b9dc775fe8f9c7db2e45ba20431b071]8;;\

Note that the OSC also appears in some 'guix system' subcommand if I
remember correctly.


> In shell and term mode, INSIDE_EMACS is being set, and everything looks fine
> (although without any highlighting).

You mean set by default, right?

However, note that '*shell*' render correctly the highlighting
(Generation in bold face) so the OSC could be turned off and the
highlight on.



All the best,
simon

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-11 18:09                   ` zimoun
@ 2020-02-11 19:04                     ` Jack Hill
  2020-02-12 13:39                     ` Pierre Neidhardt
  1 sibling, 0 replies; 46+ messages in thread
From: Jack Hill @ 2020-02-11 19:04 UTC (permalink / raw)
  To: zimoun; +Cc: Guix Devel

On Tue, 11 Feb 2020, zimoun wrote:

>> In shell and term mode, INSIDE_EMACS is being set, and everything looks fine
>> (although without any highlighting).
>
> You mean set by default, right?

Yes, for me emacs is setting INSIDE_EMACS for shell and term, but not 
eshell with the default configuration.

> However, note that '*shell*' render correctly the highlighting
> (Generation in bold face) so the OSC could be turned off and the
> highlight on.

Yes, that sounds like desirable behavior to me.

Thanks,
Jack

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-11 18:09                   ` zimoun
  2020-02-11 19:04                     ` Jack Hill
@ 2020-02-12 13:39                     ` Pierre Neidhardt
  2020-02-12 16:30                       ` zimoun
  1 sibling, 1 reply; 46+ messages in thread
From: Pierre Neidhardt @ 2020-02-12 13:39 UTC (permalink / raw)
  To: zimoun, Jack Hill; +Cc: Guix Devel

[-- Attachment #1: Type: text/plain, Size: 381 bytes --]

zimoun <zimon.toutoune@gmail.com> writes:

> However, I thought that it was fixed in Emacs 27. Ouch!
>
>
>>      commit: ]8;;https://git.savannah.gnu.org/cgit/guix.git/commit/?id=232f344f9b9dc775fe8f9c7db2e45ba20431b071\232f344f9b9dc775fe8f9c7db2e45ba20431b071]8;;\

I tried with Guix' emacs-next and I get the same problem.

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-12 13:39                     ` Pierre Neidhardt
@ 2020-02-12 16:30                       ` zimoun
  2020-02-13  9:35                         ` zimoun
  0 siblings, 1 reply; 46+ messages in thread
From: zimoun @ 2020-02-12 16:30 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: Guix Devel

Hi,

On Wed, 12 Feb 2020 at 14:39, Pierre Neidhardt <mail@ambrevar.xyz> wrote:
> zimoun <zimon.toutoune@gmail.com> writes:

> > However, I thought that it was fixed in Emacs 27. Ouch!
> I tried with Guix' emacs-next and I get the same problem.

Ok, I should have misread some news. :-)


Well, I am not following what we are talking about. There is 2 issues:

1.
By default with Emacs, *shell* is doing right and EShell not. Is it
coming from Emacs or other? Could the Emacs from Guix do always the
right thing?

Other said, *shell* sets by default INSIDE_EMACS to "26.3,comint". And
EShell does nothing by default. Is it Guix specific or Emacs specific?


2.
In Guix, the environment variable INSIDE_EMACS escapes the special
character OSC (and turns off the colour face).
So, Guix commands can change their behaviour depending if INSIDE_EMACS
is set or not; independently of the terminal emulator.

The patches that I sent are about this point 2.

I am using the terminal emulator 'xterm' which does not support the
special character OSC but does the expected standard when it sees one
(i.e., does nothing). All descent terminal emulator does the correct
thing with the OSC character; which is: a) does nothing if not
supported or b) does fancy display if supported. The only terminal
emulator that I know* which is not doing the standard is terminal
emulator in Emacs. That's why the environment variable to turn on/off
the OSC is named INSIDE_EMACS.

*except when the terminal emulator is incorrectly built, as
terminal-mate in Trisquel shows.

So, I have no idea about the point 1. nor investigate.


All the best,
simon

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-06  9:51       ` Pierre Neidhardt
@ 2020-02-13  9:30         ` zimoun
  2020-02-13 13:41           ` Alex Griffin
  0 siblings, 1 reply; 46+ messages in thread
From: zimoun @ 2020-02-13  9:30 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: Guix Devel

Hi Pierre,

On Thu, 6 Feb 2020 at 10:51, Pierre Neidhardt <mail@ambrevar.xyz> wrote:
> Ricardo Wurmus <rekado@elephly.net> writes:

> > I suppose you are not using a comint-derived mode for your shell then.
>
> Precision: It works with M-x shell but not with Eshell.

Yes, it is expected.

1. INSIDE_EMACS is set by 'comint-mode'

http://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/comint.el#n830

2. 'shell-mode' derives from 'comint-mode' so INSIDE_EMACS is ok.

http://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/shell.el#n504

3. 'esh-mode' is derived from 'fundamental-mode' and I do not find
where INSIDE_EMACS is set by this mode.

http://git.savannah.gnu.org/cgit/emacs.git/tree/lisp/eshell/esh-mode.el#n319


Therefore, IMHO you need to set the environment variable by yourself
in your config file. Or send a patch upstream.
Because the reason is that EShell is not doing the right thing and it
is not compliant to the doc.

The issue is not related to Guix but to EShell. :-)


Cheers,
simon

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-12 16:30                       ` zimoun
@ 2020-02-13  9:35                         ` zimoun
  0 siblings, 0 replies; 46+ messages in thread
From: zimoun @ 2020-02-13  9:35 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: Guix Devel

On Wed, 12 Feb 2020 at 17:30, zimoun <zimon.toutoune@gmail.com> wrote:

> 1.
> By default with Emacs, *shell* is doing right and EShell not. Is it
> coming from Emacs or other? Could the Emacs from Guix do always the
> right thing?
>
> Other said, *shell* sets by default INSIDE_EMACS to "26.3,comint". And
> EShell does nothing by default. Is it Guix specific or Emacs specific?

It is expected because 'shell-mode' derives from 'comint-mode' and
'comint-mode' sets correctly INSIDE_EMACS; as the documentation
claims.

However, 'eshell' uses 'esh-mode' which derives from
'fundamental-mode' and INSIDE_EMACS is set nowhere (well, if it is, I
miss where).
Therefore, the culprit is the upstream 'eshell' and it is not Guix specific.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-13  9:30         ` zimoun
@ 2020-02-13 13:41           ` Alex Griffin
  2020-02-13 14:22             ` zimoun
  0 siblings, 1 reply; 46+ messages in thread
From: Alex Griffin @ 2020-02-13 13:41 UTC (permalink / raw)
  To: zimoun, Pierre Neidhardt; +Cc: Guix Devel

On Thu, Feb 13, 2020, at 9:30 AM, zimoun wrote:
> Therefore, IMHO you need to set the environment variable by yourself
> in your config file. Or send a patch upstream.
> Because the reason is that EShell is not doing the right thing and it
> is not compliant to the doc.

Compliant to which doc? The only place I can find documentation for INSIDE_EMACS is in the shell-mode docs. I can't find any doc that suggests it should be set by any other package.

-- 
Alex Griffin

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-13 13:41           ` Alex Griffin
@ 2020-02-13 14:22             ` zimoun
  2020-02-14  7:17               ` Pierre Neidhardt
  0 siblings, 1 reply; 46+ messages in thread
From: zimoun @ 2020-02-13 14:22 UTC (permalink / raw)
  To: Alex Griffin; +Cc: Guix Devel

Hi,

On Thu, 13 Feb 2020 at 14:42, Alex Griffin <a@ajgrf.com> wrote:
>
> On Thu, Feb 13, 2020, at 9:30 AM, zimoun wrote:
> > Therefore, IMHO you need to set the environment variable by yourself
> > in your config file. Or send a patch upstream.
> > Because the reason is that EShell is not doing the right thing and it
> > is not compliant to the doc.
>
> Compliant to which doc? The only place I can find documentation for INSIDE_EMACS is in the shell-mode docs. I can't find any doc that suggests it should be set by any other package.

I badly worded. Sorry.

As Ricardo pointed [1], the Emacs doc [2] says:

--8<---------------cut here---------------start------------->8---
 Emacs sets the environment variable INSIDE_EMACS in the subshell to
 ‘version,comint’, where version is the Emacs version (e.g.,
 ‘24.1’). Programs can check this variable to determine whether they are
 running inside an Emacs subshell.
--8<---------------cut here---------------end--------------->8---

So EShell should manage INSIDE_EMACS since it could be considered as
an Interactive Shell or subshell.
It is how I understand it. Maybe, I misread.


Well, concretely, if you use EShell and you want a readable "guix
describe", you have to put in your '.emacs' config file something like
'(setenv "INSIDE_EMACS" "1")'. Or you should patch EShell and report
it upstream.


[1] https://lists.gnu.org/archive/html/guix-devel/2020-02/msg00040.html
[2] https://www.gnu.org/software/emacs/manual/html_node/emacs/Interactive-Shell.html


Hope that helps,
simon

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-13 14:22             ` zimoun
@ 2020-02-14  7:17               ` Pierre Neidhardt
  2020-02-14  7:21                 ` Pierre Neidhardt
  0 siblings, 1 reply; 46+ messages in thread
From: Pierre Neidhardt @ 2020-02-14  7:17 UTC (permalink / raw)
  To: zimoun, Alex Griffin; +Cc: Guix Devel

[-- Attachment #1: Type: text/plain, Size: 351 bytes --]

zimoun <zimon.toutoune@gmail.com> writes:

> Well, concretely, if you use EShell and you want a readable "guix
> describe", you have to put in your '.emacs' config file something like
> '(setenv "INSIDE_EMACS" "1")'. Or you should patch EShell and report
> it upstream.

I've reported upstream.

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-14  7:17               ` Pierre Neidhardt
@ 2020-02-14  7:21                 ` Pierre Neidhardt
  2020-02-17  7:51                   ` Pierre Neidhardt
  0 siblings, 1 reply; 46+ messages in thread
From: Pierre Neidhardt @ 2020-02-14  7:21 UTC (permalink / raw)
  To: zimoun, Alex Griffin; +Cc: Guix Devel

[-- Attachment #1: Type: text/plain, Size: 60 bytes --]

Bug 39596.

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-14  7:21                 ` Pierre Neidhardt
@ 2020-02-17  7:51                   ` Pierre Neidhardt
  2020-02-17  7:54                     ` zimoun
  2020-02-24 16:22                     ` Ludovic Courtès
  0 siblings, 2 replies; 46+ messages in thread
From: Pierre Neidhardt @ 2020-02-17  7:51 UTC (permalink / raw)
  To: zimoun, Alex Griffin; +Cc: Guix Devel

[-- Attachment #1: Type: text/plain, Size: 208 bytes --]

Can we still do the following:

- Leave colors when INSIDE_EMACS is set.
- Disable pager hint and display all search results when INSIDE_EMACS is set.

?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-17  7:51                   ` Pierre Neidhardt
@ 2020-02-17  7:54                     ` zimoun
  2020-02-17 13:42                       ` Pierre Neidhardt
  2020-02-24 16:22                     ` Ludovic Courtès
  1 sibling, 1 reply; 46+ messages in thread
From: zimoun @ 2020-02-17  7:54 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: Guix Devel

Hi Pierre,

On Mon, 17 Feb 2020 at 08:51, Pierre Neidhardt <mail@ambrevar.xyz> wrote:
>
> Can we still do the following:
>
> - Leave colors when INSIDE_EMACS is set.

It is what I propose. But this a "bug" in the patches that I sent. The
'link' is turned off and the 'highlight' is still set on but the
display is without the bold face.

> - Disable pager hint and display all search results when INSIDE_EMACS is set.

I have never look at. But why not.


Cheers,
simon

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-17  7:54                     ` zimoun
@ 2020-02-17 13:42                       ` Pierre Neidhardt
  2020-02-17 18:33                         ` zimoun
  0 siblings, 1 reply; 46+ messages in thread
From: Pierre Neidhardt @ 2020-02-17 13:42 UTC (permalink / raw)
  To: zimoun; +Cc: Guix Devel

[-- Attachment #1: Type: text/plain, Size: 69 bytes --]

Patch sent: #39642.

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-17 13:42                       ` Pierre Neidhardt
@ 2020-02-17 18:33                         ` zimoun
  2020-02-24 10:19                           ` Pierre Neidhardt
  0 siblings, 1 reply; 46+ messages in thread
From: zimoun @ 2020-02-17 18:33 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: Guix Devel

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

> Patch sent: #39642.

Nice! :-)

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-17 18:33                         ` zimoun
@ 2020-02-24 10:19                           ` Pierre Neidhardt
  0 siblings, 0 replies; 46+ messages in thread
From: Pierre Neidhardt @ 2020-02-24 10:19 UTC (permalink / raw)
  To: zimoun; +Cc: Guix Devel

[-- Attachment #1: Type: text/plain, Size: 63 bytes --]

Patch merged!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-11 16:37                 ` Jack Hill
  2020-02-11 18:09                   ` zimoun
@ 2020-02-24 16:18                   ` Ludovic Courtès
  2020-02-24 16:45                     ` Pierre Neidhardt
  2020-02-24 16:50                     ` zimoun
  1 sibling, 2 replies; 46+ messages in thread
From: Ludovic Courtès @ 2020-02-24 16:18 UTC (permalink / raw)
  To: Jack Hill; +Cc: Guix Devel

Hi Jack,

Jack Hill <jackhill@jackhill.us> skribis:

> I've been trying to follow this discussion as I have observed problems
> with the linking characters in eshell. However, it seems I am having
> seeing different behavior than others. In both Emacs 26.3 and
> Emacs-next 27.0.50, running as `emacs -q`, INSIDE_EMACS is not being
> set in eshell so, guix describe looks like
>
> guix describe
> ]8;;file://lib-its13/var/guix/profiles/per-user/install/current-guix-66-link\Generation 66	Feb 07 2020 10:38:56]8;;\	(current)

That looks like a bug in eshell.

In general, when facing such a situation, I think we should check if
there’s an easy workaround to avoid gratuitously annoying users (like
the ‘INSIDE_EMACS’ hack for shell-mode), and if not, we should bug
upstream to fix their software.  :-)

Ludo’.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-17  7:51                   ` Pierre Neidhardt
  2020-02-17  7:54                     ` zimoun
@ 2020-02-24 16:22                     ` Ludovic Courtès
  2020-02-24 16:44                       ` Pierre Neidhardt
  2020-02-24 16:53                       ` zimoun
  1 sibling, 2 replies; 46+ messages in thread
From: Ludovic Courtès @ 2020-02-24 16:22 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: Guix Devel

Hi!

I’m sorry that I’m so late to the discussion…

Pierre Neidhardt <mail@ambrevar.xyz> skribis:

> Can we still do the following:
>
> - Leave colors when INSIDE_EMACS is set.

Like Ricardo wrote before, this is not desirable for shell-mode.  Also,
all or most GNU command-line tools behave that way.

> - Disable pager hint and display all search results when INSIDE_EMACS is set.

I have a preference for something that doesn’t fill the screen,
especially since the last answers (those that remain visible without
scrolling) are the least relevant.  Emacs makes it easier to scroll up
and search, but still.

Thoughts?

Ludo’.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-24 16:22                     ` Ludovic Courtès
@ 2020-02-24 16:44                       ` Pierre Neidhardt
  2020-02-24 17:11                         ` zimoun
  2020-02-24 20:54                         ` Ludovic Courtès
  2020-02-24 16:53                       ` zimoun
  1 sibling, 2 replies; 46+ messages in thread
From: Pierre Neidhardt @ 2020-02-24 16:44 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix Devel

[-- Attachment #1: Type: text/plain, Size: 1817 bytes --]

Ludovic Courtès <ludo@gnu.org> writes:

>> - Leave colors when INSIDE_EMACS is set.
>
> Like Ricardo wrote before, this is not desirable for shell-mode.  Also,
> all or most GNU command-line tools behave that way.

There might be a misunderstanding because M-x shell supports ANSI
terminal colors explicitly.  Why disable them then?

Many command line tools print colors properly in M-x shell.  I think
it's a misfeature to disable them in Emacs; I don't see any benefits.

>> - Disable pager hint and display all search results when INSIDE_EMACS is set.
>
> I have a preference for something that doesn’t fill the screen,
> especially since the last answers (those that remain visible without
> scrolling) are the least relevant.  Emacs makes it easier to scroll up
> and search, but still.
>
> Thoughts?

I find that printing just 1 result to be of little use in general.
So between printing all results and just 1, I have a preference for
printing all results.  But there are other solutions, see below.

Note that `less` does not work well neither in Eshell nor in M-x shell.
Which is what started this discussion ;)

Another option for M-x shell is to do

--8<---------------cut here---------------start------------->8---
guix search foo | cat
--8<---------------cut here---------------end--------------->8---

which gives us the same result as the patch I've sent, with more typing :(

Eshell has a "smart-scrolling" mode (the point stays at the first prompt
until validated).

For M-x shell, going to the first result is just one keypress away.

Another option would be to reverse the order of the result: print the
most relevant result last, so that neither Eshell nor M-x shell have to
scroll back.

Thoughts?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-24 16:18                   ` Ludovic Courtès
@ 2020-02-24 16:45                     ` Pierre Neidhardt
  2020-02-24 16:59                       ` zimoun
  2020-02-24 16:50                     ` zimoun
  1 sibling, 1 reply; 46+ messages in thread
From: Pierre Neidhardt @ 2020-02-24 16:45 UTC (permalink / raw)
  To: Ludovic Courtès, Jack Hill; +Cc: Guix Devel

[-- Attachment #1: Type: text/plain, Size: 118 bytes --]

Done, and it's fixed upstream!

Question: Which INSIDE_EMACS hack?

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-24 16:18                   ` Ludovic Courtès
  2020-02-24 16:45                     ` Pierre Neidhardt
@ 2020-02-24 16:50                     ` zimoun
  1 sibling, 0 replies; 46+ messages in thread
From: zimoun @ 2020-02-24 16:50 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix Devel

Hi,

On Mon, 24 Feb 2020 at 17:19, Ludovic Courtès <ludo@gnu.org> wrote:
> Jack Hill <jackhill@jackhill.us> skribis:

> > I've been trying to follow this discussion as I have observed problems
> > with the linking characters in eshell. However, it seems I am having
> > seeing different behavior than others. In both Emacs 26.3 and
> > Emacs-next 27.0.50, running as `emacs -q`, INSIDE_EMACS is not being
> > set in eshell so, guix describe looks like
> >
> > guix describe
> > ]8;;file://lib-its13/var/guix/profiles/per-user/install/current-guix-66-link\Generation 66    Feb 07 2020 10:38:56]8;;\       (current)
>
> That looks like a bug in eshell.

See:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=39596


> In general, when facing such a situation, I think we should check if
> there’s an easy workaround to avoid gratuitously annoying users (like
> the ‘INSIDE_EMACS’ hack for shell-mode), and if not, we should bug
> upstream to fix their software.  :-)

But some terminal emulator are not doing the correct thing [1].
And an option to turn off/on the hyperlink seems useful.
I mean even for terminal emulators correctly supporting the OSC, I
would find useful to display the hyperlink; it eases the copy/paste.
For example, I am using xterm, and I would like to turn on/off the
Generation file hyperlink and commit url. (well, so my tiny patch in
sent to this thread ;-).


[1] https://debbugs.gnu.org/cgi/bugreport.cgi?bug=38940#23

All the best,
simon

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-24 16:22                     ` Ludovic Courtès
  2020-02-24 16:44                       ` Pierre Neidhardt
@ 2020-02-24 16:53                       ` zimoun
  1 sibling, 0 replies; 46+ messages in thread
From: zimoun @ 2020-02-24 16:53 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix Devel

On Mon, 24 Feb 2020 at 17:22, Ludovic Courtès <ludo@gnu.org> wrote:

> I have a preference for something that doesn’t fill the screen,
> especially since the last answers (those that remain visible without
> scrolling) are the least relevant.  Emacs makes it easier to scroll up
> and search, but still.

Why just not reverse the outputed list?

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-24 16:45                     ` Pierre Neidhardt
@ 2020-02-24 16:59                       ` zimoun
  0 siblings, 0 replies; 46+ messages in thread
From: zimoun @ 2020-02-24 16:59 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: Guix Devel

Hi Pierre,

On Mon, 24 Feb 2020 at 17:45, Pierre Neidhardt <mail@ambrevar.xyz> wrote:

> Done, and it's fixed upstream!

You mean that INSIDE_EMACS is now correctly set with EShell, right?

Then, the Emacs manual is correct too in *eshell*:

--8<---------------cut here---------------start------------->8---
   Emacs sets the environment variable ‘INSIDE_EMACS’ in the subshell to
‘VERSION,comint’, where VERSION is the Emacs version (e.g., ‘24.1’).
Programs can check this variable to determine whether they are running
inside an Emacs subshell.
--8<---------------cut here---------------end--------------->8---


> Question: Which INSIDE_EMACS hack?

INSIDE_EMACS has been introduced as a hack because then:

--8<---------------cut here---------------start------------->8---
Programs can check this variable to determine whether they are running
inside an Emacs subshell.
--8<---------------cut here---------------end--------------->8---

and the GNU tools can be better integrated with Emacs, IMHO.


All the best,
simon

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-24 16:44                       ` Pierre Neidhardt
@ 2020-02-24 17:11                         ` zimoun
  2020-02-24 20:54                         ` Ludovic Courtès
  1 sibling, 0 replies; 46+ messages in thread
From: zimoun @ 2020-02-24 17:11 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: Guix Devel

Hi,

On Mon, 24 Feb 2020 at 17:44, Pierre Neidhardt <mail@ambrevar.xyz> wrote:

> >> - Leave colors when INSIDE_EMACS is set.
> >
> > Like Ricardo wrote before, this is not desirable for shell-mode.  Also,
> > all or most GNU command-line tools behave that way.
>
> There might be a misunderstanding because M-x shell supports ANSI
> terminal colors explicitly.  Why disable them then?
>
> Many command line tools print colors properly in M-x shell.  I think
> it's a misfeature to disable them in Emacs; I don't see any benefits.

I think there is a misunderstanding because we are not talking about
Emacs but about "terminal emulator" (and Emacs happens to be one).
And we are talking how to enable OSC and colouring in the terminal emulator.

It has been done using INSIDE_EMACS because most of us use Emacs as
terminal emulator (eshell or shell-mode).
But IMHO, it is not the issue. The issue is:
 - how to turn on/off the OSC in *any* terminal emulator (supporting
or not OSC).
 - how to enable/disable colouring in any terminal emulator.


> >> - Disable pager hint and display all search results when INSIDE_EMACS is set.
> >
> > I have a preference for something that doesn’t fill the screen,
> > especially since the last answers (those that remain visible without
> > scrolling) are the least relevant.  Emacs makes it easier to scroll up
> > and search, but still.

Here, it is the same. The question is how to disable the behaviour
using whatever terminal emulator.


And instead of multiplying* the environment variables, we should add a
file in ~/.config/guix/config.scm to set the user preference. WDYT?

*I have in mind the
GUIX_DISK_SPACE_WARNING_ABSOLUTE_MY_SCREEN_IS_NOT_ENOUGH_LARGE_TO_READ_IT
;-)


All the best,
simon

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-24 16:44                       ` Pierre Neidhardt
  2020-02-24 17:11                         ` zimoun
@ 2020-02-24 20:54                         ` Ludovic Courtès
  2020-02-24 21:32                           ` Pierre Neidhardt
  1 sibling, 1 reply; 46+ messages in thread
From: Ludovic Courtès @ 2020-02-24 20:54 UTC (permalink / raw)
  To: Pierre Neidhardt; +Cc: Guix Devel

Hi Pierre,

I’m happy to discuss it further (to some extent at least, because there
are other patches waiting for us to be reviewed :-)), but first, as I
wrote in another message, I think the topic was not consensual and thus
the series wasn’t ready to be pushed.

Pierre Neidhardt <mail@ambrevar.xyz> skribis:

> Ludovic Courtès <ludo@gnu.org> writes:
>
>>> - Leave colors when INSIDE_EMACS is set.
>>
>> Like Ricardo wrote before, this is not desirable for shell-mode.  Also,
>> all or most GNU command-line tools behave that way.
>
> There might be a misunderstanding because M-x shell supports ANSI
> terminal colors explicitly.  Why disable them then?
>
> Many command line tools print colors properly in M-x shell.  I think
> it's a misfeature to disable them in Emacs; I don't see any benefits.

I understand the Eshell use case.  The shell-mode use case is one I’m
interested in keeping as-is, that is: disable colors when INSIDE_EMACS,
just like Coreutils, GNU grep, etc. do.

>>> - Disable pager hint and display all search results when INSIDE_EMACS is set.
>>
>> I have a preference for something that doesn’t fill the screen,
>> especially since the last answers (those that remain visible without
>> scrolling) are the least relevant.  Emacs makes it easier to scroll up
>> and search, but still.
>>
>> Thoughts?
>
> I find that printing just 1 result to be of little use in general.
> So between printing all results and just 1, I have a preference for
> printing all results.  But there are other solutions, see below.

It’s not printing one result; it’s printing as many results as can fit
on the screen.

> Note that `less` does not work well neither in Eshell nor in M-x shell.
> Which is what started this discussion ;)
>
> Another option for M-x shell is to do
>
> guix search foo | cat
>
> which gives us the same result as the patch I've sent, with more typing :(
>
> Eshell has a "smart-scrolling" mode (the point stays at the first prompt
> until validated).
>
> For M-x shell, going to the first result is just one keypress away.

I understand all this.  However, we’re not optimizing just for Eshell
and shell-mode; in fact, I’d argue that Emacs users should just use
Emacs-Guix (we need to add M-x guix-search, actually!).

For regular terminals, I think the two options that work well are:

  1. Print (by default) as much as fits on the screen.

  2. Automatically start a pager.

I went with option #1, which was submitted at
<https://issues.guix.gnu.org/issue/36390>.  The suggestion actually came
from Bruno Haible: <https://issues.guix.gnu.org/issue/35551>.

Just to say that there’s already been some thought put into it, and we
have to carry the baggage of these past discussions now!

> Another option would be to reverse the order of the result: print the
> most relevant result last, so that neither Eshell nor M-x shell have to
> scroll back.

I think UIs generally print the most relevant result first.  It wouldn’t
feel right to me to reverse it.

Thanks!

Ludo’.

^ permalink raw reply	[flat|nested] 46+ messages in thread

* Re: Guix search, colors and INSIDE_EMACS
  2020-02-24 20:54                         ` Ludovic Courtès
@ 2020-02-24 21:32                           ` Pierre Neidhardt
  0 siblings, 0 replies; 46+ messages in thread
From: Pierre Neidhardt @ 2020-02-24 21:32 UTC (permalink / raw)
  To: Ludovic Courtès; +Cc: Guix Devel

[-- Attachment #1: Type: text/plain, Size: 2584 bytes --]

Ludovic Courtès <ludo@gnu.org> writes:

> Hi Pierre,
>
> I’m happy to discuss it further (to some extent at least, because there
> are other patches waiting for us to be reviewed :-)), but first, as I
> wrote in another message, I think the topic was not consensual and thus
> the series wasn’t ready to be pushed.

All the points have been addressed and I waited a period of 7 days.

Beyond this consideration, it's such a small patch, it does not break
anything for anyone, and we can always revert.

>> Many command line tools print colors properly in M-x shell.  I think
>> it's a misfeature to disable them in Emacs; I don't see any benefits.
>
> I understand the Eshell use case.  The shell-mode use case is one I’m
> interested in keeping as-is, that is: disable colors when INSIDE_EMACS,
> just like Coreutils, GNU grep, etc. do.

But why?

Colors used to work in Guix.  Now they are gone in Eshell / M-x shell.
It seems like a regression to me.

>> I find that printing just 1 result to be of little use in general.
>> So between printing all results and just 1, I have a preference for
>> printing all results.  But there are other solutions, see below.
>
> It’s not printing one result; it’s printing as many results as can fit
> on the screen.

It's usually just 1 or 2 results then :p

> I understand all this.  However, we’re not optimizing just for Eshell
> and shell-mode;

I was just fixing a bug that occured in Eshell / M-x shell, without
impacting other users.

> in fact, I’d argue that Emacs users should just use
> Emacs-Guix (we need to add M-x guix-search, actually!).

Emacs-Guix is not a drop-in replace for shell commands.  For instance,
guix search lets the user edit the results in an Eshell buffer.

Besides, Emacs-Guix is not really in sync with Guix, e.g. the lack of
channel support.

> For regular terminals, I think the two options that work well are:
>
>   1. Print (by default) as much as fits on the screen.
>
>   2. Automatically start a pager.
>
> I went with option #1, which was submitted at
> <https://issues.guix.gnu.org/issue/36390>.  The suggestion actually came
> from Bruno Haible: <https://issues.guix.gnu.org/issue/35551>.

This is not changed by my patch.

> Just to say that there’s already been some thought put into it, and we
> have to carry the baggage of these past discussions now!

We are, I'm just including further thinking into the process, that is,
Emacs Eshell and M-x shell.

Cheers!

-- 
Pierre Neidhardt
https://ambrevar.xyz/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 46+ messages in thread

end of thread, other threads:[~2020-02-24 21:32 UTC | newest]

Thread overview: 46+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-02-04 15:23 Guix search, colors and INSIDE_EMACS Pierre Neidhardt
2020-02-04 16:12 ` Ricardo Wurmus
2020-02-04 16:37   ` Pierre Neidhardt
2020-02-04 16:51     ` zimoun
2020-02-04 19:16     ` Ricardo Wurmus
2020-02-04 19:18     ` Ricardo Wurmus
2020-02-06  9:51       ` Pierre Neidhardt
2020-02-13  9:30         ` zimoun
2020-02-13 13:41           ` Alex Griffin
2020-02-13 14:22             ` zimoun
2020-02-14  7:17               ` Pierre Neidhardt
2020-02-14  7:21                 ` Pierre Neidhardt
2020-02-17  7:51                   ` Pierre Neidhardt
2020-02-17  7:54                     ` zimoun
2020-02-17 13:42                       ` Pierre Neidhardt
2020-02-17 18:33                         ` zimoun
2020-02-24 10:19                           ` Pierre Neidhardt
2020-02-24 16:22                     ` Ludovic Courtès
2020-02-24 16:44                       ` Pierre Neidhardt
2020-02-24 17:11                         ` zimoun
2020-02-24 20:54                         ` Ludovic Courtès
2020-02-24 21:32                           ` Pierre Neidhardt
2020-02-24 16:53                       ` zimoun
2020-02-05 15:13     ` Ludovic Courtès
2020-02-06  9:56       ` Pierre Neidhardt
2020-02-07 21:33         ` Ludovic Courtès
2020-02-08 16:34           ` Pierre Neidhardt
2020-02-04 16:40   ` zimoun
2020-02-10 19:36     ` Pierre Neidhardt
2020-02-10 23:24       ` zimoun
2020-02-11  6:22         ` Pierre Neidhardt
2020-02-11 14:11           ` Ludovic Courtès
2020-02-11 14:19             ` Pierre Neidhardt
2020-02-11 15:14               ` zimoun
2020-02-11 16:37                 ` Jack Hill
2020-02-11 18:09                   ` zimoun
2020-02-11 19:04                     ` Jack Hill
2020-02-12 13:39                     ` Pierre Neidhardt
2020-02-12 16:30                       ` zimoun
2020-02-13  9:35                         ` zimoun
2020-02-24 16:18                   ` Ludovic Courtès
2020-02-24 16:45                     ` Pierre Neidhardt
2020-02-24 16:59                       ` zimoun
2020-02-24 16:50                     ` zimoun
2020-02-11 15:11             ` zimoun
2020-02-11 15:06           ` zimoun

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/guix.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.