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

Tony Mechelynck antoine.mechelynck at gmail.com
Tue Jun 2 11:29:33 UTC 2020


On Mon, Jun 1, 2020 at 11:28 PM ArneBab <arne_bab at web.de> wrote:
>
>
> Marcin Kasperski <Marcin.Kasperski at mekk.waw.pl> writes:
>
> > Why not ask?
> >
> > Attempt to commit without ui.username results in info that it must be configured.
> >
> > The same could make sense in case editor is needed but isn't configured
> > in any reasonable way (ui.editor, $EDITOR, whatever-is-windows-convention).
>
> You need an editor to set the editor, so a default is required.
>
> Best wishes,
> Arne

OK, so the Mercurial way is to set ui.editor, and the Unix way (usable
on Windows too) is to set EDITOR in the environment. If neither are
set, we're already at a rare but possible level. We could try to have
a number of fallback possibilities to be tried in order (let's say
vim, Notepadxx, emacs, kedit, Notepad, pico, nano, vi, …) but no
matter how many we list, there is always the possibility that none of
them will be installed and that _this_ user's editor-of-choice may be
something we didn't think of. In _that_ case, if there's some missing
input that we can't do without (for instance "hg commit" has been
invoked without the -m argument and we don't know how to set the
commit message) well, the only remaining possibility AFAICT is to
abort with as clear as possible an error message.

Best regards,
Tony.



More information about the Mercurial mailing list