NeoMutt  2024-04-16-36-g75b6fb
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 <stddef.h>
33#include <stdbool.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 { "pager", DT_STRING|D_STRING_COMMAND, 0, 0, NULL,
55 "External command for viewing messages, or empty to use NeoMutt's"
56 },
57 { "pager_context", DT_NUMBER|D_INTEGER_NOT_NEGATIVE, 0, 0, NULL,
58 "Number of lines of overlap when changing pages in the pager"
59 },
60 { "pager_format", DT_EXPANDO, IP "-%Z- %C/%m: %-20.20n %s%* -- (%P)", IP &IndexFormatDef, NULL,
61 "printf-like format string for the pager's status bar"
62 },
63 { "pager_index_lines", DT_NUMBER|D_INTEGER_NOT_NEGATIVE, 0, 0, NULL,
64 "Number of index lines to display above the pager"
65 },
66 { "pager_read_delay", DT_NUMBER|D_INTEGER_NOT_NEGATIVE, 0, 0, NULL,
67 "Number of seconds to wait before marking a message read"
68 },
69 { "pager_skip_quoted_context", DT_NUMBER|D_INTEGER_NOT_NEGATIVE, 0, 0, NULL,
70 "Lines of context to show when skipping quoted text"
71 },
72 { "pager_stop", DT_BOOL, false, 0, NULL,
73 "Don't automatically open the next message when at the end of a message"
74 },
75 { "prompt_after", DT_BOOL, true, 0, NULL,
76 "Pause after running an external pager"
77 },
78 { "search_context", DT_NUMBER|D_INTEGER_NOT_NEGATIVE, 0, 0, NULL,
79 "Context to display around search matches"
80 },
81 { "smart_wrap", DT_BOOL, true, 0, NULL,
82 "Wrap text at word boundaries"
83 },
84 { "smileys", DT_REGEX, IP "(>From )|(:[-^]?[][)(><}{|/DP])", 0, NULL,
85 "Regex to match smileys to prevent mistakes when quoting text"
86 },
87 { "tilde", DT_BOOL, false, 0, NULL,
88 "Display '~' in the pager after the end of the email"
89 },
90 { "toggle_quoted_show_levels", DT_NUMBER|D_INTEGER_NOT_NEGATIVE, 0, 0, NULL,
91 "Number of quote levels to show with toggle-quoted"
92 },
93
94 { "skip_quoted_offset", DT_SYNONYM, IP "pager_skip_quoted_context", IP "2021-06-18" },
95
96 { NULL },
97 // clang-format on
98};
99
108const char *pager_get_pager(struct ConfigSubset *sub)
109{
110 const char *c_pager = cs_subset_string(sub, "pager");
111 if (!c_pager || mutt_str_equal(c_pager, "builtin"))
112 return NULL;
113
114 return c_pager;
115}
116
121{
123}
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition: helpers.c:292
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:120
Convenience wrapper for the library headers.
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition: string.c:654
const char * pager_get_pager(struct ConfigSubset *sub)
Get the value of $pager.
Definition: config.c:108
static struct ConfigDef PagerVars[]
Config definitions for the Pager.
Definition: config.c:43
const struct ExpandoDefinition IndexFormatDef[]
Expando definitions.
Definition: mutt_config.c:295
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:52
#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