Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: bracketed paste mode in xterm and urxvt

On May 28, 10:30pm, Daniel Hahler wrote:
} I've stumbled upon it recently, too, and noticed that the handling of
} zle-line-init and zle-line-finish should be improved to not overwrite
} an already defined function.
} I am using the following pattern to add additional code to these hooks:
}   eval "zle-line-init()   { something_new; $functions[zle-line-init]; }"
}   eval "zle-line-finish() { something_new; $functions[zle-line-finish]; }"
} Does this make sense?

Mostly; in some obscure cases (e.g., zle-line-init is an autoload and has
not yet been loaded) it could break.

} Would this be something that add-zsh-hook could provide?

Possibly, though it would require its own separate conditional branch
because zle-line-init is not the same flavor of "hook" as everything else.

One way to do this is something like so:

    zle-line-init() {
      local w
      for w in "${(@ok)widgets%zle-line-init-*}"
      do zle $w "$@"

Then you just create widgets named zle-line-init-N where N represents
the order you want them to execute.  Similarly for zle-line-finish.

Messages sorted by: Reverse Date, Date, Thread, Author