Better mechanism to choose the default editor (and avoid vi if possible)?

Steve - Gadget Barnes GadgetSteve at hotmail.com
Sat May 30 06:42:41 UTC 2020


Several other version control systems, (and other systems as well), honour  the environmental variable EDITOR - this is an easy way to specify the editor to use for things like hg config --edit without having to use an editor that you are less than happy with. Maybe honouring this and possibly adding mention of it to the helps would be the optimal way to go!

Steve Barnes

-----Original Message-----
From: Mercurial <mercurial-bounces at mercurial-scm.org> On Behalf Of Augie Fackler
Sent: 30 May 2020 02:36
To: PIERRE AUGIER <pierre.augier at univ-grenoble-alpes.fr>
Cc: mercurial <mercurial at mercurial-scm.org>
Subject: Re: Better mechanism to choose the default editor (and avoid vi if possible)?



> On May 29, 2020, at 3:08 PM, PIERRE AUGIER <pierre.augier at univ-grenoble-alpes.fr> wrote:
> 
> 
> ----- Mail original -----
>> De: "Marcus Harnisch" <mh-mercurial at online.de>
>> À: "mercurial" <mercurial at mercurial-scm.org>
>> Envoyé: Vendredi 29 Mai 2020 17:38:59
>> Objet: Re: Better mechanism to choose the default editor (and avoid vi if possible)?
> 
>> Is it safe to assume that users who are disturbed by this default 
>> behaviour are likely to work in a desktop session? In that case we 
>> could make use of XDG, no? I just tried ‘xdg-open ~/.config/hg/hgrc’ 
>> and it popped up the configured plain text editor.
>> 
> 
> Yes, I agree that we can assume that users who are disturbed by this default behavior are likely to work in a desktop session, so `xdg-open` seems to be the right command.
> 
> Maybe `open` can be used on OSX and `start` on Windows?

`open` does not block on the file closing, so it’s not viable for the use case. I can’t speak to Windows stuff, or xdg-open (but I suspect they have similar shortcomings). There are flags to let open behave the way you’d want, but I’ve never seen them used in the wild and it’d be confusing to the median Mac user to have two copies of an application open at the same time.

That said, if someone wants to send a patch to change the default editor on Windows to be notepad, I’ll take it (barring objections.) That seems like a trivial improvement. 

I’m -0 on a patch to change the non-Windows default to nano, but I won’t veto it if someone else reviews it and lands it, I guess.

> 
>> Hg is already inspecting XDG_CONFIG_HOME (another XDG facility) for 
>> locating the configuration file.
>> 
>> Cheers,
>> Marcus
>> 
>> 
>> _______________________________________________
>> Mercurial mailing list
>> Mercurial at mercurial-scm.org
>> https://www.mercurial-scm.org/mailman/listinfo/mercurial
> _______________________________________________
> Mercurial mailing list
> Mercurial at mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial

_______________________________________________
Mercurial mailing list
Mercurial at mercurial-scm.org
https://www.mercurial-scm.org/mailman/listinfo/mercurial


More information about the Mercurial mailing list