NeoMutt  2025-12-11-694-ga89709
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
set.c
Go to the documentation of this file.
1
24
30
31#include "config.h"
32#include <stdbool.h>
33#include <stdio.h>
34#include "mutt/lib.h"
35#include "config/lib.h"
36#include "core/lib.h"
37#include "mutt.h"
38#include "set.h"
39#include "dump.h"
40#include "extract.h"
41#include "muttlib.h"
42#include "perror.h"
43
59void command_set_expand_value(int type, struct Buffer *value)
60{
61 ASSERT(value);
62 if (CONFIG_TYPE(type) == DT_PATH)
63 {
64 if (type & (D_PATH_DIR | D_PATH_FILE))
65 expand_path(value, false);
66 else
68 }
69 else if (IS_MAILBOX(type))
70 {
71 expand_path(value, false);
72 }
73 else if (IS_COMMAND(type))
74 {
75 struct Buffer *scratch = buf_pool_get();
76 buf_copy(scratch, value);
77
78 if (!mutt_str_equal(value->data, "builtin"))
79 {
80 expand_path(scratch, false);
81 }
82 buf_reset(value);
83 buf_addstr(value, buf_string(scratch));
84 buf_pool_release(&scratch);
85 }
86}
87
100enum CommandResult command_set_set(struct Buffer *name, struct Buffer *value,
101 struct Buffer *err)
102{
103 ASSERT(name);
104 ASSERT(value);
105 struct HashElem *he = cs_subset_lookup(NeoMutt->sub, name->data);
106 if (!he)
107 {
108 // In case it is a my_var, we have to create it
109 if (mutt_str_startswith(name->data, "my_"))
110 {
111 struct ConfigDef my_cdef = { 0 };
112 my_cdef.name = name->data;
113 my_cdef.type = DT_MYVAR;
114 he = cs_create_variable(NeoMutt->sub->cs, &my_cdef, err);
115 if (!he)
116 return MUTT_CMD_ERROR; // LCOV_EXCL_LINE
117 }
118 else
119 {
120 buf_printf(err, _("Unknown option %s"), name->data);
121 return MUTT_CMD_ERROR;
122 }
123 }
124
125 if (he->type & D_INTERNAL_DEPRECATED)
126 {
127 mutt_warning(_("Option %s is deprecated"), name->data);
128 return MUTT_CMD_SUCCESS;
129 }
130 int rc = CSR_ERR_CODE;
131
132 if (CONFIG_TYPE(he->type) == DT_MYVAR)
133 {
134 // my variables do not expand their value
135 rc = cs_subset_he_string_set(NeoMutt->sub, he, value->data, err);
136 }
137 else
138 {
139 command_set_expand_value(he->type, value);
140 rc = cs_subset_he_string_set(NeoMutt->sub, he, value->data, err);
141 }
142 if (CSR_RESULT(rc) != CSR_SUCCESS)
143 {
144 if (rc & CSR_INV_WARNING)
145 return MUTT_CMD_WARNING;
146 return MUTT_CMD_ERROR;
147 }
148
149 return MUTT_CMD_SUCCESS;
150}
151
165 struct Buffer *value, struct Buffer *err)
166{
167 ASSERT(name);
168 ASSERT(value);
169 struct HashElem *he = cs_subset_lookup(NeoMutt->sub, name->data);
170 if (!he)
171 {
172 // In case it is a my_var, we have to create it
173 if (mutt_str_startswith(name->data, "my_"))
174 {
175 struct ConfigDef my_cdef = { 0 };
176 my_cdef.name = name->data;
177 my_cdef.type = DT_MYVAR;
178 he = cs_create_variable(NeoMutt->sub->cs, &my_cdef, err);
179 if (!he)
180 return MUTT_CMD_ERROR; // LCOV_EXCL_LINE
181 }
182 else
183 {
184 buf_printf(err, _("Unknown option %s"), name->data);
185 return MUTT_CMD_ERROR;
186 }
187 }
188
189 if (he->type & D_INTERNAL_DEPRECATED)
190 {
191 mutt_warning(_("Option %s is deprecated"), name->data);
192 return MUTT_CMD_SUCCESS;
193 }
194
195 int rc = CSR_ERR_CODE;
196
197 if (CONFIG_TYPE(he->type) == DT_MYVAR)
198 {
199 // my variables do not expand their value
200 rc = cs_subset_he_string_plus_equals(NeoMutt->sub, he, value->data, err);
201 }
202 else
203 {
204 command_set_expand_value(he->type, value);
205 rc = cs_subset_he_string_plus_equals(NeoMutt->sub, he, value->data, err);
206 }
207 if (CSR_RESULT(rc) != CSR_SUCCESS)
208 return MUTT_CMD_ERROR;
209
210 return MUTT_CMD_SUCCESS;
211}
212
226 struct Buffer *value, struct Buffer *err)
227{
228 ASSERT(name);
229 ASSERT(value);
230 struct HashElem *he = cs_subset_lookup(NeoMutt->sub, name->data);
231 if (!he)
232 {
233 buf_printf(err, _("Unknown option %s"), name->data);
234 return MUTT_CMD_ERROR;
235 }
236
237 if (he->type & D_INTERNAL_DEPRECATED)
238 {
239 mutt_warning(_("Option %s is deprecated"), name->data);
240 return MUTT_CMD_SUCCESS;
241 }
242
243 command_set_expand_value(he->type, value);
244 int rc = cs_subset_he_string_minus_equals(NeoMutt->sub, he, value->data, err);
245 if (CSR_RESULT(rc) != CSR_SUCCESS)
246 return MUTT_CMD_ERROR;
247
248 return MUTT_CMD_SUCCESS;
249}
250
261enum CommandResult command_set_unset(struct Buffer *name, struct Buffer *err)
262{
263 ASSERT(name);
264 struct HashElem *he = cs_subset_lookup(NeoMutt->sub, name->data);
265 if (!he)
266 {
267 buf_printf(err, _("Unknown option %s"), name->data);
268 return MUTT_CMD_ERROR;
269 }
270
271 if (he->type & D_INTERNAL_DEPRECATED)
272 {
273 mutt_warning(_("Option %s is deprecated"), name->data);
274 return MUTT_CMD_SUCCESS;
275 }
276
277 int rc = CSR_ERR_CODE;
278 if (CONFIG_TYPE(he->type) == DT_MYVAR)
279 {
280 rc = cs_subset_he_delete(NeoMutt->sub, he, err);
281 }
282 else if ((CONFIG_TYPE(he->type) == DT_BOOL) || (CONFIG_TYPE(he->type) == DT_QUAD))
283 {
284 rc = cs_subset_he_native_set(NeoMutt->sub, he, false, err);
285 }
286 else
287 {
288 rc = cs_subset_he_string_set(NeoMutt->sub, he, NULL, err);
289 }
290 if (CSR_RESULT(rc) != CSR_SUCCESS)
291 return MUTT_CMD_ERROR; // LCOV_EXCL_LINE
292
293 return MUTT_CMD_SUCCESS;
294}
295
306enum CommandResult command_set_reset(struct Buffer *name, struct Buffer *err)
307{
308 ASSERT(name);
309 // Handle special "reset all" syntax
310 if (mutt_str_equal(name->data, "all"))
311 {
312 struct HashElemArray hea = get_elem_list(NeoMutt->sub->cs, GEL_ALL_CONFIG);
313 struct HashElem **hep = NULL;
314 ARRAY_FOREACH(hep, &hea)
315 {
316 struct HashElem *he = *hep;
317 if (CONFIG_TYPE(he->type) == DT_MYVAR)
319 else
320 cs_subset_he_reset(NeoMutt->sub, he, NULL);
321 }
322
323 ARRAY_FREE(&hea);
324 return MUTT_CMD_SUCCESS;
325 }
326
327 struct HashElem *he = cs_subset_lookup(NeoMutt->sub, name->data);
328 if (!he)
329 {
330 buf_printf(err, _("Unknown option %s"), name->data);
331 return MUTT_CMD_ERROR;
332 }
333
334 if (he->type & D_INTERNAL_DEPRECATED)
335 {
336 mutt_warning(_("Option %s is deprecated"), name->data);
337 return MUTT_CMD_SUCCESS;
338 }
339
340 int rc = CSR_ERR_CODE;
341 if (CONFIG_TYPE(he->type) == DT_MYVAR)
342 {
343 rc = cs_subset_he_delete(NeoMutt->sub, he, err);
344 }
345 else
346 {
347 rc = cs_subset_he_reset(NeoMutt->sub, he, err);
348 }
349 if (CSR_RESULT(rc) != CSR_SUCCESS)
350 return MUTT_CMD_ERROR; // LCOV_EXCL_LINE
351
352 return MUTT_CMD_SUCCESS;
353}
354
365enum CommandResult command_set_toggle(struct Buffer *name, struct Buffer *err)
366{
367 ASSERT(name);
368 struct HashElem *he = cs_subset_lookup(NeoMutt->sub, name->data);
369 if (!he)
370 {
371 buf_printf(err, _("Unknown option %s"), name->data);
372 return MUTT_CMD_ERROR;
373 }
374
375 if (he->type & D_INTERNAL_DEPRECATED)
376 {
377 mutt_warning(_("Option %s is deprecated"), name->data);
378 return MUTT_CMD_SUCCESS;
379 }
380
381 if (CONFIG_TYPE(he->type) == DT_BOOL)
382 {
383 bool_he_toggle(NeoMutt->sub, he, err);
384 }
385 else if (CONFIG_TYPE(he->type) == DT_QUAD)
386 {
387 quad_he_toggle(NeoMutt->sub, he, err);
388 }
389 else if (CONFIG_TYPE(he->type) == DT_NUMBER)
390 {
391 number_he_toggle(NeoMutt->sub, he, err);
392 }
393 else
394 {
395 buf_printf(err, _("Command '%s' can only be used with bool/quad variables"), "toggle");
396 return MUTT_CMD_ERROR;
397 }
398 return MUTT_CMD_SUCCESS;
399}
400
411enum CommandResult command_set_query(struct Buffer *name, struct Buffer *err)
412{
413 ASSERT(name);
414 // In the interactive case (outside of the initial parsing of neomuttrc) we
415 // support additional syntax: "set" (no arguments) and "set all".
416 // If not in interactive mode, we recognise them but do nothing.
417
418 // Handle "set" (no arguments), i.e. show list of changed variables.
419 if (buf_is_empty(name))
420 {
421 if (StartupComplete)
422 return set_dump(GEL_CHANGED_CONFIG, err);
423 else
424 return MUTT_CMD_SUCCESS;
425 }
426 // Handle special "set all" syntax
427 if (mutt_str_equal(name->data, "all"))
428 {
429 if (StartupComplete)
430 return set_dump(GEL_ALL_CONFIG, err);
431 else
432 return MUTT_CMD_SUCCESS;
433 }
434
435 struct HashElem *he = cs_subset_lookup(NeoMutt->sub, name->data);
436 if (!he)
437 {
438 buf_printf(err, _("Unknown option %s"), name->data);
439 return MUTT_CMD_ERROR;
440 }
441
442 if (he->type & D_INTERNAL_DEPRECATED)
443 {
444 mutt_warning(_("Option %s is deprecated"), name->data);
445 return MUTT_CMD_SUCCESS;
446 }
447
448 buf_addstr(err, name->data);
449 buf_addch(err, '=');
450 struct Buffer *value = buf_pool_get();
451 int rc = cs_subset_he_string_get(NeoMutt->sub, he, value);
452 if (CSR_RESULT(rc) != CSR_SUCCESS)
453 {
454 // LCOV_EXCL_START
455 buf_reset(err);
456 buf_addstr(err, value->data);
457 buf_pool_release(&value);
458 return MUTT_CMD_ERROR;
459 // LCOV_EXCL_STOP
460 }
461 if (CONFIG_TYPE(he->type) == DT_PATH)
462 pretty_mailbox(value);
463
464 const int type = CONFIG_TYPE(he->type);
465 if ((type != DT_BOOL) && (type != DT_NUMBER) && (type != DT_LONG) &&
466 (type != DT_QUAD) && (type != DT_ENUM) && (type != DT_SORT))
467 {
468 pretty_var(value->data, err);
469 }
470 else
471 {
472 buf_addstr(err, value->data);
473 }
474 buf_pool_release(&value);
475
476 return MUTT_CMD_SUCCESS;
477}
478
488enum CommandResult parse_set(const struct Command *cmd, struct Buffer *line,
489 const struct ParseContext *pc, struct ParseError *pe)
490{
491 struct Buffer *err = pe->message;
492
493 struct Buffer *token = buf_pool_get();
495
496 do
497 {
498 bool prefix = false;
499 bool query = false;
500 bool inv = (cmd->id == CMD_TOGGLE);
501 bool reset = (cmd->id == CMD_RESET);
502 bool unset = (cmd->id == CMD_UNSET);
503
504 if (*line->dptr == '?')
505 {
506 prefix = true;
507 query = true;
508 line->dptr++;
509 }
510 else if (mutt_str_startswith(line->dptr, "no"))
511 {
512 prefix = true;
513 unset = !unset;
514 line->dptr += 2;
515 }
516 else if (mutt_str_startswith(line->dptr, "inv"))
517 {
518 prefix = true;
519 inv = !inv;
520 line->dptr += 3;
521 }
522 else if (*line->dptr == '&')
523 {
524 prefix = true;
525 reset = true;
526 line->dptr++;
527 }
528
529 if (prefix && (cmd->id != CMD_SET))
530 {
531 buf_printf(err, _("Can't use 'inv', 'no', '&' or '?' with the '%s' command"),
532 cmd->name);
533 goto done;
534 }
535
536 // get the variable name. Note that token might be empty if no additional
537 // argument was given.
538 int ret = parse_extract_token(token, line,
540 if (ret == -1)
541 {
542 buf_pool_release(&token);
543 return MUTT_CMD_ERROR;
544 }
545
546 bool bool_or_quad = false;
547 bool invertible = false;
548 bool equals = false;
549 bool increment = false;
550 bool decrement = false;
551
552 struct HashElem *he = cs_subset_lookup(NeoMutt->sub, buf_string(token));
553 if (he)
554 {
555 // Use the correct name if a synonym is used
556 buf_strcpy(token, he->key.strkey);
557 bool_or_quad = ((CONFIG_TYPE(he->type) == DT_BOOL) ||
558 (CONFIG_TYPE(he->type) == DT_QUAD));
559 invertible = (bool_or_quad || (CONFIG_TYPE(he->type) == DT_NUMBER));
560 }
561
562 if (*line->dptr == '?')
563 {
564 if (prefix)
565 {
566 buf_printf(err, _("Can't use a prefix when querying a variable"));
567 goto done;
568 }
569
570 if (reset || unset || inv)
571 {
572 buf_printf(err, _("Can't query option with the '%s' command"), cmd->name);
573 goto done;
574 }
575
576 query = true;
577 line->dptr++;
578 }
579 else if ((*line->dptr == '+') || (*line->dptr == '-'))
580 {
581 if (prefix)
582 {
583 buf_printf(err, _("Can't use prefix when incrementing or decrementing a variable"));
584 goto done;
585 }
586
587 if (reset || unset || inv)
588 {
589 buf_printf(err, _("Can't set option with the '%s' command"), cmd->name);
590 goto done;
591 }
592 if (*line->dptr == '+')
593 increment = true;
594 else
595 decrement = true;
596
597 line->dptr++;
598 if (*line->dptr == '=')
599 {
600 equals = true;
601 line->dptr++;
602 }
603 else
604 {
605 buf_printf(err, _("'+' and '-' must be followed by '='"));
606 goto done;
607 }
608 }
609 else if (*line->dptr == '=')
610 {
611 if (prefix)
612 {
613 buf_printf(err, _("Can't use prefix when setting a variable"));
614 goto done;
615 }
616
617 if (reset || unset || inv)
618 {
619 buf_printf(err, _("Can't set option with the '%s' command"), cmd->name);
620 goto done;
621 }
622
623 equals = true;
624 line->dptr++;
625 }
626
627 if (!invertible && (inv || (unset && prefix)))
628 {
629 if (cmd->id == CMD_SET)
630 {
631 buf_printf(err, _("Prefixes 'no' and 'inv' may only be used with bool/quad/number variables"));
632 }
633 else
634 {
635 buf_printf(err, _("Command '%s' can only be used with bool/quad/number variables"),
636 cmd->name);
637 }
638 goto done;
639 }
640
641 // sanity checks for the above
642 // Each of inv, unset reset, query, equals implies that the others are not set.
643 // If none of them are set, then we are dealing with a "set foo" command.
644 // clang-format off
645 ASSERT(!inv || !( unset || reset || query || equals ));
646 ASSERT(!unset || !(inv || reset || query || equals ));
647 ASSERT(!reset || !(inv || unset || query || equals ));
648 ASSERT(!query || !(inv || unset || reset || equals ));
649 ASSERT(!equals || !(inv || unset || reset || query || prefix));
650 // clang-format on
651 ASSERT(!(increment && decrement)); // only one of increment or decrement is set
652 ASSERT(!(increment || decrement) || equals); // increment/decrement implies equals
653 ASSERT(!inv || invertible); // inv (aka toggle) implies bool or quad
654
655 rc = MUTT_CMD_ERROR;
656 if (query)
657 {
658 rc = command_set_query(token, err);
659 goto done; // We can only do one query even if multiple config names are given
660 }
661 else if (reset)
662 {
663 rc = command_set_reset(token, err);
664 }
665 else if (unset)
666 {
667 rc = command_set_unset(token, err);
668 }
669 else if (inv)
670 {
671 rc = command_set_toggle(token, err);
672 }
673 else if (equals)
674 {
675 // These three cases all need a value, since 'increment'/'decrement'
676 // implies 'equals', we can group them in this single case guarded by
677 // 'equals'.
678 struct Buffer *value = buf_pool_get();
680 if (increment)
681 rc = command_set_increment(token, value, err);
682 else if (decrement)
683 rc = command_set_decrement(token, value, err);
684 else
685 rc = command_set_set(token, value, err);
686 buf_pool_release(&value);
687 }
688 else
689 {
690 // This is the "set foo" case which has different meanings depending on
691 // the type of the config variable
692 if (bool_or_quad)
693 {
694 struct Buffer *yes = buf_pool_get();
695 buf_addstr(yes, "yes");
696 rc = command_set_set(token, yes, err);
697 buf_pool_release(&yes);
698 }
699 else
700 {
701 rc = command_set_query(token, err);
702 goto done; // We can only do one query even if multiple config names are given
703 }
704 }
705 // Short circuit (i.e. skipping further config variable names) if the action on
706 // the current variable failed.
707 if (rc != MUTT_CMD_SUCCESS)
708 goto done;
709 } while (MoreArgs(line));
710
711 rc = MUTT_CMD_SUCCESS;
712
713done:
714 buf_pool_release(&token);
715 return rc;
716}
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
Definition array.h:223
#define ARRAY_FREE(head)
Release all memory.
Definition array.h:209
int bool_he_toggle(struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Toggle the value of a bool.
Definition bool.c:203
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
Definition buffer.c:161
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
Definition buffer.c:76
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
Definition buffer.c:291
size_t buf_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
Definition buffer.c:241
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
Definition buffer.c:226
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
Definition buffer.c:395
size_t buf_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
Definition buffer.c:601
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
Definition buffer.h:96
@ CMD_RESET
:reset
Definition command.h:103
@ CMD_TOGGLE
:toggle
Definition command.h:122
@ CMD_UNSET
:unset
Definition command.h:142
@ CMD_SET
:set
Definition command.h:108
CommandResult
Error codes for command_t parse functions.
Definition command.h:37
@ MUTT_CMD_SUCCESS
Success: Command worked.
Definition command.h:40
@ MUTT_CMD_ERROR
Error: Can't help the user.
Definition command.h:38
@ MUTT_CMD_WARNING
Warning: Help given to the user.
Definition command.h:39
size_t pretty_var(const char *str, struct Buffer *buf)
Escape and stringify a config item value.
Definition dump.c:87
Convenience wrapper for the config headers.
struct HashElem * cs_create_variable(const struct ConfigSet *cs, struct ConfigDef *cdef, struct Buffer *err)
Create and register one config item.
Definition set.c:327
#define CSR_INV_WARNING
Report as a warning, not an error.
Definition set.h:48
#define CSR_ERR_CODE
Problem with the code.
Definition set.h:34
#define CSR_RESULT(x)
Extract the result code from CSR_* flags.
Definition set.h:53
bool StartupComplete
When the config has been read.
Definition address.c:11
#define CSR_SUCCESS
Action completed successfully.
Definition set.h:33
Convenience wrapper for the core headers.
int parse_extract_token(struct Buffer *dest, struct Buffer *line, TokenFlags flags)
Extract one token from a string.
Definition extract.c:49
Text parser.
#define TOKEN_BACKTICK_VARS
Expand variables within backticks.
Definition extract.h:53
#define TOKEN_EQUAL
Treat '=' as a special.
Definition extract.h:46
#define TOKEN_PLUS
Treat '+' as a special.
Definition extract.h:56
#define MoreArgs(buf)
Definition extract.h:31
#define TOKEN_MINUS
Treat '-' as a special.
Definition extract.h:57
#define TOKEN_QUESTION
Treat '?' as a special.
Definition extract.h:55
enum CommandResult parse_set(const struct Command *cmd, struct Buffer *line, const struct ParseContext *pc, struct ParseError *pe)
Parse the 'set' family of commands - Implements Command::parse() -.
Definition set.c:488
#define mutt_warning(...)
Definition logging2.h:92
Convenience wrapper for the library headers.
#define _(a)
Definition message.h:28
bool mutt_path_tilde(struct Buffer *path, const char *homedir)
Expand '~' in a path.
Definition path.c:194
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition string.c:665
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
Definition string.c:234
Many unsorted constants and some structs.
void pretty_mailbox(struct Buffer *buf)
Shorten a mailbox path using '~' or '='.
Definition muttlib.c:428
void expand_path(struct Buffer *buf, bool regex)
Create the canonical path.
Definition muttlib.c:122
Some miscellaneous functions.
int number_he_toggle(struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Toggle the value of a number (value <-> 0)
Definition number.c:307
enum CommandResult set_dump(enum GetElemListFlags flags, struct Buffer *err)
Dump list of config variables into a file/pager.
Definition dump.c:54
Functions to parse commands in a config file.
enum CommandResult command_set_increment(struct Buffer *name, struct Buffer *value, struct Buffer *err)
Increment a variable by a value.
Definition set.c:164
void command_set_expand_value(int type, struct Buffer *value)
Expand special characters.
Definition set.c:59
enum CommandResult command_set_decrement(struct Buffer *name, struct Buffer *value, struct Buffer *err)
Decrement a variable by a value.
Definition set.c:225
enum CommandResult command_set_toggle(struct Buffer *name, struct Buffer *err)
Toggle a boolean, quad, or number variable.
Definition set.c:365
enum CommandResult command_set_reset(struct Buffer *name, struct Buffer *err)
Reset a variable.
Definition set.c:306
enum CommandResult command_set_query(struct Buffer *name, struct Buffer *err)
Query a variable.
Definition set.c:411
enum CommandResult command_set_unset(struct Buffer *name, struct Buffer *err)
Unset a variable.
Definition set.c:261
enum CommandResult command_set_set(struct Buffer *name, struct Buffer *value, struct Buffer *err)
Set a variable to the given value.
Definition set.c:100
Parse the 'set' command.
Parse Errors.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
Definition pool.c:91
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
Definition pool.c:111
int quad_he_toggle(struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Toggle the value of a quad.
Definition quad.c:234
#define ASSERT(COND)
Definition signal2.h:59
String manipulation buffer.
Definition buffer.h:36
char * dptr
Current read/write position.
Definition buffer.h:38
char * data
Pointer to data.
Definition buffer.h:37
const char * name
Name of the Command.
Definition command.h:159
enum CommandId id
ID of the Command.
Definition command.h:160
const char * name
User-visible name.
Definition set.h:66
uint32_t type
Variable type, e.g. DT_STRING.
Definition set.h:67
struct ConfigSet * cs
Parent ConfigSet.
Definition subset.h:50
The item stored in a Hash Table.
Definition hash.h:44
union HashKey key
Key representing the data.
Definition hash.h:46
int type
Type of data stored in Hash Table, e.g. DT_STRING.
Definition hash.h:45
Container for Accounts, Notifications.
Definition neomutt.h:41
char * home_dir
User's home directory.
Definition neomutt.h:56
struct ConfigSubset * sub
Inherited config items.
Definition neomutt.h:49
Context for config parsing (history/backtrace)
Definition pcontext.h:34
Detailed error information from config parsing.
Definition perror.h:34
struct Buffer * message
Error message.
Definition perror.h:35
int cs_subset_he_string_minus_equals(const struct ConfigSubset *sub, struct HashElem *he, const char *value, struct Buffer *err)
Remove from a config item by string.
Definition subset.c:430
int cs_subset_he_string_get(const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *result)
Get a config item as a string.
Definition subset.c:338
int cs_subset_he_native_set(const struct ConfigSubset *sub, struct HashElem *he, intptr_t value, struct Buffer *err)
Natively set the value of a HashElem config item.
Definition subset.c:281
int cs_subset_he_delete(const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Delete config item from a config.
Definition subset.c:451
int cs_subset_he_reset(const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Reset a config item to its initial value.
Definition subset.c:318
int cs_subset_he_string_set(const struct ConfigSubset *sub, struct HashElem *he, const char *value, struct Buffer *err)
Set a config item by string.
Definition subset.c:370
struct HashElemArray get_elem_list(struct ConfigSet *cs, enum GetElemListFlags flags)
Create a sorted list of all config items.
Definition subset.c:81
int cs_subset_he_string_plus_equals(const struct ConfigSubset *sub, struct HashElem *he, const char *value, struct Buffer *err)
Add to a config item by string.
Definition subset.c:408
struct HashElem * cs_subset_lookup(const struct ConfigSubset *sub, const char *name)
Find an inherited config item.
Definition subset.c:193
@ GEL_CHANGED_CONFIG
Only config that has been changed.
Definition subset.h:82
@ GEL_ALL_CONFIG
All the normal config (no synonyms or deprecated)
Definition subset.h:81
#define CONFIG_TYPE(t)
Extract the type from the flags.
Definition types.h:50
#define IS_MAILBOX(flags)
Definition types.h:122
#define D_INTERNAL_DEPRECATED
Config item shouldn't be used any more.
Definition types.h:88
#define D_PATH_DIR
Path is a directory.
Definition types.h:103
#define D_PATH_FILE
Path is a file.
Definition types.h:104
@ DT_NUMBER
a number
Definition types.h:38
@ DT_BOOL
boolean option
Definition types.h:32
@ DT_QUAD
quad-option (no/yes/ask-no/ask-yes)
Definition types.h:40
@ DT_SORT
sorting methods
Definition types.h:43
@ DT_MYVAR
a user-defined variable (my_foo)
Definition types.h:37
@ DT_LONG
a number (long)
Definition types.h:35
@ DT_ENUM
an enumeration
Definition types.h:33
@ DT_PATH
a path to a file/directory
Definition types.h:39
#define IS_COMMAND(flags)
Definition types.h:123
const char * strkey
String key.
Definition hash.h:36