[neomutt-devel] Rules not Lists
Richard Russon
rich at flatcap.org
Tue Jul 24 14:26:17 CEST 2018
All the code to set config variables used to live in parse_set().
It was an enormous function containing lists of variables which should be
treated in a special ways.
The new config code breaks up this function by defining types (which
live in config/*.c) and giving them control over what is valid, or not.
Each type can be sub-typed by adding flags, e.g declaring:
- Strings DT_NOT_EMPTY
- Numbers DT_NOT_NEGATIVE
For finer-grained control, you can add a 'validator' to any config item.
The header cache has a string config item "header_cache_backend".
Its validator checks that the string is one of "tokyocabinet", "lmdb", etc
Note: The validators are called as needed, so they can make decisions
based on the current state.
The pager validator, determines if a variable can be set depending on
whether the user is currently viewing an email.
These changes mean that features can define their own complex config
types, but NeoMutt doesn't need to understand them.
More code and knowledge coming soon.
Rich / FlatCap
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://mailman.neomutt.org/pipermail/neomutt-devel-neomutt.org/attachments/20180724/bab036c9/attachment.sig>
More information about the neomutt-devel
mailing list