themes: add indirection to make "local" work in theme definitions

This commit is contained in:
Andrew Janke 2015-03-31 05:06:47 -04:00
commit ae27b672e9

View file

@ -70,8 +70,8 @@ function _omz_load_theme_from_file() {
values_before[$param]=${(P)param}
done
# Actually load the theme
source $file
# Actually load the theme, using an indirection function
_omz_source_theme_file $file
# Debugging stuff
if [[ $ZSH_THEME_DEBUG == true ]]; then
@ -128,6 +128,14 @@ function _omz_load_theme_from_file() {
fi
}
# Sources the given file
# The only reason this function exists is to provide a layer of
# indirection so that the theme file runs in its own function call stack frame
# and "local" statements in the theme definitions work as intended.
function _omz_source_theme_file() {
source $1
}
# Resets all theme settings to their default state
# (To the extent that we know what themes do, that is.)
# This will reset all variables used by the core OMZ *_prompt_info functions.