diff --git a/src/Context.cpp b/src/Context.cpp index a18bbec15..f634daf16 100644 --- a/src/Context.cpp +++ b/src/Context.cpp @@ -150,6 +150,9 @@ int Context::initialize (int argc, const char** argv) // Create missing config file and data directory, if necessary. parser.applyOverrides (); + // Setting the debug switch has ripple effects. + propagateDebug (); + // These may have changed. // TODO Uh oh. Lexer::dateFormat = config.get ("dateformat"); @@ -753,6 +756,25 @@ void Context::loadAliases () parser.alias (i->first.substr (6), i->second); } +//////////////////////////////////////////////////////////////////////////////// +// Using the general rc.debug setting automaticalls sets debug.tls, debug.hooks +// and debug.parser, unless they already have values, which by default they do +// not. +void Context::propagateDebug () +{ + if (config.getBoolean ("debug")) + { + if (! config.has ("debug.tls")) + config.set ("debug.tls", 2); + + if (! config.has ("debug.hooks")) + config.set ("debug.hooks", 2); + + if (! config.has ("debug.parser")) + config.set ("debug.parser", 2); + } +} + //////////////////////////////////////////////////////////////////////////////// void Context::header (const std::string& input) { diff --git a/src/Context.h b/src/Context.h index f6fbd705b..f4c8ce4de 100644 --- a/src/Context.h +++ b/src/Context.h @@ -79,6 +79,7 @@ private: void updateXtermTitle (); void updateVerbosity (); void loadAliases (); + void propagateDebug (); public: std::string program;