You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by David Kimdon <dw...@debian.org> on 2003/02/09 01:55:52 UTC
[patch] : configure time default editor
Hi,
I did some poking around in the list archive and I know there was some
contention about having a default editor in subversion. I didn't see anywhere
that a configure time default was rejected . . .
Anyway, here is a patch that gives a --with-editor option to configure. I want
this personally so I can close two bugs in the Debian package (
http://bugs.debian.org/162632 , http://bugs.debian.org/164371 ). Up until now
I have been using /etc/subversion/config to set the editor, but I'd rather use
the vanilla 'config' file (especially since I sometimes forget to set the
default editor when I update the 'config' template).
How do we feel about this patch?
-David
Index: subversion/clients/cmdline/util.c
===================================================================
--- subversion/clients/cmdline/util.c (revision 4802)
+++ subversion/clients/cmdline/util.c (working copy)
@@ -44,6 +44,7 @@
#include "svn_utf.h"
#include "svn_subst.h"
#include "svn_config.h"
+#include "svn_private_config.h"
#include "cl.h"
@@ -96,7 +97,14 @@
editor = getenv ("VISUAL");
if (! editor)
editor = getenv ("EDITOR");
-
+
+#ifdef SVN_CLIENT_EDITOR
+ if (! editor)
+ {
+ editor = SVN_CLIENT_EDITOR;
+ }
+#endif
+
/* Now, override this editor choice with a selection from our config
file (using what we have found thus far as the default in case no
config option exists). */
Index: configure.in
===================================================================
--- configure.in (revision 4802)
+++ configure.in (working copy)
@@ -273,6 +273,20 @@
fi
])
+AC_ARG_WITH(editor,
+AC_HELP_STRING([--with-editor=PATH],
+ [Specify a default editor for the subversion client.]),
+[
+ if test -n "$withval" ; then
+ SVN_CLIENT_EDITOR=$withval
+ else
+ SVN_CLIENT_EDITOR=
+ fi
+
+ AC_DEFINE_UNQUOTED(SVN_CLIENT_EDITOR, "$SVN_CLIENT_EDITOR",
+ [Define to be the full path to a default editor for the client.])
+])
+
MOD_ACTIVATION="-a"
AC_ARG_ENABLE(mod-activation,
AC_HELP_STRING([--disable-mod-activation],
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [patch] : configure time default editor
Posted by Eric Gillespie <ep...@pretzelnet.org>.
Philip Martin <ph...@codematters.co.uk> writes:
> I don't think that's right -- I think the environment variables should
> override the config file. The config should allow me to define the
> default editor, but suppose I need to change it for a single commit.
Yep. The correct precedence is:
5. Built-in defaults
4. System config
3. User config
2. Environment variables
1. Command-line options
--
Eric Gillespie <*> epg@pretzelnet.org
Build a fire for a man, and he'll be warm for a day. Set a man on
fire, and he'll be warm for the rest of his life. -Terry Pratchett
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [patch] : configure time default editor
Posted by Julian Fitzell <ju...@beta4.com>.
Greg Hudson wrote:
> On Sun, 2003-02-09 at 13:08, Philip Martin wrote:
>
>>I don't think that's right -- I think the environment variables should
>>override the config file.
>
>
> There is precedent for application-specific config files overriding
> generic environment variables (EDITOR and VISUAL). nmh comes to mind.
> On the other hand, an application-specific variable like SVN_EDITOR
> would probably want to override the config files.
>
> (But, no strong opinion. If people want all of the environment
> variables to override the config file, that's not too unreasonable.)
No that is very reasonable.
1) compile time settings
2) machine-wide config file (hmm... do we have one? can't remember...)
3) EDITOR env variable
4) user's config file
5) SVN_EDITOR env variable
6) commmand line switch
Might be a good order. This all seems strangely familiar though...
haven't we had this discussion before?
Julian
--
julian@beta4.com
Beta4 Productions (http://www.beta4.com)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [patch] : configure time default editor
Posted by Greg Hudson <gh...@MIT.EDU>.
On Sun, 2003-02-09 at 13:08, Philip Martin wrote:
> I don't think that's right -- I think the environment variables should
> override the config file.
There is precedent for application-specific config files overriding
generic environment variables (EDITOR and VISUAL). nmh comes to mind.
On the other hand, an application-specific variable like SVN_EDITOR
would probably want to override the config files.
(But, no strong opinion. If people want all of the environment
variables to override the config file, that's not too unreasonable.)
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [patch] : configure time default editor
Posted by Jeff Hinrichs <je...@delasco.com>.
> Correct order (imho) would be (first is weakest):
>
> 1) compile time settings
> 2) config file
> 3) environment
> 4) commmand line switch
+1
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [patch] : configure time default editor
Posted by Jani Averbach <ja...@cc.jyu.fi>.
On 9 Feb 2003, Philip Martin wrote:
> If the config file dominates then I need to edit it twice, once for
> the special case and once to restore it. That's silly, I should be
> able to do
>
> $ SVN_EDITOR=/some/one/off svn commit
>
> What do people think?
>
I agree absolutely.
Correct order (imho) would be (first is weakest):
1) compile time settings
2) config file
3) environment
4) commmand line switch
BR, Jani
--
Jani Averbach
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: [patch] : configure time default editor
Posted by Philip Martin <ph...@codematters.co.uk>.
David Kimdon <dw...@debian.org> writes:
> Anyway, here is a patch that gives a --with-editor option to configure. I want
> this personally so I can close two bugs in the Debian package (
> http://bugs.debian.org/162632 , http://bugs.debian.org/164371 ). Up until now
> I have been using /etc/subversion/config to set the editor, but I'd rather use
> the vanilla 'config' file (especially since I sometimes forget to set the
> default editor when I update the 'config' template).
>
> How do we feel about this patch?
It looks like a reasonable idea to me. It caused me to look at the
current code (svn_cl__edit_externally) and I see
/* Now, override this editor choice with a selection from our config
file (using what we have found thus far as the default in case no
config option exists). */
I don't think that's right -- I think the environment variables should
override the config file. The config should allow me to define the
default editor, but suppose I need to change it for a single commit.
If the config file dominates then I need to edit it twice, once for
the special case and once to restore it. That's silly, I should be
able to do
$ SVN_EDITOR=/some/one/off svn commit
What do people think?
--
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org