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

zle_line_init_functions (Re: accept-line-and-down-history and push-input)



[>workers]

On Oct 26,  4:19pm, Peter Stephenson wrote:
} Subject: Re: accept-line-and-down-history and push-input
}
} On Tue, 26 Oct 2010 07:55:44 -0700
} Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> wrote:
} > (I'm beginning to think that zle-line-init should be a builtin widget
} > that calls an array of hook functions, ala precmd.)
} 
} I've been thinking along those lines, except that the array of hook
} functions would be the alternative to the widget, as with chpwd and
} friends

I don't much like the idea of having an array of *widget names*.
What's the benefit of invoking a series of widgets, rather than
having one widget that calls a series of functions?  The context is
the same either way (i.e., "zle" with no args returns zero status
and you can access all the line editor variables) and all the work
of creating and destroying thingys can be avoided.

} i.e. you could still define zle-line-init if you wanted a
} simple life but zle_line_init_functions could contain an additional set
} of widgets.

Wouldn't you still get that effect if zle-line-init was a builtin
widget that you could override with your own via zle -N ?

} Not sure how to keep the name of the array entirely within zle

I don't know what you're reaching for, there.  The array has to be
outside of zle at some point or you can't assign anything to it ...?

zle-line-init() {
  local f
  for f in $zle_line_init_functions
  do
    if [[ $PWS_users_15493 ]]
    then zle "$f"
    elif [[ $my_suggestion ]]
    then "$f" || break
    fi
  done
}



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