NeoMutt  2025-09-05-55-g97fc89
Teaching an old dog new tricks
DOXYGEN
Loading...
Searching...
No Matches
config.c File Reference

Config used by libpager. More...

#include "config.h"
#include <stdbool.h>
#include <stddef.h>
#include "mutt/lib.h"
#include "config/lib.h"
#include "expando/lib.h"
+ Include dependency graph for config.c:

Go to the source code of this file.

Functions

const char * pager_get_pager (struct ConfigSubset *sub)
 Get the value of $pager.
 
bool config_init_pager (struct ConfigSet *cs)
 Register pager config variables - Implements module_init_config_t -.
 

Variables

const struct ExpandoDefinition IndexFormatDef []
 Expando definitions.
 
static struct ConfigDef PagerVars []
 Config definitions for the Pager.
 

Detailed Description

Config used by libpager.

Authors
  • Ihor Antonov
  • Richard Russon
  • наб

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

Definition in file config.c.

Function Documentation

◆ pager_get_pager()

const char * pager_get_pager ( struct ConfigSubset * sub)

Get the value of $pager.

Parameters
subConfig Subset
Return values
strExternal command to use
NULLThe internal pager will be used
Note
If $pager has the magic value of "builtin", NULL will be returned

Definition at line 111 of file config.c.

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}
const char * cs_subset_string(const struct ConfigSubset *sub, const char *name)
Get a string config item by name.
Definition helpers.c:291
bool mutt_str_equal(const char *a, const char *b)
Compare two strings.
Definition string.c:660
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Variable Documentation

◆ IndexFormatDef

const struct ExpandoDefinition IndexFormatDef[]
extern

Expando definitions.

Config:

  • $attribution_intro
  • $attribution_trailer
  • $forward_attribution_intro
  • $forward_attribution_trailer
  • $forward_format
  • $index_format
  • $message_format
  • $pager_format
Note
Longer Expandos must precede any similar, but shorter Expandos

Definition at line 310 of file mutt_config.c.

