391 buf_printf(err,
_(
"Command '%s' can only be used with bool/quad variables"),
"toggle");
490 if (*line->
dptr ==
'?')
508 else if (*line->
dptr ==
'&')
517 buf_printf(err,
_(
"Can't use 'inv', 'no', '&' or '?' with the '%s' command"),
532 bool bool_or_quad =
false;
533 bool invertible =
false;
535 bool increment =
false;
536 bool decrement =
false;
548 if (*line->
dptr ==
'?')
552 buf_printf(err,
_(
"Can't use a prefix when querying a variable"));
556 if (reset || unset || inv)
558 buf_printf(err,
_(
"Can't query option with the '%s' command"), cmd->
name);
565 else if ((*line->
dptr ==
'+') || (*line->
dptr ==
'-'))
569 buf_printf(err,
_(
"Can't use prefix when incrementing or decrementing a variable"));
573 if (reset || unset || inv)
575 buf_printf(err,
_(
"Can't set option with the '%s' command"), cmd->
name);
578 if (*line->
dptr ==
'+')
584 if (*line->
dptr ==
'=')
591 buf_printf(err,
_(
"'+' and '-' must be followed by '='"));
595 else if (*line->
dptr ==
'=')
599 buf_printf(err,
_(
"Can't use prefix when setting a variable"));
603 if (reset || unset || inv)
605 buf_printf(err,
_(
"Can't set option with the '%s' command"), cmd->
name);
613 if (!invertible && (inv || (unset && prefix)))
617 buf_printf(err,
_(
"Prefixes 'no' and 'inv' may only be used with bool/quad/number variables"));
621 buf_printf(err,
_(
"Command '%s' can only be used with bool/quad/number variables"),
631 ASSERT(!inv || !( unset || reset || query || equals ));
632 ASSERT(!unset || !(inv || reset || query || equals ));
633 ASSERT(!reset || !(inv || unset || query || equals ));
634 ASSERT(!query || !(inv || unset || reset || equals ));
635 ASSERT(!equals || !(inv || unset || reset || query || prefix));
637 ASSERT(!(increment && decrement));
638 ASSERT(!(increment || decrement) || equals);
639 ASSERT(!inv || invertible);
#define ARRAY_FOREACH(elem, head)
Iterate over all elements of the array.
#define ARRAY_FREE(head)
Release all memory.
int bool_he_toggle(struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Toggle the value of a bool.
int buf_printf(struct Buffer *buf, const char *fmt,...)
Format a string overwriting a Buffer.
void buf_reset(struct Buffer *buf)
Reset an existing Buffer.
bool buf_is_empty(const struct Buffer *buf)
Is the Buffer empty?
size_t buf_addch(struct Buffer *buf, char c)
Add a single character to a Buffer.
size_t buf_addstr(struct Buffer *buf, const char *s)
Add a string to a Buffer.
size_t buf_strcpy(struct Buffer *buf, const char *s)
Copy a string into a Buffer.
size_t buf_copy(struct Buffer *dst, const struct Buffer *src)
Copy a Buffer's contents to another Buffer.
static const char * buf_string(const struct Buffer *buf)
Convert a buffer to a const char * "string".
CommandResult
Error codes for command_t parse functions.
@ MUTT_CMD_SUCCESS
Success: Command worked.
@ MUTT_CMD_ERROR
Error: Can't help the user.
@ MUTT_CMD_WARNING
Warning: Help given to the user.
size_t pretty_var(const char *str, struct Buffer *buf)
Escape and stringify a config item value.
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.
#define CSR_ERR_CODE
Problem with the code.
#define CSR_RESULT(x)
Extract the result code from CSR_* flags.
bool StartupComplete
When the config has been read.
#define CSR_SUCCESS
Action completed successfully.
Convenience wrapper for the core headers.
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() -.
#define mutt_warning(...)
Convenience wrapper for the library headers.
bool mutt_path_tilde(struct Buffer *path, const char *homedir)
Expand '~' in a path.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
size_t mutt_str_startswith(const char *str, const char *prefix)
Check whether a string starts with a prefix.
Many unsorted constants and some structs.
void pretty_mailbox(struct Buffer *buf)
Shorten a mailbox path using '~' or '='.
void expand_path(struct Buffer *buf, bool regex)
Create the canonical path.
Some miscellaneous functions.
int number_he_toggle(struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Toggle the value of a number (value <-> 0)
enum CommandResult set_dump(enum GetElemListFlags flags, struct Buffer *err)
Dump list of config variables into a file/pager.
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.
void command_set_expand_value(int type, struct Buffer *value)
Expand special characters.
enum CommandResult command_set_decrement(struct Buffer *name, struct Buffer *value, struct Buffer *err)
Decrement a variable by a value.
enum CommandResult command_set_toggle(struct Buffer *name, struct Buffer *err)
Toggle a boolean, quad, or number variable.
enum CommandResult command_set_reset(struct Buffer *name, struct Buffer *err)
Reset a variable.
enum CommandResult command_set_query(struct Buffer *name, struct Buffer *err)
Query a variable.
enum CommandResult command_set_unset(struct Buffer *name, struct Buffer *err)
Unset a variable.
enum CommandResult command_set_set(struct Buffer *name, struct Buffer *value, struct Buffer *err)
Set a variable to the given value.
struct Buffer * buf_pool_get(void)
Get a Buffer from the pool.
void buf_pool_release(struct Buffer **ptr)
Return a Buffer to the pool.
int quad_he_toggle(struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Toggle the value of a quad.
String manipulation buffer.
char * dptr
Current read/write position.
char * data
Pointer to data.
const char * name
Name of the Command.
enum CommandId id
ID of the Command.
const char * name
User-visible name.
uint32_t type
Variable type, e.g. DT_STRING.
struct ConfigSet * cs
Parent ConfigSet.
The item stored in a Hash Table.
union HashKey key
Key representing the data.
int type
Type of data stored in Hash Table, e.g. DT_STRING.
Container for Accounts, Notifications.
char * home_dir
User's home directory.
struct ConfigSubset * sub
Inherited config items.
Context for config parsing (history/backtrace)
Detailed error information from config parsing.
struct Buffer * message
Error message.
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.
int cs_subset_he_string_get(const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *result)
Get a config item as a string.
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.
int cs_subset_he_delete(const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Delete config item from a config.
int cs_subset_he_reset(const struct ConfigSubset *sub, struct HashElem *he, struct Buffer *err)
Reset a config item to its initial value.
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.
struct HashElemArray get_elem_list(struct ConfigSet *cs, enum GetElemListFlags flags)
Create a sorted list of all config items.
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.
struct HashElem * cs_subset_lookup(const struct ConfigSubset *sub, const char *name)
Find an inherited config item.
@ GEL_CHANGED_CONFIG
Only config that has been changed.
@ GEL_ALL_CONFIG
All the normal config (no synonyms or deprecated)
#define CONFIG_TYPE(t)
Extract the type from the flags.
#define IS_MAILBOX(flags)
#define D_INTERNAL_DEPRECATED
Config item shouldn't be used any more.
#define D_PATH_DIR
Path is a directory.
#define D_PATH_FILE
Path is a file.
@ DT_QUAD
quad-option (no/yes/ask-no/ask-yes)
@ DT_MYVAR
a user-defined variable (my_foo)
@ DT_PATH
a path to a file/directory
#define IS_COMMAND(flags)
const char * strkey
String key.