how to configure the global .hgrc file from the commandline

classic Classic list List threaded Threaded
50 messages Options
123
Reply | Threaded
Open this post in threaded view
|

how to configure the global .hgrc file from the commandline

Uwe Brauer


Hi

That may sound bizarre. But lately I collaborate with colleagues, who
don't have much interest in OS details, and use different OS. So it is
sometimes not clear to me, especially for Windows users, where the
corresponding global .hgrc is located.

That's why I would like to know how one could configure the global .hgrc
file from the command-line, especially adding extensions.

I googled but could not find anything
Thanks

Uwe Brauer

_______________________________________________
Mercurial mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial
Reply | Threaded
Open this post in threaded view
|

[SOLVED] (was: how to configure the global .hgrc file from the commandline)

Uwe Brauer
>>> "UB" == Uwe Brauer <[hidden email]> writes:

   > Hi
   > That's why I would like to know how one could configure the global .hgrc
   > file from the command-line, especially adding extensions.

   > I googled but could not find anything


I should have googled more

  hg config --edit

Does what I want. Sorry for the noise

Regards

Uwe Brauer

_______________________________________________
Mercurial mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial

smime.p7s (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: how to configure the global .hgrc file from the commandline

Tony Mechelynck
In reply to this post by Uwe Brauer
On Sun, May 24, 2020 at 2:35 PM Uwe Brauer <[hidden email]> wrote:

>
>
>
> Hi
>
> That may sound bizarre. But lately I collaborate with colleagues, who
> don't have much interest in OS details, and use different OS. So it is
> sometimes not clear to me, especially for Windows users, where the
> corresponding global .hgrc is located.
>
> That's why I would like to know how one could configure the global .hgrc
> file from the command-line, especially adding extensions.
>
> I googled but could not find anything
> Thanks
>
> Uwe Brauer

To enable, let's say, the mq extension "as if" there was a line "mq="
in section "[extensions]":

hg --config extensions.mq= (other global options) (hg command)
(specific options)

This --config global option may be repeated any number of times, with
section.name=value as its argument. It is mentioned on the "hg help"
page but you may need to scroll down to see it.

Best regards,
Tony.
_______________________________________________
Mercurial mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial
Reply | Threaded
Open this post in threaded view
|

Re: how to configure the global .hgrc file from the commandline

Tony Mechelynck
On Sun, May 24, 2020 at 4:37 PM Tony Mechelynck
<[hidden email]> wrote:

>
> On Sun, May 24, 2020 at 2:35 PM Uwe Brauer <[hidden email]> wrote:
> >
> >
> >
> > Hi
> >
> > That may sound bizarre. But lately I collaborate with colleagues, who
> > don't have much interest in OS details, and use different OS. So it is
> > sometimes not clear to me, especially for Windows users, where the
> > corresponding global .hgrc is located.

See "hg help hgrc", paragraph "On Windows"

> >
> > That's why I would like to know how one could configure the global .hgrc
> > file from the command-line, especially adding extensions.
> >
> > I googled but could not find anything
> > Thanks
> >
> > Uwe Brauer
>
> To enable, let's say, the mq extension "as if" there was a line "mq="
> in section "[extensions]":
>
> hg --config extensions.mq= (other global options) (hg command)
> (specific options)
>
> This --config global option may be repeated any number of times, with
> section.name=value as its argument. It is mentioned on the "hg help"
> page but you may need to scroll down to see it.

P.S. It applies only to _this particular run_ of Mercurial; it changes
nothing to the permanent config files but overrides anything in them
that it contradicts.
>
> Best regards,
> Tony.
_______________________________________________
Mercurial mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial
Reply | Threaded
Open this post in threaded view
|

Re: how to configure the global .hgrc file from the commandline

Uwe Brauer
In reply to this post by Tony Mechelynck
>>> "TM" == Tony Mechelynck <[hidden email]> writes:

   > On Sun, May 24, 2020 at 2:35 PM Uwe Brauer <[hidden email]> wrote:
   >>
   >>
   >>
   >> Hi
   >>
   >> That may sound bizarre. But lately I collaborate with colleagues, who
   >> don't have much interest in OS details, and use different OS. So it is
   >> sometimes not clear to me, especially for Windows users, where the
   >> corresponding global .hgrc is located.
   >>
   >> That's why I would like to know how one could configure the global .hgrc
   >> file from the command-line, especially adding extensions.
   >>
   >> I googled but could not find anything
   >> Thanks
   >>
   >> Uwe Brauer

   > To enable, let's say, the mq extension "as if" there was a line "mq="
   > in section "[extensions]":

   > hg --config extensions.mq= (other global options) (hg command)
   > (specific options)

Now I am confused

I want

[extensions]
mq =

So I should just fire up

hg --config extensions.mq=  global

?

Thanks

Uwe Brauer

_______________________________________________
Mercurial mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial

smime.p7s (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: how to configure the global .hgrc file from the commandline

Tony Mechelynck
On Sun, May 24, 2020 at 5:04 PM Uwe Brauer <[hidden email]> wrote:

>
> >>> "TM" == Tony Mechelynck <[hidden email]> writes:
>
>    > On Sun, May 24, 2020 at 2:35 PM Uwe Brauer <[hidden email]> wrote:
>    >>
>    >>
>    >>
>    >> Hi
>    >>
>    >> That may sound bizarre. But lately I collaborate with colleagues, who
>    >> don't have much interest in OS details, and use different OS. So it is
>    >> sometimes not clear to me, especially for Windows users, where the
>    >> corresponding global .hgrc is located.
>    >>
>    >> That's why I would like to know how one could configure the global .hgrc
>    >> file from the command-line, especially adding extensions.
>    >>
>    >> I googled but could not find anything
>    >> Thanks
>    >>
>    >> Uwe Brauer
>
>    > To enable, let's say, the mq extension "as if" there was a line "mq="
>    > in section "[extensions]":
>
>    > hg --config extensions.mq= (other global options) (hg command)
>    > (specific options)
>
> Now I am confused
>
> I want
>
> [extensions]
> mq =
>
> So I should just fire up
>
> hg --config extensions.mq=  global
>
> ?
>
> Thanks
>
> Uwe Brauer

No, "hg global" doesn't mean anything AFAIK. "Global options" are
those that come between "hg" and the command (which is incoming, pull,
commit, etc.). "Specific options are specific to one command and apply
only to it.

You found something I didn't know, which is how to edit the config
file. Let's push the mq  example a little further:

hg --config extensions.mq=   qqueue -c newqueue
(edit some file in the tree)
hg --config extensions.mq=   qnew -U -m 'fix build eror in somefile.c'
hg --config extensions.mq=   qpop

In this case the --config is not permanent. Your method is more
elegant. This way might be more suitable to enable or disable paging
for the duration of one command. Also, let's say, to know if you want
to enable some specific extension, because its help is only accessible
if theextensio is enabled. To know what mq does, then if it is
disabled you would need

hg --config extensions.mq=   help mq


Best regards,
Tony.
_______________________________________________
Mercurial mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial
Reply | Threaded
Open this post in threaded view
|

Re: how to configure the global .hgrc file from the commandline

Augie Fackler-2
In reply to this post by Uwe Brauer


> On May 24, 2020, at 08:30, Uwe Brauer <[hidden email]> wrote:
>
>
>
> Hi
>
> That may sound bizarre. But lately I collaborate with colleagues, who
> don't have much interest in OS details, and use different OS. So it is
> sometimes not clear to me, especially for Windows users, where the
> corresponding global .hgrc is located.
>
> That's why I would like to know how one could configure the global .hgrc
> file from the command-line, especially adding extensions.

hg config --edit # edits the user-specific hgrc, which is probably what you want
hg config --global # edits the machine-global hgrc, almost never what you want
hg config --local # edits the .hg/hgrc file

It strikes me that we might want to rename these to be --edit-user, --edit-machine-wide, and --edit-repo respectively, but these flags will always work.

When I say "edits" above, I mean "opens the specified file in your configured text editor."

>
> I googled but could not find anything
> Thanks
>
> Uwe Brauer
>
> _______________________________________________
> Mercurial mailing list
> [hidden email]
> https://www.mercurial-scm.org/mailman/listinfo/mercurial

_______________________________________________
Mercurial mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial
Reply | Threaded
Open this post in threaded view
|

Re: how to configure the global .hgrc file from the commandline

Uwe Brauer


> hg config --edit # edits the user-specific hgrc, which is probably what you want
> hg config --global # edits the machine-global hgrc, almost never what you want
> hg config --local # edits the .hg/hgrc file

> It strikes me that we might want to rename these to be --edit-user,
> --edit-machine-wide, and --edit-repo respectively, but these flags
> will always work.

I think the renaming  would be a good idea

_______________________________________________
Mercurial mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial

smime.p7s (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: how to configure the global .hgrc file from the commandline

Pierre-Yves David-2
In reply to this post by Augie Fackler-2


On 5/25/20 7:02 PM, Augie Fackler wrote:

>
>
>> On May 24, 2020, at 08:30, Uwe Brauer <[hidden email]> wrote:
>>
>>
>>
>> Hi
>>
>> That may sound bizarre. But lately I collaborate with colleagues, who
>> don't have much interest in OS details, and use different OS. So it is
>> sometimes not clear to me, especially for Windows users, where the
>> corresponding global .hgrc is located.
>>
>> That's why I would like to know how one could configure the global .hgrc
>> file from the command-line, especially adding extensions.
>
> hg config --edit # edits the user-specific hgrc, which is probably what you want
> hg config --global # edits the machine-global hgrc, almost never what you want
> hg config --local # edits the .hg/hgrc file
>
> It strikes me that we might want to rename these to be --edit-user, --edit-machine-wide, and --edit-repo respectively, but these flags will always work.

+1

Maybe even: --edit-user-config --edit-machine-wide-config
--edit-repo-config. A bit redundant, but clearer (--edit-user could be
mistaken for edit username).

>
> When I say "edits" above, I mean "opens the specified file in your configured text editor."
>
>>
>> I googled but could not find anything
>> Thanks
>>
>> Uwe Brauer
>>
>> _______________________________________________
>> Mercurial mailing list
>> [hidden email]
>> https://www.mercurial-scm.org/mailman/listinfo/mercurial
>
> _______________________________________________
> Mercurial mailing list
> [hidden email]
> https://www.mercurial-scm.org/mailman/listinfo/mercurial
>

--
Pierre-Yves David
_______________________________________________
Mercurial mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial
Reply | Threaded
Open this post in threaded view
|

Re: how to configure the global .hgrc file from the commandline

Pierre-Yves David-2
In reply to this post by Uwe Brauer
For the record, all your question should be answered by `hg help
config`. However, it mention neither the command not --edit option, we
should fix it.

On 5/24/20 2:30 PM, Uwe Brauer wrote:

>
>
> Hi
>
> That may sound bizarre. But lately I collaborate with colleagues, who
> don't have much interest in OS details, and use different OS. So it is
> sometimes not clear to me, especially for Windows users, where the
> corresponding global .hgrc is located.
>
> That's why I would like to know how one could configure the global .hgrc
> file from the command-line, especially adding extensions.
>
> I googled but could not find anything
> Thanks
>
> Uwe Brauer
>
> _______________________________________________
> Mercurial mailing list
> [hidden email]
> https://www.mercurial-scm.org/mailman/listinfo/mercurial
>

--
Pierre-Yves David
_______________________________________________
Mercurial mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial
Reply | Threaded
Open this post in threaded view
|

Re: how to configure the global .hgrc file from the commandline

Pierre Augier
A side remark on the `hg config --edit` command:

I encountered problems with students with the default editor.

On Windows, hg tries to open the config file with vi and just prints an error if vi is not available (which is very common)!

On Linux, by default, hg opens the config file with vi, and most of my students can't do anything with this editor.

It would be great if Mercurial could try to find an installed and easy-to-use editor if no editor is specified in the config files.

For people used to vi, it would anyway be very easy to switch to vi.


----- Mail original -----
> De: "Pierre-Yves David" <[hidden email]>
> À: "mercurial" <[hidden email]>
> Envoyé: Mercredi 27 Mai 2020 09:47:02
> Objet: Re: how to configure the global .hgrc file from the commandline

> For the record, all your question should be answered by `hg help
> config`. However, it mention neither the command not --edit option, we
> should fix it.
>
> On 5/24/20 2:30 PM, Uwe Brauer wrote:
>>
>>
>> Hi
>>
>> That may sound bizarre. But lately I collaborate with colleagues, who
>> don't have much interest in OS details, and use different OS. So it is
>> sometimes not clear to me, especially for Windows users, where the
>> corresponding global .hgrc is located.
>>
>> That's why I would like to know how one could configure the global .hgrc
>> file from the command-line, especially adding extensions.
>>
>> I googled but could not find anything
>> Thanks
>>
>> Uwe Brauer
>>
>> _______________________________________________
>> Mercurial mailing list
>> [hidden email]
>> https://www.mercurial-scm.org/mailman/listinfo/mercurial
>>
>
> --
> Pierre-Yves David
> _______________________________________________
> Mercurial mailing list
> [hidden email]
> https://www.mercurial-scm.org/mailman/listinfo/mercurial
_______________________________________________
Mercurial mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial
Reply | Threaded
Open this post in threaded view
|

Re: how to configure the global .hgrc file from the commandline

Marcus Harnisch-2
In reply to this post by Pierre-Yves David-2
On 27/05/2020 09.47, Pierre-Yves David wrote:
> For the record, all your question should be answered by `hg help
> config`. However, it mention neither the command not --edit option, we
> should fix it.

Not saying things couldn't be improved, but the text ends in:

   use 'hg help -c config' to see help for the config command

Perhaps there could be an introductory paragraph stating effectively the
same only at the beginning. Not sure how many cases exist where the
actual command and a related help topic have the same name. All these
pages should prominently remind the user that they might not be looking
at the page they expected.

Cheers,
Marcus

_______________________________________________
Mercurial mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial
Reply | Threaded
Open this post in threaded view
|

Re: how to configure the global .hgrc file from the commandline

Dr Rainer Woitok
In reply to this post by Pierre-Yves David-2
Pierre-Yves,

On Wednesday, 2020-05-27 09:45:29 +0200, you wrote:

> ...
> Maybe even: --edit-user-config --edit-machine-wide-config
> --edit-repo-config. A bit redundant, but clearer (--edit-user could be
> mistaken for edit username).

Perhaps the rather unwieldy "machine-wide" could be replaced with a sim-
ple "host"?

Sincerely,
  Rainer
_______________________________________________
Mercurial mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial
Reply | Threaded
Open this post in threaded view
|

Re: how to configure the global .hgrc file from the commandline

Uwe Brauer
In reply to this post by Pierre-Yves David-2
>>> "PD" == Pierre-Yves David <[hidden email]> writes:

   > For the record, all your question should be answered by `hg help
   > config`. However, it mention neither the command not --edit option, we
   > should fix it.

This is why I send my email! ;-)

_______________________________________________
Mercurial mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial

smime.p7s (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: how to configure the global .hgrc file from the commandline

Uwe Brauer
In reply to this post by Pierre Augier
>>> "PA" == PIERRE AUGIER <[hidden email]> writes:

   > A side remark on the `hg config --edit` command:
   > I encountered problems with students with the default editor.

   > On Windows, hg tries to open the config file with vi and just prints an error if vi is not available (which is very common)!

   > On Linux, by default, hg opens the config file with vi, and most of my students can't do anything with this editor.

   > It would be great if Mercurial could try to find an installed and easy-to-use editor if no editor is specified in the config files.

   > For people used to vi, it would anyway be very easy to switch to vi.

For people who find Emacs to heavy zile is an good alternative, but I
have now idea whether it would be available on windows.

_______________________________________________
Mercurial mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial

smime.p7s (7K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

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

Pierre Augier
From my experience, beginners are strongly disturbed when vi (or vim) is opened automatically (see https://stackoverflow.blog/2017/05/23/stack-overflow-helping-one-million-developers-exit-vim/).

For now, the default editor for Mercurial is vi. And to change the editor for one user, the dedicated Mercurial command (hg config --edit) opens... vi.

In https://www.mercurial-scm.org/wiki/editor, it is written:

"
Mercurial tries to pick which program to call to edit a commit message by trying the following (in order):

1. HGEDITOR environment variable
2. editor configuration option in [ui] section (in hgrc or passed with --config ui.editor command-line option).
3. VISUAL environment variable
4. EDITOR environment variable
5. vi, if none of the above is set

On Windows, the installer places a configuration file inside %programfiles%\Mercurial\hgrc.d\ that contains the editor settings (notepad by default). Thus, if you want to override it, you either have to redefine the configuration option or use an HGEDITOR environment variable (VISUAL and EDITOR will be ignored).
"

I think it is not a great design.

- Default is vi, which is a poor choice for many users.
- A particular mechanism for Windows, so that standard environment variables are not considered (VISUAL and EDITOR).
- It assumes that "the installer" does something particular for Windows, which is not granted (there are different ways to install Mercurial on Windows)

Instead, Mercurial could do something like:

5. nano (Unix) or notepad (Windows), if none of the above is set
6. vi, if previous editors are not available

Then, no need to have "editor = notepad" in %programfiles%\Mercurial\hgrc.d and VISUAL and EDITOR would be considered on Windows like with other OS.

Moreover, the default .hgrc content used by `hg config --edit` when there is no ~/.hgrc file could contain "editor = the-choosen-editor" so it would be very easy and intuitive for all users to change their editor, for example to change "nano" to "vi" for vi users on Unix if nano is installed.

Do you think Mercurial could be changed in this direction? What would be the drawback of this choice?

Pierre

----- Mail original -----
> De: "Uwe Brauer" <[hidden email]>
> À: "mercurial" <[hidden email]>
> Envoyé: Jeudi 28 Mai 2020 20:34:28
> Objet: Re: how to configure the global .hgrc file from the commandline

>>>> "PA" == PIERRE AUGIER <[hidden email]> writes:
>
>   > A side remark on the `hg config --edit` command:
>   > I encountered problems with students with the default editor.
>
>   > On Windows, hg tries to open the config file with vi and just prints an error if
>   > vi is not available (which is very common)!
>
>   > On Linux, by default, hg opens the config file with vi, and most of my students
>   > can't do anything with this editor.
>
>   > It would be great if Mercurial could try to find an installed and easy-to-use
>   > editor if no editor is specified in the config files.
>
>   > For people used to vi, it would anyway be very easy to switch to vi.
>
> For people who find Emacs to heavy zile is an good alternative, but I
> have now idea whether it would be available on windows.
>
> _______________________________________________
> Mercurial mailing list
> [hidden email]
> https://www.mercurial-scm.org/mailman/listinfo/mercurial
_______________________________________________
Mercurial mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial
Reply | Threaded
Open this post in threaded view
|

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

Scott Palmer
+1

Scott

> On May 29, 2020, at 10:08 AM, PIERRE AUGIER <[hidden email]> wrote:
>
> From my experience, beginners are strongly disturbed when vi (or vim) is opened automatically (see https://stackoverflow.blog/2017/05/23/stack-overflow-helping-one-million-developers-exit-vim/).
>
> For now, the default editor for Mercurial is vi. And to change the editor for one user, the dedicated Mercurial command (hg config --edit) opens... vi.
>
> In https://www.mercurial-scm.org/wiki/editor, it is written:
>
> "
> Mercurial tries to pick which program to call to edit a commit message by trying the following (in order):
>
> 1. HGEDITOR environment variable
> 2. editor configuration option in [ui] section (in hgrc or passed with --config ui.editor command-line option).
> 3. VISUAL environment variable
> 4. EDITOR environment variable
> 5. vi, if none of the above is set
>
> On Windows, the installer places a configuration file inside %programfiles%\Mercurial\hgrc.d\ that contains the editor settings (notepad by default). Thus, if you want to override it, you either have to redefine the configuration option or use an HGEDITOR environment variable (VISUAL and EDITOR will be ignored).
> "
>
> I think it is not a great design.
>
> - Default is vi, which is a poor choice for many users.
> - A particular mechanism for Windows, so that standard environment variables are not considered (VISUAL and EDITOR).
> - It assumes that "the installer" does something particular for Windows, which is not granted (there are different ways to install Mercurial on Windows)
>
> Instead, Mercurial could do something like:
>
> 5. nano (Unix) or notepad (Windows), if none of the above is set
> 6. vi, if previous editors are not available
>
> Then, no need to have "editor = notepad" in %programfiles%\Mercurial\hgrc.d and VISUAL and EDITOR would be considered on Windows like with other OS.
>
> Moreover, the default .hgrc content used by `hg config --edit` when there is no ~/.hgrc file could contain "editor = the-choosen-editor" so it would be very easy and intuitive for all users to change their editor, for example to change "nano" to "vi" for vi users on Unix if nano is installed.
>
> Do you think Mercurial could be changed in this direction? What would be the drawback of this choice?
>
> Pierre
_______________________________________________
Mercurial mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial
Reply | Threaded
Open this post in threaded view
|

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

Marcus Harnisch-2
In reply to this post by Pierre Augier
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.

Hg is already inspecting XDG_CONFIG_HOME (another XDG facility) for
locating the configuration file.

Cheers,
Marcus


_______________________________________________
Mercurial mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial
Reply | Threaded
Open this post in threaded view
|

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

Pierre Augier

----- Mail original -----
> De: "Marcus Harnisch" <[hidden email]>
> À: "mercurial" <[hidden email]>
> 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?

> Hg is already inspecting XDG_CONFIG_HOME (another XDG facility) for
> locating the configuration file.
>
> Cheers,
> Marcus
>
>
> _______________________________________________
> Mercurial mailing list
> [hidden email]
> https://www.mercurial-scm.org/mailman/listinfo/mercurial
_______________________________________________
Mercurial mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial
Reply | Threaded
Open this post in threaded view
|

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

Augie Fackler-2


> On May 29, 2020, at 3:08 PM, PIERRE AUGIER <[hidden email]> wrote:
>
>
> ----- Mail original -----
>> De: "Marcus Harnisch" <[hidden email]>
>> À: "mercurial" <[hidden email]>
>> 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
>> [hidden email]
>> https://www.mercurial-scm.org/mailman/listinfo/mercurial
> _______________________________________________
> Mercurial mailing list
> [hidden email]
> https://www.mercurial-scm.org/mailman/listinfo/mercurial

_______________________________________________
Mercurial mailing list
[hidden email]
https://www.mercurial-scm.org/mailman/listinfo/mercurial
123