Subject: Re: bug#44272: guix edit doesn't work when $EDITOR is set to "kate"

From: Nathan Dehnel <[email-masked]>
Date: Wed, 28 Oct 2020 17:28:38 -0500

>As Leo said, it does not seem a bug on the Guix side.  Well, what could
be done on the Guix side?  What do you suggest?

Well, guix could pass different flags if EDITOR is set to "kate". Somehow I
doubt kate would change their command line flags just because an extremely
obscure distro-specific tool treats it the same as other text editors.

But, whatever. The wrapper works well enough. Thanks.

On Wed, Oct 28, 2020 at 9:52 AM zimoun <[email-masked]> wrote:

> Dear Nathan,
>
> > Easy solution, set $EDITOR to "gedit" ;)
>
> Or Emacs. ;-)
>
>
> > The reason why kate "doesn't work" when opening files as specified by
> > `guix edit`, is that kate apparently can't handle the "$EDITOR +$N
> > $FILE" syntax, where $N is the number of lines to skip.  It instead
> > opens two files, one of which will likely always be empty.  This should
> > probably be reported as bug to kate unless that works upstream and
> > somehow guix messes up this feature.
>
> Instead ’kate’ use ’--line/-l’ and not ’+N’.  You could wrap, something
> along these lines:
>
> --8<---------------cut here---------------start------------->8---
> #!/bin/sh
>
> kate -l $(echo "$*" | tr "+" " ")
> --8<---------------cut here---------------end--------------->8---
>
> then:
>
>   export EDITOR=/path/to/kate-wrapper.sh
>   guix edit emacs
>
> works (with ’/path/to/kate-wrapper.sh’ executable).  Well, the wrapper
> could be better, obviously. :-)
>
> As Leo said, it does not seem a bug on the Guix side.  Well, what could
> be done on the Guix side?  What do you suggest?
>
>
> All the best,
> simon
>