/etc/zsh/zshrc and /etc/skel/.zshrc: some more checks whether the global file has...
authorMichael Prokop <mika@grml.org>
Tue, 29 May 2007 14:31:48 +0000 (16:31 +0200)
committerMichael Prokop <mika@grml.org>
Tue, 29 May 2007 14:31:48 +0000 (16:31 +0200)
debian/changelog
etc/skel/.zshrc
etc/zsh/zshrc

index 1d5e5f6..cc579f9 100644 (file)
@@ -1,3 +1,10 @@
+grml-etc-core (0.3.7) unstable; urgency=low
+
+  * /etc/zsh/zshrc and /etc/skel/.zshrc: some more checks whether
+    the global file has been read.
+
+ -- Michael Prokop <mika@grml.org>  Tue, 29 May 2007 16:31:19 +0200
+
 grml-etc-core (0.3.6) unstable; urgency=low
 
   * /etc/zsh/zshrc: do not even add completion directories if
index e091eb5..9a885ff 100644 (file)
@@ -3,7 +3,7 @@
 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
 # Bug-Reports:   see http://grml.org/bugs/
 # License:       This file is licensed under the GPL v2.
-# Latest change: Fre Mai 25 01:27:47 CEST 2007 [mika]
+# Latest change: Die Mai 29 16:31:10 CEST 2007 [mika]
 ################################################################################
 
 # source ~/.zshrc.global {{{
   fi
 # }}}
 
+# check whether global file has been read {{{
+  if [ -z "$ZSHRC_GLOBAL_HAS_BEEN_READ" ] ; then
+     print 'Warning: global zsh config has not been read'>&2
+  fi
+# }}}
+
 # autoloading stuff {{{
-  # associate types and extensions:
-  autoload zsh-mime-setup && zsh-mime-setup
+# associate types and extensions:
+  type zsh-mime-setup &>/dev/null || { autoload zsh-mime-setup && zsh-mime-setup }
 # }}}
 
 # completion system {{{
   [ -d ~/.terminfo/ ] && alias man='TERMINFO=~/.terminfo/ LESS=C TERM=mostlike PAGER=less man'
 
 # check whether Debian's package management (dpkg) is running
-  salias check_dpkg_running="dpkg_running"
+  type salias &>/dev/null && salias check_dpkg_running="dpkg_running"
 
 # work around non utf8 capable software in utf environment
-  if [ -x $(which mrxvt) ] ; then
-     isutfenv && [ -n "$LANG" ] && alias mrxvt="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} mrxvt"
-  fi
-
-  if [ -x $(which aterm) ] ; then
-     isutfenv && [ -n "$LANG" ] && alias aterm="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} aterm"
-  fi
-
-  if [ -x $(which centericq) ] ; then
-     isutfenv && [ -n "$LANG" ] && alias centericq="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} centericq"
+  if type isutfenv &>/dev/null ; then
+     if [ -x $(which mrxvt) ] ; then
+        isutfenv && [ -n "$LANG" ] && alias mrxvt="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} mrxvt"
+     fi
+   
+     if [ -x $(which aterm) ] ; then
+        isutfenv && [ -n "$LANG" ] && alias aterm="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} aterm"
+     fi
+   
+     if [ -x $(which centericq) ] ; then
+        isutfenv && [ -n "$LANG" ] && alias centericq="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} centericq"
+     fi
   fi
 # }}}
 
 # Function Usage: doc packagename
   doc() { cd /usr/share/doc/$1 && ls }
   _doc() { _files -W /usr/share/doc -/ }
-  compdef _doc doc
+  type compdef &>/dev/null && compdef _doc doc
 
 # make screenshot of current desktop (use 'import' from ImageMagic)
   sshot() {
index d6a29f4..644070f 100644 (file)
@@ -3,7 +3,7 @@
 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
 # Bug-Reports:   see http://grml.org/bugs/
 # License:       This file is licensed under the GPL v2.
-# Latest change: Son Mai 27 19:12:26 CEST 2007 [mika]
+# Latest change: Die Mai 29 16:30:03 CEST 2007 [mika]
 ################################################################################
 # This file is sourced only for interactive shells. It
 # should contain commands to set up aliases, functions,
@@ -1267,5 +1267,9 @@ If you want to use xinit anyway please call \"/usr/bin/xinit\"."
   fi
 # }}}
 
+# add variable to be able to check whether the file has been read {{{
+  ZSHRC_GLOBAL_HAS_BEEN_READ=1
+# }}}
+
 ## END OF FILE #################################################################
 # vim:foldmethod=marker expandtab