chiark / gitweb /
dot/zshrc: Fix arguments to the hooks.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 25 Apr 2020 01:17:57 +0000 (02:17 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 25 Apr 2020 01:20:22 +0000 (02:20 +0100)
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.

dot/zshrc

index 32ed72e524193f1cc281ed4ef02b1e87da08cd28..7a0824aca3a1fe58a46c2d3396e8110b5c1c2c39 100644 (file)
--- a/dot/zshrc
+++ b/dot/zshrc
@@ -19,8 +19,8 @@ SAVEHIST=1000
 
 __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)