NeoMutt  2025-12-11-435-g4ac674
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
config.c
Go to the documentation of this file.
1
24
30
31#include "config.h"
32#include <stddef.h>
33#include "mutt/lib.h"
34#include "config/lib.h"
35#include "expando/lib.h"
36#include "expando.h"
37#include "sort.h"
38
42static const struct Mapping AliasSortMethods[] = {
43 // clang-format off
44 { "alias", ALIAS_SORT_ALIAS },
45 { "email", ALIAS_SORT_EMAIL },
46 { "name", ALIAS_SORT_NAME },
47 { "unsorted", ALIAS_SORT_UNSORTED },
48 // Compatibility
49 { "address", ALIAS_SORT_EMAIL },
50 { NULL, 0 },
51 // clang-format on
52};
53
60static const struct ExpandoDefinition AliasFormatDef[] = {
61 // clang-format off
62 { "*", "padding-soft", ED_GLOBAL, ED_GLO_PADDING_SOFT, node_padding_parse },
63 { ">", "padding-hard", ED_GLOBAL, ED_GLO_PADDING_HARD, node_padding_parse },
64 { "|", "padding-eol", ED_GLOBAL, ED_GLO_PADDING_EOL, node_padding_parse },
65 { "a", "alias", ED_ALIAS, ED_ALI_ALIAS, NULL },
66 { "A", "address", ED_ALIAS, ED_ALI_ADDRESS, NULL },
67 { "C", "comment", ED_ALIAS, ED_ALI_COMMENT, NULL },
68 { "E", "email", ED_ALIAS, ED_ALI_EMAIL, NULL },
69 { "f", "flags", ED_ALIAS, ED_ALI_FLAGS, NULL },
70 { "i", "number", ED_ALIAS, ED_ALI_NUMBER, NULL },
71 { "N", "name", ED_ALIAS, ED_ALI_NAME, NULL },
72 { "t", "tagged", ED_ALIAS, ED_ALI_TAGGED, NULL },
73 { "Y", "tags", ED_ALIAS, ED_ALI_TAGS, NULL },
74 // Deprecated
75 { "c", NULL, ED_ALIAS, ED_ALI_COMMENT, NULL },
76 { "n", NULL, ED_ALIAS, ED_ALI_NUMBER, NULL },
77 { "r", NULL, ED_ALIAS, ED_ALI_ADDRESS, NULL },
78 { NULL, NULL, 0, -1, NULL }
79 // clang-format on
80};
81
88static const struct ExpandoDefinition QueryFormatDef[] = {
89 // clang-format off
90 { "*", "padding-soft", ED_GLOBAL, ED_GLO_PADDING_SOFT, node_padding_parse },
91 { ">", "padding-hard", ED_GLOBAL, ED_GLO_PADDING_HARD, node_padding_parse },
92 { "|", "padding-eol", ED_GLOBAL, ED_GLO_PADDING_EOL, node_padding_parse },
93 { "A", "address", ED_ALIAS, ED_ALI_ADDRESS, NULL },
94 { "C", "comment", ED_ALIAS, ED_ALI_COMMENT, NULL },
95 { "E", "email", ED_ALIAS, ED_ALI_EMAIL, NULL },
96 { "i", "number", ED_ALIAS, ED_ALI_NUMBER, NULL },
97 { "N", "name", ED_ALIAS, ED_ALI_NAME, NULL },
98 { "t", "tagged", ED_ALIAS, ED_ALI_TAGGED, NULL },
99 { "Y", "tags", ED_ALIAS, ED_ALI_TAGS, NULL },
100 // Deprecated
101 { "a", NULL, ED_ALIAS, ED_ALI_EMAIL, NULL },
102 { "c", NULL, ED_ALIAS, ED_ALI_NUMBER, NULL },
103 { "e", NULL, ED_ALIAS, ED_ALI_COMMENT, NULL },
104 { "n", NULL, ED_ALIAS, ED_ALI_NAME, NULL },
105 { NULL, NULL, 0, -1, NULL }
106 // clang-format on
107};
108
113 // clang-format off
114 { "alias_file", DT_PATH|D_PATH_FILE, IP "~/.neomuttrc", 0, NULL,
115 "Save new aliases to this file"
116 },
117 { "alias_format", DT_EXPANDO|D_NOT_EMPTY, IP "%3i %f%t %-15a %-56A | %C%> %Y", IP &AliasFormatDef, NULL,
118 "printf-like format string for the alias menu"
119 },
121 "Sort method for the alias menu"
122 },
123 { "query_command", DT_STRING|D_STRING_COMMAND, 0, 0, NULL,
124 "External command to query and external address book"
125 },
126 { "query_format", DT_EXPANDO|D_NOT_EMPTY, IP "%3i %t %-25N %-25E | %C%> %Y", IP &QueryFormatDef, NULL,
127 "printf-like format string for the query menu (address book)"
128 },
129
130 { "sort_alias", DT_SYNONYM, IP "alias_sort", IP "2024-11-19" },
131
132 { NULL },
133 // clang-format on
134};
static const struct Mapping AliasSortMethods[]
Sort methods for email aliases.
Definition config.c:42
static const struct ExpandoDefinition QueryFormatDef[]
Expando definitions.
Definition config.c:88
static const struct ExpandoDefinition AliasFormatDef[]
Expando definitions.
Definition config.c:60
struct ConfigDef AliasVars[]
Config definitions for the alias library.
Definition config.c:112
Alias Expando definitions.
@ 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
Address book sorting functions.
@ 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.
#define IP
Definition set.h:54
@ ED_ALIAS
Alias ED_ALI_ ExpandoDataAlias.
Definition domain.h:35
@ ED_GLOBAL
Global ED_GLO_ ExpandoDataGlobal.
Definition domain.h:44
Parse Expando string.
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() -.
Convenience wrapper for the library headers.
Definition of a format string.
Definition definition.h:43
Mapping between user-readable string and a constant.
Definition mapping.h:33
#define D_STRING_COMMAND
A command.
Definition types.h:99
#define D_PATH_FILE
Path is a file.
Definition types.h:104
@ 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:120
#define D_NOT_EMPTY
Empty strings are not allowed.
Definition types.h:80
@ 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