310 {
311 // clang-format off
312 { "*", "padding-soft", ED_GLOBAL, ED_GLO_PADDING_SOFT, node_padding_parse },
313 { ">", "padding-hard", ED_GLOBAL, ED_GLO_PADDING_HARD, node_padding_parse },
314 { "|", "padding-eol", ED_GLOBAL, ED_GLO_PADDING_EOL, node_padding_parse },
317 { "a", "from", ED_ENVELOPE, ED_ENV_FROM, NULL },
318 { "A", "reply-to", ED_ENVELOPE, ED_ENV_REPLY_TO, NULL },
319 { "b", "mailbox-name", ED_MAILBOX, ED_MBX_MAILBOX_NAME, NULL },
320 { "B", "list-address", ED_ENVELOPE, ED_ENV_LIST_ADDRESS, NULL },
321 { "cr", "body-characters", ED_EMAIL, ED_EMA_BODY_CHARACTERS, NULL },
322 { "c", "size", ED_EMAIL, ED_EMA_SIZE, NULL },
323 { "C", "number", ED_EMAIL, ED_EMA_NUMBER, NULL },
324 { "d", "date-format", ED_EMAIL, ED_EMA_DATE_FORMAT, NULL },
325 { "D", "date-format-local", ED_EMAIL, ED_EMA_DATE_FORMAT_LOCAL, NULL },
326 { "e", "thread-number", ED_EMAIL, ED_EMA_THREAD_NUMBER, NULL },
327 { "E", "thread-count", ED_EMAIL, ED_EMA_THREAD_COUNT, NULL },
328 { "f", "from-full", ED_ENVELOPE, ED_ENV_FROM_FULL, NULL },
329 { "Fp", "sender-plain", ED_ENVELOPE, ED_ENV_SENDER_PLAIN, NULL },
330 { "F", "sender", ED_ENVELOPE, ED_ENV_SENDER, NULL },
331 { "g", "tags", ED_EMAIL, ED_EMA_TAGS, NULL },
332 { "G", "tags-transformed", ED_EMAIL, ED_EMA_TAGS_TRANSFORMED, parse_tags_transformed },
333 { "H", "spam", ED_ENVELOPE, ED_ENV_SPAM, NULL },
334 { "i", "message-id", ED_ENVELOPE, ED_ENV_MESSAGE_ID, NULL },
335 { "I", "initials", ED_ENVELOPE, ED_ENV_INITIALS, NULL },
336 { "J", "thread-tags", ED_EMAIL, ED_EMA_THREAD_TAGS, NULL },
337 { "K", "list-empty", ED_ENVELOPE, ED_ENV_LIST_EMPTY, NULL },
338 { "l", "lines", ED_EMAIL, ED_EMA_LINES, NULL },
339 { "L", "from-list", ED_EMAIL, ED_EMA_FROM_LIST, NULL },
340 { "m", "message-count", ED_MAILBOX, ED_MBX_MESSAGE_COUNT, NULL },
341 { "M", "thread-hidden-count", ED_EMAIL, ED_EMA_THREAD_HIDDEN_COUNT, NULL },
342 { "n", "name", ED_ENVELOPE, ED_ENV_NAME, NULL },
343 { "N", "score", ED_EMAIL, ED_EMA_SCORE, NULL },
344 { "O", "save-folder", ED_EMAIL, ED_EMA_LIST_OR_SAVE_FOLDER, NULL },
345 { "P", "percentage", ED_MAILBOX, ED_MBX_PERCENTAGE, NULL },
346 { "q", "newsgroup", ED_ENVELOPE, ED_ENV_NEWSGROUP, NULL },
347 { "r", "to-all", ED_ENVELOPE, ED_ENV_TO_ALL, NULL },
348 { "R", "cc-all", ED_ENVELOPE, ED_ENV_CC_ALL, NULL },
349 { "s", "subject", ED_ENVELOPE, ED_ENV_SUBJECT, parse_subject },
350 { "S", "flag-chars", ED_EMAIL, ED_EMA_FLAG_CHARS, NULL },
351 { "t", "to", ED_ENVELOPE, ED_ENV_TO, NULL },
352 { "T", "to-chars", ED_EMAIL, ED_EMA_TO_CHARS, NULL },
353 { "u", "username", ED_ENVELOPE, ED_ENV_USERNAME, NULL },
354 { "v", "first-name", ED_ENVELOPE, ED_ENV_FIRST_NAME, NULL },
355 { "W", "organization", ED_ENVELOPE, ED_ENV_ORGANIZATION, NULL },
356 { "x", "x-comment-to", ED_ENVELOPE, ED_ENV_X_COMMENT_TO, NULL },
357 { "X", "attachment-count", ED_EMAIL, ED_EMA_ATTACHMENT_COUNT, NULL },
358 { "y", "x-label", ED_ENVELOPE, ED_ENV_X_LABEL, NULL },
359 { "Y", "thread-x-label", ED_ENVELOPE, ED_ENV_THREAD_X_LABEL, NULL },
360 { "Z", "combined-flags", ED_EMAIL, ED_EMA_COMBINED_FLAGS, NULL },
361 { "zc", "crypto-flags", ED_EMAIL, ED_EMA_CRYPTO_FLAGS, NULL },
362 { "zs", "status-flags", ED_EMAIL, ED_EMA_STATUS_FLAGS, NULL },
363 { "zt", "message-flags", ED_EMAIL, ED_EMA_MESSAGE_FLAGS, NULL },
366 { NULL, NULL, 0, -1, NULL }
367 // clang-format on
368};
@ ED_MBX_MESSAGE_COUNT
Mailbox.msg_count.
Definition mailbox.h:158
@ ED_MBX_PERCENTAGE
EmailFormatInfo.pager_progress.
Definition mailbox.h:159
@ ED_MBX_MAILBOX_NAME
Mailbox, mailbox_path()
Definition mailbox.h:157
@ ED_ENVELOPE
Envelope ED_ENV_ ExpandoDataEnvelope.
Definition domain.h:42
@ ED_EMAIL
Email ED_EMA_ ExpandoDataEmail.
Definition domain.h:41
@ ED_GLOBAL
Global ED_GLO_ ExpandoDataGlobal.
Definition domain.h:44
@ ED_MAILBOX
Mailbox ED_MBX_ ExpandoDataMailbox.
Definition domain.h:47
@ ED_EMA_DATE_STRF_LOCAL
Email.date_sent.
Definition email.h:143
@ ED_EMA_ATTACHMENT_COUNT
Email, mutt_count_body_parts()
Definition email.h:136
@ ED_EMA_DATE_FORMAT_LOCAL
Email.date_sent.
Definition email.h:141
@ ED_EMA_TAGS_TRANSFORMED
Email.tags, driver_tags_get_transformed()
Definition email.h:156
@ ED_EMA_THREAD_HIDDEN_COUNT
Email.collapsed, Email.num_hidden, ...
Definition email.h:158
@ ED_EMA_DATE_FORMAT
Email.date_sent.
Definition email.h:140
@ ED_EMA_THREAD_TAGS
Email.tags.
Definition email.h:160
@ ED_EMA_TAGS
Email.tags.
Definition email.h:155
@ ED_EMA_SIZE
Body.length.
Definition email.h:152
@ ED_EMA_FLAG_CHARS
Email.deleted, Email.attach_del, ...
Definition email.h:144
@ ED_EMA_THREAD_NUMBER
Email, mutt_messages_in_thread()
Definition email.h:159
@ ED_EMA_TO_CHARS
Email, User_is_recipient()
Definition email.h:161
@ ED_EMA_BODY_CHARACTERS
Body.length.
Definition email.h:137
@ ED_EMA_COMBINED_FLAGS
Email.read, Email.old, thread_is_new(), ...
Definition email.h:138
@ ED_EMA_THREAD_COUNT
Email, mutt_messages_in_thread()
Definition email.h:157
@ ED_EMA_STATUS_FLAGS
Email.deleted, Email.attach_del, ...
Definition email.h:153
@ ED_EMA_NUMBER
Email.msgno.
Definition email.h:150
@ ED_EMA_DATE_STRF
Email.date_sent, Email.zhours, Email.zminutes, Email.zoccident.
Definition email.h:142
@ ED_EMA_FROM_LIST
Envelope.to, Envelope.cc.
Definition email.h:145
@ ED_EMA_SCORE
Email.score.
Definition email.h:151
@ ED_EMA_CRYPTO_FLAGS
Email.security, SecurityFlags.
Definition email.h:139
@ ED_EMA_STRF_RECV_LOCAL
Email.received.
Definition email.h:154
@ ED_EMA_LIST_OR_SAVE_FOLDER
Envelope.to, Envelope.cc, check_for_mailing_list()
Definition email.h:148
@ ED_EMA_INDEX_HOOK
Mailbox, Email, mutt_idxfmt_hook()
Definition email.h:146
@ ED_EMA_LINES
Email.lines.
Definition email.h:147
@ ED_EMA_MESSAGE_FLAGS
Email.tagged, Email.flagged.
Definition email.h:149
@ ED_ENV_SUBJECT
Envelope.subject, Envelope.disp_subj.
Definition envelope.h:116
@ ED_ENV_NEWSGROUP
Envelope.newsgroups.
Definition envelope.h:109
@ ED_ENV_INITIALS
Envelope.from (first)
Definition envelope.h:104
@ ED_ENV_FROM_FULL
Envelope.from (all)
Definition envelope.h:103
@ ED_ENV_X_COMMENT_TO
Envelope.x_comment_to.
Definition envelope.h:123
@ ED_ENV_FROM
Envelope.from (first)
Definition envelope.h:102
@ ED_ENV_LIST_ADDRESS
Envelope.to, Envelope.cc.
Definition envelope.h:105
@ ED_ENV_SPAM
Envelope.spam.
Definition envelope.h:115
@ ED_ENV_SENDER
Envelope, make_from()
Definition envelope.h:113
@ ED_ENV_TO_ALL
Envelope.to (all)
Definition envelope.h:120
@ ED_ENV_X_LABEL
Envelope.x_label.
Definition envelope.h:124
@ ED_ENV_NAME
Envelope.from (first)
Definition envelope.h:108
@ ED_ENV_CC_ALL
Envelope.cc.
Definition envelope.h:100
@ ED_ENV_ORGANIZATION
Envelope.organization.
Definition envelope.h:110
@ ED_ENV_REPLY_TO
Envelope.reply_to.
Definition envelope.h:112
@ ED_ENV_LIST_EMPTY
Envelope.to, Envelope.cc.
Definition envelope.h:106
@ ED_ENV_THREAD_X_LABEL
Envelope.x_label.
Definition envelope.h:118
@ ED_ENV_MESSAGE_ID
Envelope.message_id.
Definition envelope.h:107
@ ED_ENV_SENDER_PLAIN
Envelope, make_from()
Definition envelope.h:114
@ ED_ENV_USERNAME
Envelope.from.
Definition envelope.h:121
@ ED_ENV_TO
Envelope.to, Envelope.cc (first)
Definition envelope.h:119
@ ED_ENV_FIRST_NAME
Envelope.from, Envelope.to, Envelope.cc.
Definition envelope.h:101
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() -.
struct ExpandoNode * parse_index_hook(const char *str, struct ExpandoFormat *fmt, int did, int uid, ExpandoParserFlags flags, const char **parsed_until, struct ExpandoParseError *err)
Parse an index-hook - Implements ExpandoDefinition::parse() -.
struct ExpandoNode * parse_subject(const char *str, struct ExpandoFormat *fmt, int did, int uid, ExpandoParserFlags flags, const char **parsed_until, struct ExpandoParseError *err)
Parse a Subject Expando - Implements ExpandoDefinition::parse() -.
struct ExpandoNode * parse_index_date_recv_local(const char *str, struct ExpandoFormat *fmt, int did, int uid, ExpandoParserFlags flags, const char **parsed_until, struct ExpandoParseError *err)
Parse a Date Expando - Implements ExpandoDefinition::parse() -.
struct ExpandoNode * parse_index_date_local(const char *str, struct ExpandoFormat *fmt, int did, int uid, ExpandoParserFlags flags, const char **parsed_until, struct ExpandoParseError *err)
Parse a Date Expando - Implements ExpandoDefinition::parse() -.
struct ExpandoNode * parse_index_date(const char *str, struct ExpandoFormat *fmt, int did, int uid, ExpandoParserFlags flags, const char **parsed_until, struct ExpandoParseError *err)
Parse a Date Expando - Implements ExpandoDefinition::parse() -.
struct ExpandoNode * parse_tags_transformed(const char *str, struct ExpandoFormat *fmt, int did, int uid, ExpandoParserFlags flags, const char **parsed_until, struct ExpandoParseError *err)
Parse a Tags-Transformed Expando - Implements ExpandoDefinition::parse() -.
@ 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

◆ PagerVars

struct ConfigDef PagerVars[]
static

Config definitions for the Pager.

Definition at line 43 of file config.c.

43 {
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};
#define IP
Definition set.h:52
const struct ExpandoDefinition IndexFormatDef[]
Expando definitions.
#define D_STRING_COMMAND
A command.
Definition types.h:98
@ DT_NUMBER
a number
Definition types.h:38
@ DT_BOOL
boolean option
Definition types.h:32
@ DT_SYNONYM
synonym for another variable
Definition types.h:45
@ DT_STRING
a string
Definition types.h:44
@ DT_EXPANDO
an expando
Definition types.h:34
@ DT_REGEX
regular expressions
Definition types.h:41
#define D_INTEGER_NOT_NEGATIVE
Negative numbers are not allowed.
Definition types.h:100