1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Plugin hook corresponding to special aliases

Discussion in 'Suggestions' started by p.f.moore, Sep 10, 2008.

  1. p.f.moore

    Joined:
    May 30, 2008
    Messages:
    122
    Likes Received:
    1
    It would be useful to have a hook to allow a plugin to install
    functions to be run at the points covered by special aliases -
    UNKNOWN_CMD, PRE_EXEC, POST_EXEC and PRE_INPUT. They would allow
    plugins to trap these cases without having to interfere with the
    aliases (which is error-prone, as it's not obvious how to "chain" the
    plugin hook with a user-set alias).

    One use-case I have is for a timing plugin, which sets pre- and
    post-exec hooks, to display the time taken by the last command. (This
    is possible at the moment with aliases, but as I say, it's more fiddly
    than it would be in a plugin).

    As a suggestion for the interface, how about special names, *PRE_INPUT
    etc (which fit in the keyboard hook namespace, but I doubt the names
    will clash with existing names used by plugins). Only *UNKNOWN_CMD
    requires any input (the command line), which could be made available
    via the normal NthArgument etc API calls.

    Paul.
     

Share This Page