NeoMutt  2024-11-14-138-ge5ca67
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
38extern const struct ExpandoDefinition IndexFormatDef[];
39
43static struct ConfigDef PagerVars[] = {
44 // clang-format off
45 { "allow_ansi", DT_BOOL, false, 0, NULL,
46 "Allow ANSI color codes in rich text messages"
47 },
48 { "display_filter", DT_STRING|D_STRING_COMMAND, 0, 0, NULL,
49 "External command to pre-process an email before display"
50 },
51 { "header_color_partial", DT_BOOL, false, 0, NULL,
52 "Only color the part of the header matching the regex"
53 },
54 { "markers", DT_BOOL, true, 0, NULL,
55 "Display a '+' at the beginning of wrapped lines in the pager"
56 },
57 { "pager", DT_STRING|D_STRING_COMMAND, 0, 0, NULL,
58 "External command for viewing messages, or empty to use NeoMutt's"
59 },
60 { "pager_context", DT_NUMBER|D_INTEGER_NOT_NEGATIVE, 0, 0, NULL,
61 "Number of lines of overlap when changing pages in the pager"
62 },
63 { "pager_format", DT_EXPANDO, IP "-%Z- %C/%m: %-20.20n %s%* -- (%P)", IP &IndexFormatDef, NULL,
64 "printf-like format string for the pager's status bar"
65 },
66 { "pager_index_lines", DT_NUMBER|D_INTEGER_NOT_NEGATIVE, 0, 0, NULL,
67 "Number of index lines to display above the pager"
68 },
69 { "pager_read_delay", DT_NUMBER|D_INTEGER_NOT_NEGATIVE, 0, 0, NULL,
70 "Number of seconds to wait before marking a message read"
71 },
72 { "pager_skip_quoted_context", DT_NUMBER|D_INTEGER_NOT_NEGATIVE, 0, 0, NULL,
73 "Lines of context to show when skipping quoted text"
74 },
75 { "pager_stop", DT_BOOL, false, 0, NULL,
76 "Don't automatically open the next message when at the end of a message"
77 },
78 { "prompt_after", DT_BOOL, true, 0, NULL,
79 "Pause after running an external pager"
80 },
81 { "search_context", DT_NUMBER|D_INTEGER_NOT_NEGATIVE, 0, 0, NULL,
82 "Context to display around search matches"
83 },
84 { "smart_wrap", DT_BOOL, true, 0, NULL,
85 "Wrap text at word boundaries"
86 },
87 { "smileys", DT_REGEX, IP "(>From )|(:[-^]?[][)(><}{|/DP])", 0, NULL,
88 "Regex to match smileys to prevent mistakes when quoting text"
89 },
90 { "tilde", DT_BOOL, false, 0, NULL,
91 "Display '~' in the pager after the end of the email"
92 },
93 { "toggle_quoted_show_levels", DT_NUMBER|D_INTEGER_NOT_NEGATIVE, 0, 0, NULL,
94 "Number of quote levels to show with toggle-quoted"
95 },
96
97 { "skip_quoted_offset", DT_SYNONYM, IP "pager_skip_quoted_context", IP "2021-06-18" },
98
99 { NULL },
100 // clang-format on
101};
102
111const char *pager_get_pager(struct ConfigSubset *sub)
112{
113 const char *c_pager = cs_subset_string(sub, "pager");
114 if (!c_pager || mutt_str_equal(c_pager, "builtin"))
115 return NULL;
116
117 return c_pager;
118}
119
124{
126}
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition: helpers.c:291
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:281
#define IP
Definition: set.h:54
Parse Expando string.
bool config_init_pager(struct ConfigSet *cs)
Register pager config variables - Implements module_init_config_t -.
Definition: config.c:123
Convenience wrapper for the library headers.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:660
const char * pager_get_pager(struct ConfigSubset *sub)
Get the value of $pager.
Definition: config.c:111
static struct ConfigDef PagerVars[]
Config definitions for the Pager.
Definition: config.c:43
const struct ExpandoDefinition IndexFormatDef[]
Expando definitions.
Definition: mutt_config.c:314
Definition: set.h:64
Container for lots of config items.
Definition: set.h:252
A set of inherited config items.
Definition: subset.h:47
Definition of a format string.
Definition: definition.h:44
#define D_STRING_COMMAND
A command.
Definition: types.h:99
@ DT_NUMBER
a number
Definition: types.h:39
@ DT_BOOL
boolean option
Definition: types.h:32
@ DT_SYNONYM
synonym for another variable
Definition: types.h:46
@ DT_STRING
a string
Definition: types.h:45
@ DT_EXPANDO
an expando
Definition: types.h:34
@ DT_REGEX
regular expressions
Definition: types.h:42
#define D_INTEGER_NOT_NEGATIVE
Negative numbers are not allowed.
Definition: types.h:101