"emulate -L zsh" sets zsh's option set to the default values of zsh's
native mode. The `-L' causes the options to be set local to the
surrounding function. That makes sense in most cases.
With `xsource()' however, we explicitly want to *allow* changing options
from the files sourced by that function. That's one of the main purposes
of the function.
I took the `emulate' call out entirely because it doesn't make sense
without `-L' in untility functions. I also hardened the function's code
a little when it's run with non-zsh-mode options (like sh_word_split).
Reported-by: Dominic Hopf
[ Ulrich Dangel ]
* zshrc: Removed `startx()' and `xinit()' functions
- -- Frank Terbeck <ft@grml.org> Sun, 21 Nov 2010 12:03:50 +0100
+ [ Frank Terbeck ]
+ * zshrc: Do not set `localoptions' in `xsource()'. That makes it
+ impossible to set options in `.zshrc.pre' or `.zshrc.local'. Reported
+ by Dominic Hopf. Thanks!
+
+ -- Frank Terbeck <ft@grml.org> Tue, 23 Nov 2010 23:13:50 +0100
grml-etc-core (0.3.84) unstable; urgency=low
# Check if we can read given files and source those we can.
xsource() {
- emulate -L zsh
if (( ${#argv} < 1 )) ; then
printf 'usage: xsource FILE(s)...\n' >&2
return 1
fi
while (( ${#argv} > 0 )) ; do
- [[ -r $1 ]] && source $1
+ [[ -r "$1" ]] && source "$1"
shift
done
return 0