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

Re: Is this an orthodox use of zstyle?



On Oct 14,  6:00pm, DervishD wrote:
} 
}     I think I can use styles to carry state information from one
} widget execution to another, so the widget will behave differently
} depending on the result of past executions, but: is this an orthodox
} use of styles [...]?

Typically functions read styles but don't set them, unless they're a
special kind of function that's designed to help the user set up his
environment (e.g., (in 4.1.1) select-word-style).

If the same function will behave differently depending on context
(e.g., it might be called as either a normal widget or a completion
widget) then styles might be appropriate, but if you don't need to
save different state in different contexts, parameters are better.

}     I know that I can do this with an environment variable but since
} the state information can be a bit complex I will need an array, or
} maybe a couple for separating information, or even an associative
} one

You presumably don't want to "export" the widget state parameters
(you can't export styles) so it's fine to use arrays and associative
arrays for your state.  For example, look at the set of parameters
used by the zftp functions to maintain state.



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