| 1 | | [http://wiki.mutt.org/?DebugConfig] |
| | 1 | == How to debug mutt config problems == |
| | 2 | |
| | 3 | The basic principle: |
| | 4 | * '''Start''' with a '''simple''' config that works, |
| | 5 | ** Use "mutt -n" to exclude side-effects of a global Muttrc. |
| | 6 | ** Use "mutt -F file" for a temporary config-file. (both can be combined) |
| | 7 | * then expand it '''step by step''' with more of your config lines, limit your changes related to only 1 problem at a time: '''isolate, eliminate'''. |
| | 8 | * if you have a big file and can't find the breaking point, 1st drop one half, then the other, repeat in the broken half: '''divide + conquer'''. |
| | 9 | ** Always check whether mutt-vars have the desired values by entering "<tt>:set ?var</tt>" at run-time. |
| | 10 | *** TAB-expand mutt varnames until complete, expand their values by adding "=" after the name and hitting TAB again, i.e. without the leading '?'. |
| | 11 | ** Simplify or even disable hooks. Read carefully which applies for which task, don't mix 'em up. |
| | 12 | *** Verify that things work without hooks first. |
| | 13 | ** Take care of matching quoting chars/ levels -> PatternQuoting! |
| | 14 | ** When (error-)messages pass too fast, increase "sleep_time". |
| | 15 | ** Compile with "debug" enabled, then run "mutt -d 3 ..." to watch output in ~/.muttdebug... |
| | 16 | ** Use shell-scripts in place of external application calls to see whether the app or mutt produces an error and why: |
| | 17 | *** make executable ("man chmod") script: <tt>{ echo "Args = $@"; echo "STDIN blow: ======"; cat ; } > /tmp/mutt-interface</tt> |
| | 18 | *** inspect that file to check arguments and input are ok from mutt, |
| | 19 | *** pass examined data caught by script manually to external application on the cmd-line, |
| | 20 | *** verify output and exitcode of app supposed to be returned to mutt are ok. |
| | 21 | * until you find the error or your config is complete. |
| | 22 | |
| | 23 | * Config not portable across systems: |
| | 24 | ** employ the logfile feature described above to see what happens, also dump mutt-vars with "mutt -D", |
| | 25 | ** take care to reproduce the execution of functions ''identically'' on both systems and then compare the outputs with "diff". |
| | 26 | ** If the logfile and "mutt -D" output is identical, then the system-environments differ in vital detail,\ |
| | 27 | which, however, vary by feature too much to list them all here: see MuttFaq. |
| | 28 | ---- |
| | 29 | |
| | 30 | Typical problems are caused by: |
| | 31 | * Misunderstanding of how hooks work: |
| | 32 | ** they always need a default ("catch-all") pattern/ regex == <tt>'.'</tt>! |
| | 33 | ** their order matters and varies by type (especially where defaults go, when "<tt>:set ?var</tt>" fails)! |
| | 34 | *** hooks with filename as target take the '''first hit''' exclusively (default == last), |
| | 35 | *** mutt-cmds as target means '''all''' hits are applied cumulatively, last hook wins (default == first). |
| | 36 | ** cmds in hooks are executed when triggered, therefore errors, too, occur later, not at startup. |
| | 37 | ** see send-hook vs. send2-hook, maybe the latter can help where the former can't. |
| | 38 | ** "folder-hook" for doing stuff ''after changing folders'', |
| | 39 | ** "account-hook" to setup account-stuff (like *_user&*_pass) ''before connecting to a site'', |
| | 40 | *** changing folders doesn't require new connections (stay open in background for a while). |
| | 41 | *** some remote sites (which might timeout differently) are checked in background without changing folders (see "mailboxes"). |
| | 42 | * Quoting spaces and regexps/ patterns on several levels of nested cmds as args to cmds: |
| | 43 | ** "cmd-arg" to hook/ macro must be quoted completely, since hook/ macro takes only 1 token as whole (incl. args of the cmd): |
| | 44 | *** if you want to specify more than 1 cmd as arg, the ";" must be quoted in the cmd-part of the hook/ macro. |
| | 45 | *** example double quoting with '""': <tt>hook 'pattern' 'cmd "param"; cmd2 "param2"'</tt> |
| | 46 | ** see MuttGuide/Syntax for what is quoted when and how. |
| | 47 | ** PatternQuoting explains how to cope with 2 levels with patterns. |
| | 48 | *** for each nested lvl of cmds as args to cmds you must add an extra lvl of quoting '''for that lvl''': not all chars are special on every lvl. |
| | 49 | * Side-effects by other config files: |
| | 50 | ** a global Muttrc with bad defaults for all users: "<tt>mutt -v | grep SYSCONFDIR</tt>" to find it. |
| | 51 | ** own files sourced by macros or hooks possibly overwriting vars, when the "<tt>:set ?var</tt>" check fails. |
| | 52 | * Side-effects by 3rd party patches: retry with '''native mutt''' before asking the wrong people, ask patch provider if it's patch-related. |
| | 53 | * Features not enabled in binary: see MuttGuide/Setup to figure out which are enabled and whether you need to build a new binary. |
| | 54 | * Special treatment of '\' line continuation with '#' comments per MuttGuide/Syntax: |
| | 55 | ** if you comment lines, make sure you hit the beginning and don't break or oversee \-continuations, especially with hooks. |
| | 56 | * Macros badly defined: |
| | 57 | ** use <> notation for functions rather than keystrikes, allows to better detect typos and more portable. |
| | 58 | ** remember: macros are a _replay_ of keystrikes you'd normally type manually: always check whether the sequence works manually with '''each key'''! |
| | 59 | * Confusion about use of "set from=..." and "my_hdr", see MuttFaq/Header. |
| | 60 | ** "my_hdr" has some issues when interacting with "send-hook" for example, read docs about both. |
| | 61 | ---- |
| | 62 | Sometimes the problem is not the config but the code: update to the most recent developer version and retry. |
| | 63 | This way you exclude problems with your old version that might have been fixed in the meantime. |
| | 64 | See also reported errors in the bug tracking system on the MuttWiki start page. |
| | 65 | ---- |
| | 66 | |
| | 67 | Always remember to have a look at MuttFaq if you get stuck somewhere. |