From cd076ff629ab7963f3497f7022ebb2b9a99a52ef Mon Sep 17 00:00:00 2001 From: Chuck Lever Date: Tue, 6 Sep 2005 12:12:27 -0400 Subject: [PATCH] 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 --- examples/stgitrc | 4 ++++ stgit/stack.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) 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' -- 2.11.0