The `precmd' hook doesn't take an argument -- what would it say anyway?
The `preexec' hook should have the command, only without newlines,
because otherwise the newline aborts the set-title control sequence,
and (a) the title doesn't get changed after all, and (b) lines after the
first get spammed to the terminal output.
Fortunately, `zsh' provides a version of the command without the
newlines, which looks purpose-built for this application.
__mdw_precmd_hook= __mdw_preexec_hook=
-__mdw_run_precmd_hook () { __mdw_runhook __mdw_precmd_hook "$@"; }
-__mdw_run_preexec_hook () { __mdw_runhook __mdw_preexec_hook "$@"; }
+__mdw_run_precmd_hook () { __mdw_runhook __mdw_precmd_hook; }
+__mdw_run_preexec_hook () { __mdw_runhook __mdw_preexec_hook "$2"; }
precmd_functions+=(__mdw_run_precmd_hook)
preexec_functions+=(__mdw_run_preexec_hook)