From: Chuck Lever Date: Tue, 6 Sep 2005 16:12:27 +0000 (-0400) Subject: Set stg's text editor in .stgitrc X-Git-Tag: v0.14.3~689 X-Git-Url: https://git.distorted.org.uk/~mdw/stgit/commitdiff_plain/cd076ff629ab7963f3497f7022ebb2b9a99a52ef Set stg's text editor in .stgitrc Allow specifying stg's text editor in .stgitrc. Some legacy tools need an old version of "vi" in EDITOR, but we can be flexible. Signed-off-by: Chuck Lever --- diff --git a/examples/stgitrc b/examples/stgitrc index a225090..f4facef 100644 --- a/examples/stgitrc +++ b/examples/stgitrc @@ -17,6 +17,10 @@ smtpserver: localhost:25 #smtpuser: username #smtppassword: password +# stg will look for this first, then look for the EDITOR environmental +# variable, then default to using 'vi' +#editor: /usr/bin/vi + [gitmergeonefile] # Different three-way merge tools below. Uncomment the preferred one. diff --git a/stgit/stack.py b/stgit/stack.py index cfac219..7a91b0c 100644 --- a/stgit/stack.py +++ b/stgit/stack.py @@ -92,7 +92,9 @@ def edit_file(series, string, comment, show_patch = True): f.close() # the editor - if 'EDITOR' in os.environ: + if config.has_option('stgit', 'editor'): + editor = config.get('stgit', 'editor') + elif 'EDITOR' in os.environ: editor = os.environ['EDITOR'] else: editor = 'vi'