zshrc: Do not set `localoptions' in `xsource()'
authorFrank Terbeck <ft@grml.org>
Tue, 23 Nov 2010 22:16:16 +0000 (23:16 +0100)
committerFrank Terbeck <ft@grml.org>
Tue, 23 Nov 2010 22:21:44 +0000 (23:21 +0100)
"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
debian/changelog
etc/zsh/zshrc

index 3509f4e..070e878 100644 (file)
@@ -3,7 +3,12 @@ grml-etc-core (0.3.85) UNRELEASED; urgency=low
   [ 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
 
index 068e10c..c1cc68d 100644 (file)
@@ -417,14 +417,13 @@ fi
 
 # 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