NeoMutt  2025-01-09-104-g5de5ef
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
config.c
Go to the documentation of this file.
1
31#include "config.h"
32#include <stdbool.h>
33#include <stddef.h>
34#include "mutt/lib.h"
35#include "config/lib.h"
36#include "expando/lib.h"
37#include "expando.h"
38#include "sort.h"
39
43static const struct Mapping AliasSortMethods[] = {
44 // clang-format off
45 { "alias", ALIAS_SORT_ALIAS },
46 { "email", ALIAS_SORT_EMAIL },
47 { "name", ALIAS_SORT_NAME },
48 { "unsorted", ALIAS_SORT_UNSORTED },
49 { NULL, 0 },
50 // clang-format on
51};
52
59static const struct ExpandoDefinition AliasFormatDef[] = {
60 // clang-format off
61 { "*", "padding-soft", ED_GLOBAL, ED_GLO_PADDING_SOFT, node_padding_parse },
62 { ">", "padding-hard", ED_GLOBAL, ED_GLO_PADDING_HARD, node_padding_parse },
63 { "|", "padding-eol", ED_GLOBAL, ED_GLO_PADDING_EOL, node_padding_parse },
64 { "a", "alias", ED_ALIAS, ED_ALI_ALIAS, NULL },
65 { "A", "address", ED_ALIAS, ED_ALI_ADDRESS, NULL },
66 { "C", "comment", ED_ALIAS, ED_ALI_COMMENT, NULL },
67 { "E", "email", ED_ALIAS, ED_ALI_EMAIL, NULL },
68 { "f", "flags", ED_ALIAS, ED_ALI_FLAGS, NULL },
69 { "i", "number", ED_ALIAS, ED_ALI_NUMBER, NULL },
70 { "N", "name", ED_ALIAS, ED_ALI_NAME, NULL },
71 { "t", "tagged", ED_ALIAS, ED_ALI_TAGGED, NULL },
72 { "Y", "tags", ED_ALIAS, ED_ALI_TAGS, NULL },
73 // Deprecated
74 { "c", NULL, ED_ALIAS, ED_ALI_COMMENT, NULL },
75 { "n", NULL, ED_ALIAS, ED_ALI_NUMBER, NULL },
76 { "r", NULL, ED_ALIAS, ED_ALI_ADDRESS, NULL },
77 { NULL, NULL, 0, -1, NULL }
78 // clang-format on
79};
80
87static const struct ExpandoDefinition QueryFormatDef[] = {
88 // clang-format off
89 { "*", "padding-soft", ED_GLOBAL, ED_GLO_PADDING_SOFT, node_padding_parse },
90 { ">", "padding-hard", ED_GLOBAL, ED_GLO_PADDING_HARD, node_padding_parse },
91 { "|", "padding-eol", ED_GLOBAL, ED_GLO_PADDING_EOL, node_padding_parse },
92 { "A", "address", ED_ALIAS, ED_ALI_ADDRESS, NULL },
93 { "C", "comment", ED_ALIAS, ED_ALI_COMMENT, NULL },
94 { "E", "email", ED_ALIAS, ED_ALI_EMAIL, NULL },
95 { "i", "number", ED_ALIAS, ED_ALI_NUMBER, NULL },
96 { "N", "name", ED_ALIAS, ED_ALI_NAME, NULL },
97 { "t", "tagged", ED_ALIAS, ED_ALI_TAGGED, NULL },
98 { "Y", "tags", ED_ALIAS, ED_ALI_TAGS, NULL },
99 // Deprecated
100 { "a", NULL, ED_ALIAS, ED_ALI_EMAIL, NULL },
101 { "c", NULL, ED_ALIAS, ED_ALI_NUMBER, NULL },
102 { "e", NULL, ED_ALIAS, ED_ALI_COMMENT, NULL },
103 { "n", NULL, ED_ALIAS, ED_ALI_NAME, NULL },
104 { NULL, NULL, 0, -1, NULL }
105 // clang-format on
106};
107
111static struct ConfigDef AliasVars[] = {
112 // clang-format off
113 { "alias_file", DT_PATH|D_PATH_FILE, IP "~/.neomuttrc", 0, NULL,
114 "Save new aliases to this file"
115 },
116 { "alias_format", DT_EXPANDO|D_NOT_EMPTY, IP "%3i %f%t %-15a %-56A | %C%> %Y", IP &AliasFormatDef, NULL,
117 "printf-like format string for the alias menu"
118 },
120 "Sort method for the alias menu"
121 },
122 { "query_command", DT_STRING|D_STRING_COMMAND, 0, 0, NULL,
123 "External command to query and external address book"
124 },
125 { "query_format", DT_EXPANDO|D_NOT_EMPTY, IP "%3i %t %-25N %-25E | %C%> %Y", IP &QueryFormatDef, NULL,
126 "printf-like format string for the query menu (address book)"
127 },
128
129 { "sort_alias", DT_SYNONYM, IP "alias_sort", IP "2024-11-19" },
130
131 { NULL },
132 // clang-format on
133};
134
139{
141}
static const struct Mapping AliasSortMethods[]
Sort methods for email aliases.
Definition: config.c:43
static const struct ExpandoDefinition QueryFormatDef[]
Expando definitions.
Definition: config.c:87
static const struct ExpandoDefinition AliasFormatDef[]
Expando definitions.
Definition: config.c:59
static struct ConfigDef AliasVars[]
Config definitions for the alias library.
Definition: config.c:111
@ ED_ALI_FLAGS
Alias.flags.
Definition: expando.h:39
@ ED_ALI_EMAIL
Alias.addr.mailbox.
Definition: expando.h:38
@ ED_ALI_NUMBER
AliasView.num.
Definition: expando.h:41
@ ED_ALI_NAME
Alias.addr.personal.
Definition: expando.h:40
@ ED_ALI_ALIAS
Alias.name.
Definition: expando.h:36
@ ED_ALI_ADDRESS
Alias.addr.
Definition: expando.h:35
@ ED_ALI_COMMENT
Alias.comment.
Definition: expando.h:37
@ ED_ALI_TAGGED
AliasView.tagged.
Definition: expando.h:42
@ ED_ALI_TAGS
Alias.tags.
Definition: expando.h:43
@ ALIAS_SORT_UNSORTED
Sort by the order the Aliases were configured.
Definition: sort.h:34
@ ALIAS_SORT_NAME
Sort by Real Name.
Definition: sort.h:33
@ ALIAS_SORT_EMAIL
Sort by Email Address.
Definition: sort.h:32
@ ALIAS_SORT_ALIAS
Sort by Alias short name.
Definition: sort.h:31
Convenience wrapper for the config headers.
bool cs_register_variables(const struct ConfigSet *cs, struct ConfigDef vars[])
Register a set of config items.
Definition: set.c:289
#define IP
Definition: set.h:52
@ ED_ALIAS
Alias ED_ALI_ ExpandoDataAlias.
Definition: domain.h:35
@ ED_GLOBAL
Global ED_GLO_ ExpandoDataGlobal.
Definition: domain.h:44
Parse Expando string.
bool config_init_alias(struct ConfigSet *cs)
Register alias config variables - Implements module_init_config_t -.
Definition: config.c:138
struct ExpandoNode * node_padding_parse(const char *str, struct ExpandoFormat *fmt, int did, int uid, ExpandoParserFlags flags, const char **parsed_until, struct ExpandoParseError *err)
Parse a Padding Expando - Implements ExpandoDefinition::parse() -.
Definition: node_padding.c:234
Convenience wrapper for the library headers.
Sidebar Expando definitions.
Sidebar sorting functions.
Definition: set.h:62
Container for lots of config items.
Definition: set.h:248
Definition of a format string.
Definition: definition.h:44
Mapping between user-readable string and a constant.
Definition: mapping.h:33
#define D_STRING_COMMAND
A command.
Definition: types.h:98
#define D_PATH_FILE
Path is a file.
Definition: types.h:103
@ DT_SYNONYM
synonym for another variable
Definition: types.h:45
@ DT_STRING
a string
Definition: types.h:44
@ DT_SORT
sorting methods
Definition: types.h:43
@ DT_EXPANDO
an expando
Definition: types.h:34
@ DT_PATH
a path to a file/directory
Definition: types.h:39
#define D_SORT_REVERSE
Sort flag for -reverse prefix.
Definition: types.h:119
#define D_NOT_EMPTY
Empty strings are not allowed.
Definition: types.h:79
@ ED_GLO_PADDING_EOL
Padding to end-of-line.
Definition: uid.h:38
@ ED_GLO_PADDING_HARD
Hard Padding.
Definition: uid.h:39
@ ED_GLO_PADDING_SOFT
Soft Padding.
Definition: uid.h:40