From 20cb9a7d13ed36593432509ac0215b21c54d6657 Mon Sep 17 00:00:00 2001 From: Robin Haberkorn Date: Tue, 10 Mar 2015 23:23:46 +0100 Subject: added --no-profile command line option --- doc/sciteco.1.in | 12 ++++++++++++ src/main.cpp | 11 +++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/doc/sciteco.1.in b/doc/sciteco.1.in index 16df9c4..2949f76 100644 --- a/doc/sciteco.1.in +++ b/doc/sciteco.1.in @@ -17,6 +17,7 @@ Scintilla-based \fBT\fPext \fBE\fPditor and \fBCO\fPrrector .OP \-h|\-\-help .OP \-e|\-\-eval macro .OP \-m|\-\-mung file +.OP \-\-no\-profile .OP \-\- .RI [ argument .IR .\|.\|. ] @@ -104,6 +105,9 @@ The profile will usually set up various Scintilla and \*(ST options, configure syntax highlighting, define commonly used macros and open files specified as arguments to \*(ST. It will usually leave the editor in interactive mode. +Profile execution can be suppressed with the +.B \-\-no\-profile +option. . . .SH OPTIONS @@ -122,6 +126,14 @@ option has no effect. Mung \fIfile\fP. Default is .IR $SCITECOCONFIG/.teco_ini . +.IP "\fB--no-profile\fP" +Do not mung any profile. +This leaves the editor in interactive mode with default +settings just as if no profile existed or like when +munging an empty file. +This is useful to fix up a broken profile script. +This option has no effect when a file is explicitly munged with +.BR \-\-mung . . . .SH EXIT STATUS diff --git a/src/main.cpp b/src/main.cpp index de27e5e..79cb78b 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -76,6 +76,7 @@ namespace Flags { static gchar *eval_macro = NULL; static gchar *mung_file = NULL; +static gboolean mung_profile = TRUE; sig_atomic_t sigint_occurred = FALSE; @@ -128,6 +129,11 @@ process_options(int &argc, char **&argv) {"mung", 'm', 0, G_OPTION_ARG_FILENAME, &mung_file, "Mung file instead of " "$SCITECOCONFIG" G_DIR_SEPARATOR_S INI_FILE, "file"}, + {"no-profile", 0, G_OPTION_FLAG_REVERSE, + G_OPTION_ARG_NONE, &mung_profile, + "Do not mung " + "$SCITECOCONFIG" G_DIR_SEPARATOR_S INI_FILE + " even if it exists"}, {NULL} }; @@ -353,11 +359,12 @@ main(int argc, char **argv) exit(EXIT_SUCCESS); } - if (!mung_file) + if (!mung_file && mung_profile) mung_file = g_build_filename(g_getenv("SCITECOCONFIG"), INI_FILE, NIL); - if (g_file_test(mung_file, G_FILE_TEST_IS_REGULAR)) { + if (mung_file && + g_file_test(mung_file, G_FILE_TEST_IS_REGULAR)) { Execute::file(mung_file, false); /* FIXME: make quit immediate in batch/macro mode (non-UNDO)? */ -- cgit v1.2.3