-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.txt
720 lines (571 loc) · 16.7 KB
/
config.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
need regex_dup() function
struct ConfigSetType
flag for quoting
'unset' allowed flag
flag/size for numeric types 1 bit, 1 byte, 2 bytes, 4, 8 (range-checking becomes hard)
flags
#define CS_REG_DISABLED (1 << 0)
configure flag for disabled
success flag for disabled settings
bool dump_config(struct ConfigSet *cs, int style, int flags)
QWQ "neomutt -n -F /dev/null" doesn't give empty output with:
flags |= CS_DUMP_ONLY_CHANGED;
have concept of 'default' value?
use if not valid?
use initial val?
eliminate code tests for if (Var and *Var) ?
no empty strings
number types
set errno first?
check carefully for range errors
scoped variables?
help:index_format
notmuch:index_format
update and move config design docs to web dev/
Config Integration
Docs: encapsulated types
cs_create(n), register_types()
cs_register_variables()
cs_add_listener()
parse_set -> new config
dump config -D
complete <tab>
check initial of -1 works
move SYN to syn.c
how do I deal with set noX, invX
should config deal with it?
perhaps the type should know whether it can be
negated/toggled? set &X too (reset)
set X bool=1 quad=yes
reset X bool=0 quad=no
unset X or noX
toggle X or invX (bools and quads only)
toggle X Y Z -> set invX invY invZ
unset X Y Z -> set noX noY noZ
set ?var -> display value
set &var -> reset var
"all" -> every config
unset/reset my_VAR -> delete
set X=$Y -> expansion
(documented where?) NOT
support set VAR? (postfix '?')
how to handle notification for "reset all"?
flag types:
can be "set" set X valid
can be "inv" set invX valid
can be "no" set noX valid
validator for "charset"
could the validator have a side-effect?
*do* the actual char-setting required?
custom type for charset
encapsulate x_is_utf8
and replacement char?
validators for:
debug_file
debug_level
validator != listener
validator before, listener after change
set up some "default" validators
val_not_null
val_not_empty_string
val_numeric
val_no_spaces
relative paths
relative to what? (muttrc?)
who calculates?
does config store name of base variable?
new assignment operator?
:= (expand at time of use)
expand recursively?
use for passwords?
so that they're not cached in neomutt
or $= ?
@=
workaround is to escape $
set x = \$y
function/known data
source_rc FILE, LINE, !SYMBOL
mutt_parse_rc_line !FILE, !LINE, !SYMBOL
parse_set !FILE, !LINE, SYMBOL
mutt_option_index !FILE, !LINE, SYMBOL
how do we pass out a meaningful error message?
non-null flags (may not be unset)
most regexes (those without initial string)
shell
all format strings
validator for each format string
checks if the %x expandos are valid
run a test parse of some data?
time type that accepts
10 seconds
10s seconds
10m minutes
etc
display as what?
seconds?
shortest abbreviation?
depends on flags?
dump
flags: active vs disabled
register flags - disabled =>
no var ptr
no validator
no listeners
dump MUTT = X|Y|Z flags
dump NEO = P|Q|R flags
parse config silently accept disabled
flags for warn on synonym/deprecated
flags for warn on disabled (in this version)
should dump_config be able to dump ALL config
be able to reproduce the entire setup
colours?
aliases?
hooks?
even if the CLI can't, the UI might need to be able to, for commands:
:colors
:aliases
:hooks
put other globals into hash
CFG_PRIVATE
don't show up in neomutt -D
push/pop or save/restore
save_config; set var=x; function; restore_config
no more need for my_var use
accept disabled
configure flag? or CLI
CLI warn option
typedef numeric/enum config types?
flag on HE var-def to show "SET_BY_USER"
add locking to set functions
-> thread safe updates
debug log all processes
change to debug(5) before merge
Config Requirements
Address type needs:
mutt_address.c
rfc822_write_address() to format addresses for display
rfc822_write_address_single()
mutt_addr_for_display()
mutt_idna.c
mutt_addr_for_display()
loops through addresses calling:
addr_is_local() -- move to address.c
mbox_to_udomain() -- move to address.c
mutt_idna_intl_to_local() and idna functions
mutt_charset.c
mutt_convert_string() calls
mutt_iconv_open() and iconv functions
mutt_charset.c (others)
fgetconv_open() calls mutt_iconv_open()
mutt_check_charset() calls mutt_iconv_open()
mutt_charset.c
mutt_iconv_open() call mutt_charset_hook()
hook.c
maintains list of "regex -> string" mappings
mutt_charset_hook() regex matches a string
todo
find meaning of all the idna functions
give examples of each
--------------------------------------------------------------------------------
mutt/regex.c (to create)
create regex
parse string
match regex against string
free regex
mutt_idna_intl_to_local()
uses global variable IdnDecode -- turn into flag
calls mutt_convert_string() and idna functions
mutt_idna_local_to_intl()
uses global variable IdnEncode -- turn into flag
calls mutt_convert_string() and idna functions
split mutt_idna.c
address functions -> address.c
envelope functions -> envelope.c
create private "regex -> string" lookup in mutt_charset.c
refactor mutt_parse_hook() to use it
move mutt_charset.c -> mutt/charset.c
move mutt_idna.c -> mutt/idna.c
--------------------------------------------------------------------------------
Enabled config
definition -> var
notify on change
accept in config file
list in `neomutt -D`
complete on <tab>
verbosely accept in config file
list canonicalised config line
Disabled config
definition -> var
don't notify on change
don't list in `neomutt -D`
don't complete on <tab>
quietly accept in config file
verbosely accept in config file
suggest build options
Obsolete config
definition -> NULL
don't notify on change
don't list in `neomutt -D`
don't complete on <tab>
quietly accept in config file
verbosely accept in config file
suggest removal
Synonym config
definition -> ALTERNATIVE
notify ALTERNATIVE on change
don't list in `neomutt -D`
complete on <tab>
mutt does
quietly accept in config file
verbosely accept in config file
suggest ALTERNATIVE
--------------------------------------------------------------------------------
enum
option to dump all valid inputs
LONG types & vars
def combine type with flags to save space?
would break new-config enum setup
DT_NUM - most (29/40) have NOT_NEGATIVE, so reverse flag to
ALLOW_NEGATIVE
add MINUS_ONE option
validator
if CSR_ERR is returned, but err is empty
generate a default error message
flags
CLAMP, NON_NEGATIVE
gettext messages
dedupe %s vs %ld values!
allow validator to change value?
e.g. for clamping a range?
type flag for quoting
always
as-necessary
never
PATH flag relative to *what*?
validator for format strings
if they're all simple 1 letter, then have a parser(fmt, "abfq")
only *warn* if bad -- notify devs if wrong
after config split up commands and functions too
into their separate components
DT_ENUM for magic, etc
some DT_* will need extra data field
e.g. those validating expandos
sort could be split into separate sets
Variables
struct {type, hash, name, union {vars}}
OPT_INT(Var)
get_int_opt(name|id)
type includes "my_"-ness
who holds the vars?
get(NULL, name) => default?
hash inside or out, or both. BOTH
HASH *vars
get_name (id)
get_hash(name)
get_var(name|id)
set_var(name|id, var)
some vars need a validator
variable sets know their parent
set variables via a function() -> notifications
get variables direct from their Var
variables don't know about refreshing
where are validators / notifications stored?
globally (on default config-set)
per-config-set (allow overrides)
key my_vars in separate set?
functions per set, per type
setter
getter
validator
set by string (from config)
get by type of user's choice
internal getters: string, int, bool, void*
overridden getter returns "Var"?
then coerced to type?
hc_init()
register_type(DT_HCACHE, ops)
parse_set()
-> hc_set(string)
-> hc_validator(string)
validator per type
REQUIRE get_str ∀ types
have separate int/uint variable types?
which variables need negative values?
have a 'time' variable type
allows setting: x=30m (minutes), etc
may not be worth it, most times are sub-1minute
strdup? or does the config_set take ownership?
use high bits of 'type' to save free()/don't free() of a string
how does 'reset' work? where is the original value stored?
do we keep it in the hash elem?
a "parent" config set of original values?
how many config values are changed?
too much overhead?
hashelems won't be constant
init var == address1
set var == address2
set var == address2
reset var == address1
too much overhead?
how are variables read?
macro doesn't work if things might be overridden/reset
can't cache address of HashElem
unless we have a RESET flag
hash id may not be unique
need to work with string representation
get_bool("sidebar_visible")
horrendous duplication of strings?
reset means:
keep the old value
or remember who owns the variable
get/set
hash = overhead looking up string when USING the variable
vars = overhead looking up string when setting variables
notifications to invalidate HashElems?
too complicated
caching options could be account-local
header cache for local mboxes
body cache too for remote mboxes
parse_set
get hashelem
get id from he
lookup str_set
set_set(he, value)
base types
bool, num, str, quad
mutt -D ∀ dump specific
else str_get
coercion hc_get_int(he)
dropping hash means losing the trapping of set-value
we lose the ability to trigger notifications
how many variables are going to be account-specific?
how will +=, -=, *=, /=, ^= work?
path variable type? subtype of string?
flags: FILE, DIR (or both)
does the setting engine need to know
mailbox variable type? subtype of string?
command variable type? subtype of string?
more scrutiny for setting?
merge string and path types (and command)
does mbtable belong in config/ ?
regex add more tests covering flags and '!' prefix
string_get initial value doesn't set EMPTY flag
--------------------------------------------------------------------------------
slist - String list
Configurable separator ':' or ','
':' needs to handle escaping
functions: compare(), add_item(), remove_item(), is_member(), count_members()
flags: allow dupes, case sensitive
add count (length) value
handle different separator types
tests ∀
sorting methods
COMMA | ACCEPT_SPACE
space is optional, but not printed
errors
!allow_dupes -> quiet or fail?
!allow_empty -> quiet or fail?
validators
reset (+validator)
getting
native get/set
space separator works differently: "apple banana" == "apple banana"
flag: TRIM_WHITESPACE
LISTS
: assumed_charset
: attach_charset
, hidden_tags
: mailcap_path
: send_charset
NOT
charset
config_charset
newsgroups_charset
account-specific => no more $IMAP_user, just $user
rename statics to MixedCase
test
debug_file
debug_level
charset != null
charset null ok
show_multipart_alternative
reply_regex / OptAttachMsg
mbox_type? no?
wrapmargin SYNONYM
history clamp 0+
pager_index_lines clamp 0+
imap_pipeline_depth clamp 0+
header_cache_backend
sidebar_width clamp 0+
40 numbers, most clamp 0+
test all R_ flags on vars(~75)
pager prechecks
changing history file (noop on mutt)
set all values 1 - check against -D
set all values 2 - check against -D
check command line sets and default
query *all* vars
dump vars
check logging
check header cache var
check regexes working
test completion
test lua
test default setting
test logging
exceptions
wrapmargin
test bare sets of bool, quad
set/reset on 'all'
check regexes with ! prefix
part 1.5
all vars set in code using CS
part 2 validation
part 3 notifications
part 4 list type, enum type?
2)
empty strings
num - negative
regex regcomp
address parse
format strings
3)
all index,pager,sidebar flags
logging changes
4)
list type, several vars
refactor code
enum type -> data column
format string valid -> data column
split PATH & MAILBOX types
5)
list => +=, -=
Globals => config system -> cleanup
acutest of config
allow disabled config
----
neomutt -D
wrap options (wrap to $COLUMNS ?)
[no]var for bools, many are too wide
dump -D, -Q, :set?
num, quad, bool, as quoted
cs_reset flag for ALL changed?
config possible to make all ac-specific variables *internal* (no global var)?
where's the initial value stored?
have account-only variables? no global version
user (rather than multiple X_user vars)
account object and custom config stored as AccountList
add flags to DT_PATH for
FILE_ONLY
DIR_ONLY
NO_SYMLINK
MUST_EXIST
NOT_EMPTY
validator check for readable/reachable
when validating the file/dir, preservve the stat info?
where? in the large 'File' object?
--------------------------------------------------------------------------------
ConfigDef rename flags to data
Move F_SENSITIVE to type flag
use data for display flags (will become obsolete)
use data for enum definition (leaves validator free)
enum add flags to definition? e.g. match case? NO
can't turn DT_BOOL into enum until display flags are gone (31 bools)
unless display flags are merged with type
=> data field is only used by enum (wasteful?)
we can sae the field if enums can't have validators
10 display flags across 8 types + DT_STRING|F_SENSITIVE
32 bits, type 4 bits, display flags 10 bits, private flags 4 bits (0xFFFFFFFF)
config/command.c doxy implements * lots
config/{string,path,command}.c are identical merge (flags)
bool,quad,magic -> enum
how big's the backing variable?
always unsigned char?
typedef ConfigEnum to be safe
enum - need functions to get enum values, range, etc
work on cdef->data (EnumDef) or HE config var
need macros for testing string subtypes
if ((type & (DT_STRING | DT_PATH)) == (DT_STRING | DT_PATH))
same for command
can we fake BOOL and QUAD for legibility?
mutt_config.c says DT_BOOL but reg type uses enum machinery. QUAD too
still need data ptr for EnumDef unless hard-coded into enum.c?
enum registers ENUM, BOOL, QUAD?
string registers STRING, PATH, COMMAND? or just sub-types?
hcache could be enum (list fixed at compile time)
or string with validator
if hcache backends become dynamically loadable
=> must be string + validator
hcache enum NEEDS empty option - enum flag?
can *ENUMS* be empty?
enum - first value allowed to be NULL?
config prefix 'pager'
set pager:var = 3
'compose', 'index', etc?!
mutt_config.c config INH_NONE, INH_ACC, INH_MBOX
Config contains all config
Hide Config global, must use N|A|M->sub
get N->config --> C->config }
get A->config (missing) delegate to N->sub }- by string
get M->config (missing) delegate to A->sub }
get M he -> ? return C he?
or forcibly create A he, M he (inherited)
OR create *all* config ∀ A, M (that are named)! overkill?!
do subsets need he? useful, can be cached
is speed likely to be a problem?
if we can reuse the hashed string, it's a max of 3 lookups
NO, diff string! "fruit:apple:variable"
get M->config (missing) don't lookup, delegate to parent
set M->config, lookup (fail), delegate *create* to parent, then create, then set
--------------------------------------------------------------------------------
config will lose "full-doc" option until CS suports "disabled"
need state-ending for markdown processing
internal help should be 1-liner -- rest is in external doc repo!
use 'extern' comments and possibly add cross-reference for docs
register variables takes data + DEPRECATED | DISABLED flags
it applies flags to all config items
will this work?
means data set *isn't* const! probably isn't already
how are initial values set! probably OK
using disabled/deprecated implies split config
after docs re-make
"full-doc" -> disabled, no option for displaying deprecated
add 1-liner to :set output
is internal help worth it?
just maintain an external text file?
no-variable
normal
DT_NUM var -> short
DT_ADDR var -> struct Address
DT_SYN var -> HE other
DT_DEP var -> variable
no-var
DT_NUM var scalar
DT_ADDR var pointer
DT_SYN var -> HE other
DT_DEP var -> scalar/ptr
config event: pass raw value
update observers to use value
rather than cs_subset?
does this make sense?
observer needs value associated with the *observed* object
not global
observer-specific?
config: separate DEPRECATED, SYNONYM to separate arrays?
no advantage? no
config: LCOV_EXCL_LINE -> assert
config: separate DT_TYPE from DT_FLAGS, eliminate DTYPE macro, etc
--------------------------------------------------------------------------------
config UNDERSCORE renames
doc old name
or reverse synonym?
SYN flags NEO1 => certain date
NEO_HIST => old conversion
since NeoMutt 2021...
flag synonyms/or new config so that CLI -O
produces extra line:
Note: before NeoMutt vX, this was called $Alt
add same to docs generation, leave for 6 months?
register(synonym) modifies orig! +FLAG, +DATA!
put "since" date in SYN data field
--------------------------------------------------------------------------------