From 04f817814ff754e89e93cbe9c2dc1e75ded2c4e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Helleu?= Date: Mon, 25 May 2026 23:06:40 +0200 Subject: [PATCH] fset: add "t:themable" filter Extend the "t:" filter so the special value "themable" matches every option whose new themable flag is set, regardless of type (color, string, integer, boolean, enum). This makes the flag interactively discoverable in the fset buffer and is the natural way to inspect the surface area that an upcoming /theme command will be allowed to touch. The themable flag of an option is now mirrored on struct t_fset_option, exposed via hdata ("themable", integer) and infolist ("themable", integer), and printed in the log. --- src/plugins/fset/fset-command.c | 4 +++- src/plugins/fset/fset-option.c | 15 ++++++++++++++- src/plugins/fset/fset-option.h | 1 + 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/plugins/fset/fset-command.c b/src/plugins/fset/fset-command.c index f22af499d..3a64b7ff2 100644 --- a/src/plugins/fset/fset-command.c +++ b/src/plugins/fset/fset-command.c @@ -702,7 +702,9 @@ fset_command_init (void) N_("> `xxx`: show only options with \"xxx\" in name"), N_("> `f:xxx`: show only configuration file \"xxx\""), N_("> `t:xxx`: show only type \"xxx\" (bool/int/str/col/enum " - "or boolean/integer/string/color/enum)"), + "or boolean/integer/string/color/enum); the special value " + "\"themable\" matches all options with the themable flag, " + "regardless of type"), N_("> `d`: show only changed options"), N_("> `d:xxx`: show only changed options with \"xxx\" in " "name"), diff --git a/src/plugins/fset/fset-option.c b/src/plugins/fset/fset-option.c index 2c5a874f8..135a5f478 100644 --- a/src/plugins/fset/fset-option.c +++ b/src/plugins/fset/fset-option.c @@ -335,6 +335,10 @@ fset_option_match_filter (struct t_fset_option *fset_option, const char *filter) } else if (strncmp (filter, "t:", 2) == 0) { + /* virtual cross-type value: match themable flag (any option type) */ + if (weechat_strcasecmp (filter + 2, "themable") == 0) + return (fset_option->themable) ? 1 : 0; + /* filter by type */ return ( (weechat_strcasecmp ( @@ -426,7 +430,7 @@ fset_option_set_values (struct t_fset_option *fset_option, const char **ptr_string_values; void *ptr_default_value, *ptr_value; struct t_config_option *ptr_parent_option; - int *ptr_type, *ptr_min, *ptr_max; + int *ptr_type, *ptr_themable, *ptr_min, *ptr_max; char str_value[64], str_allowed_values[4096]; /* file */ @@ -466,6 +470,10 @@ fset_option_set_values (struct t_fset_option *fset_option, ptr_type = weechat_config_option_get_pointer (option, "type"); fset_option->type = *ptr_type; + /* themable */ + ptr_themable = weechat_config_option_get_pointer (option, "themable"); + fset_option->themable = (ptr_themable) ? *ptr_themable : 0; + /* default value */ free (fset_option->default_value); fset_option->default_value = NULL; @@ -784,6 +792,7 @@ fset_option_alloc (struct t_config_option *option) new_fset_option->name = NULL; new_fset_option->parent_name = NULL; new_fset_option->type = 0; + new_fset_option->themable = 0; new_fset_option->default_value = NULL; new_fset_option->value = NULL; new_fset_option->parent_value = NULL; @@ -1691,6 +1700,7 @@ fset_option_hdata_option_cb (const void *pointer, void *data, WEECHAT_HDATA_VAR(struct t_fset_option, name, STRING, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_fset_option, parent_name, STRING, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_fset_option, type, INTEGER, 0, NULL, NULL); + WEECHAT_HDATA_VAR(struct t_fset_option, themable, INTEGER, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_fset_option, default_value, STRING, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_fset_option, value, STRING, 0, NULL, NULL); WEECHAT_HDATA_VAR(struct t_fset_option, parent_value, STRING, 0, NULL, NULL); @@ -1740,6 +1750,8 @@ fset_option_add_to_infolist (struct t_infolist *infolist, return 0; if (!weechat_infolist_new_var_string (ptr_item, "type_en", fset_option_type_string[fset_option->type])) return 0; + if (!weechat_infolist_new_var_integer (ptr_item, "themable", fset_option->themable)) + return 0; if (!weechat_infolist_new_var_string (ptr_item, "default_value", fset_option->default_value)) return 0; if (!weechat_infolist_new_var_string (ptr_item, "value", fset_option->value)) @@ -1793,6 +1805,7 @@ fset_option_print_log (void) weechat_log_printf (" type. . . . . . . . . : %d ('%s')", ptr_fset_option->type, fset_option_type_string[ptr_fset_option->type]); + weechat_log_printf (" themable. . . . . . . : %d", ptr_fset_option->themable); weechat_log_printf (" default_value . . . . : '%s'", ptr_fset_option->default_value); weechat_log_printf (" value . . . . . . . . : '%s'", ptr_fset_option->value); weechat_log_printf (" parent_value. . . . . : '%s'", ptr_fset_option->parent_value); diff --git a/src/plugins/fset/fset-option.h b/src/plugins/fset/fset-option.h index 8ad377eb2..0a0cce96a 100644 --- a/src/plugins/fset/fset-option.h +++ b/src/plugins/fset/fset-option.h @@ -46,6 +46,7 @@ struct t_fset_option char *name; /* option full name: file.sect.opt */ char *parent_name; /* parent option name */ enum t_fset_option_type type; /* option type */ + int themable; /* 1 if option is themable */ char *default_value; /* option default value */ char *value; /* option value */ char *parent_value; /* parent option value */