From: Richard Russon Date: Mon, 9 Sep 2019 10:31:09 +0000 (+0100) Subject: config: don't dump deprecated items X-Git-Tag: 2019-10-25~50 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=3640add484d4f1b637c711c29c0dce1c7e74e1d0;p=neomutt config: don't dump deprecated items --- diff --git a/config/dump.c b/config/dump.c index 02244455c..8dae7b63c 100644 --- a/config/dump.c +++ b/config/dump.c @@ -222,6 +222,9 @@ bool dump_config(struct ConfigSet *cs, ConfigDumpFlags flags, FILE *fp) if ((type == DT_SYNONYM) && !(flags & CS_DUMP_SHOW_SYNONYMS)) continue; + if ((he->type & DT_DEPRECATED) && !(flags & CS_DUMP_SHOW_DEPRECATED)) + continue; + // if ((type == DT_DISABLED) && !(flags & CS_DUMP_SHOW_DISABLED)) // continue; diff --git a/config/dump.h b/config/dump.h index 53169cc68..9dd635e46 100644 --- a/config/dump.h +++ b/config/dump.h @@ -31,16 +31,17 @@ struct Buffer; struct ConfigSet; struct HashElem; -typedef uint8_t ConfigDumpFlags; ///< Flags for dump_config(), e.g. #CS_DUMP_ONLY_CHANGED -#define CS_DUMP_NO_FLAGS 0 ///< No flags are set -#define CS_DUMP_ONLY_CHANGED (1 << 0) ///< Only show config that the user has changed -#define CS_DUMP_HIDE_SENSITIVE (1 << 1) ///< Obscure sensitive information like passwords -#define CS_DUMP_NO_ESCAPING (1 << 2) ///< Do not escape special chars, or quote the string -#define CS_DUMP_HIDE_NAME (1 << 3) ///< Do not print the name of the config item -#define CS_DUMP_HIDE_VALUE (1 << 4) ///< Do not print the value of the config item -#define CS_DUMP_SHOW_DEFAULTS (1 << 5) ///< Show the default value for the config item -#define CS_DUMP_SHOW_DISABLED (1 << 6) ///< Show disabled config items, too -#define CS_DUMP_SHOW_SYNONYMS (1 << 7) ///< Show synonyms and the config items their linked to +typedef uint8_t ConfigDumpFlags; ///< Flags for dump_config(), e.g. #CS_DUMP_ONLY_CHANGED +#define CS_DUMP_NO_FLAGS 0 ///< No flags are set +#define CS_DUMP_ONLY_CHANGED (1 << 0) ///< Only show config that the user has changed +#define CS_DUMP_HIDE_SENSITIVE (1 << 1) ///< Obscure sensitive information like passwords +#define CS_DUMP_NO_ESCAPING (1 << 2) ///< Do not escape special chars, or quote the string +#define CS_DUMP_HIDE_NAME (1 << 3) ///< Do not print the name of the config item +#define CS_DUMP_HIDE_VALUE (1 << 4) ///< Do not print the value of the config item +#define CS_DUMP_SHOW_DEFAULTS (1 << 5) ///< Show the default value for the config item +#define CS_DUMP_SHOW_DISABLED (1 << 6) ///< Show disabled config items, too +#define CS_DUMP_SHOW_SYNONYMS (1 << 7) ///< Show synonyms and the config items they're linked to +#define CS_DUMP_SHOW_DEPRECATED (1 << 8) ///< Show config items that aren't used any more void dump_config_neo(struct ConfigSet *cs, struct HashElem *he, struct Buffer *value, struct Buffer *initial, ConfigDumpFlags flags, FILE *fp); bool dump_config(struct ConfigSet *cs, ConfigDumpFlags flags, FILE *fp); diff --git a/config/types.h b/config/types.h index 5b7e06805..71ff5136e 100644 --- a/config/types.h +++ b/config/types.h @@ -74,6 +74,7 @@ typedef uint32_t ConfigRedrawFlags; ///< Flags for redraw/resort, e.g. #R_INDEX #define R_REDRAW_MASK 0x07FE0000 ///< Mask for the Redraw Flags /* Private config item flags */ +#define DT_DEPRECATED (1 << 27) ///< Config item shouldn't be used any more #define DT_INHERITED (1 << 28) ///< Config item is inherited #define DT_INITIAL_SET (1 << 29) ///< Config item must have its initial value freed #define DT_DISABLED (1 << 30) ///< Config item is disabled diff --git a/init.h b/init.h index bd5c40b05..528e11c02 100644 --- a/init.h +++ b/init.h @@ -4887,10 +4887,10 @@ struct ConfigDef MuttVars[] = { #endif /*--*/ - { "ignore_linear_white_space", DT_BOOL, &C_IgnoreLinearWhiteSpace, false }, - { "pgp_encrypt_self", DT_QUAD, &C_PgpEncryptSelf, MUTT_NO }, - { "smime_encrypt_self", DT_QUAD, &C_SmimeEncryptSelf, MUTT_NO }, - { "wrapmargin", DT_NUMBER|R_PAGER, &C_Wrap, 0 }, + { "ignore_linear_white_space", DT_DEPRECATED|DT_BOOL, &C_IgnoreLinearWhiteSpace, false }, + { "pgp_encrypt_self", DT_DEPRECATED|DT_QUAD, &C_PgpEncryptSelf, MUTT_NO }, + { "smime_encrypt_self", DT_DEPRECATED|DT_QUAD, &C_SmimeEncryptSelf, MUTT_NO }, + { "wrapmargin", DT_DEPRECATED|DT_NUMBER|R_PAGER, &C_Wrap, 0 }, { "abort_noattach_regexp", DT_SYNONYM, NULL, IP "abort_noattach_regex", }, { "attach_keyword", DT_SYNONYM, NULL, IP "abort_noattach_regex", },