Better mechanism to choose the default editor (and avoid vi if possible)?
Augie Fackler
raf at durin42.com
Wed Jun 10 16:12:25 UTC 2020
> On Jun 10, 2020, at 06:22, Pierre-Yves David <pierre-yves.david at ens-lyon.org> wrote:
>
>
>
> On 5/30/20 3:35 AM, Augie Fackler wrote:
>>> 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.
>
> open have a --wait-apps and --new option that can be used to spawn a full new app and wait for it to quite before returning. That could work. It also has a "-e Opens with TextEdit." option that could make a lot of sense as a default if visual interface is available.
Definitely _DO NOT_ use --wait-apps --new: it is an _extremely_ un-Mac-like experience and will confuse people.
Heck, it confuses me when something uses it.
> Detecting if a visual UI is available or not is probably the trickest part.
This is already done in hg, including for macOS.
>
> --
> Pierre-Yves David
More information about the Mercurial
mailing list