/etc/zsh/zshrc: check for potentially old files in 'completion.d' 0.3.5
authorMichael Prokop <mika@grml.org>
Fri, 25 May 2007 00:09:18 +0000 (02:09 +0200)
committerMichael Prokop <mika@grml.org>
Fri, 25 May 2007 00:09:18 +0000 (02:09 +0200)
debian/NEWS
debian/changelog
etc/skel/.zshrc
etc/zsh/zshrc

index 0540e1a..12a5a2d 100644 (file)
@@ -1,3 +1,35 @@
+grml-etc-core (0.3.5) unstable; urgency=low
+
+  * Please notice, that the setup of zsh's completion functions has
+    been changed. The setup has been cleaned up but as a sideeffect
+    you might notice a problem like:
+
+     "_tags:comptags:67: can only be called from completion function"
+
+    when starting zsh. The reason for this change is because the files
+    inside /etc/zsh/completion.d/ have been renamed from 'foo' to
+    '_foo' and their content has been adjusted according to the new
+    setup too. If you added functions to completion.d yourself, please
+    consider moving them to /etc/zsh/functions.d/. Files in that
+    directory, not starting with an underscore are marked for
+    automatic loading by default (so that is quite convenient).
+
+    So to avoid above error message make sure you don't have any
+    dpkg-files *not* starting with a '_' in /etc/zsh/completion.d/
+    laying around. If there are files *not* starting with an
+    underscore from an older grml-etc-core in completion.d, you may
+    safely remove them.
+
+    Information regarding upgrading can be found also at:
+
+      http://wiki.grml.org/doku.php?id=upgrading
+
+    Information regarding (changing) zsh setup can be found at:
+
+      http://grml.org/zsh/#grmlzshrefcard
+
+ -- Michael Prokop <mika@grml.org>  Fri, 25 May 2007 01:32:27 +0200
+
 grml-etc-core (0.1-31) unstable; urgency=low
 
   * Please notice, that the behaviour of global aliases in /etc/skel/.zshrc
index 926ae6b..23295cb 100644 (file)
@@ -1,3 +1,13 @@
+grml-etc-core (0.3.5) unstable; urgency=low
+
+  * /etc/zsh/zshrc + /etc/skel/.zshrc: unify way of checking for
+    present binaries/executables
+  * /etc/zsh/zshrc: check for potentially old files in 'completion.d',
+    thanks for the patch - ft!
+  * /etc/skel/.zshrc: added alias ips for 'ipython -p sh'
+
+ -- Michael Prokop <mika@grml.org>  Fri, 25 May 2007 01:30:39 +0200
+
 grml-etc-core (0.3.4) unstable; urgency=low
 
   * /etc/zsh/zshrc: check for present directory inside dirstack
index aa1b3e3..e091eb5 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: Don Mai 17 15:08:21 CEST 2007 [mika]
+# Latest change: Fre Mai 25 01:27:47 CEST 2007 [mika]
 ################################################################################
 
 # source ~/.zshrc.global {{{
 # some useful aliases
   alias md='mkdir -p'
 
+  [ -x $(which ipython) ] && alias ips='ipython -p sh'
+
 # console stuff
   alias cmplayer='mplayer -vo fbdev'
   alias fbmplayer='mplayer -vo fbdev -fs -zoom'
   salias check_dpkg_running="dpkg_running"
 
 # work around non utf8 capable software in utf environment
-  if [ -x /usr/bin/mrxvt ] ; then
+  if [ -x $(which mrxvt) ] ; then
      isutfenv && [ -n "$LANG" ] && alias mrxvt="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} mrxvt"
   fi
 
-  if [ -x /usr/bin/aterm ] ; then
+  if [ -x $(which aterm) ] ; then
      isutfenv && [ -n "$LANG" ] && alias aterm="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} aterm"
   fi
 
-  if [ -x /usr/bin/centericq ] ; then
+  if [ -x $(which centericq) ] ; then
      isutfenv && [ -n "$LANG" ] && alias centericq="LANG=${LANG/(#b)(*)[.@]*/$match[1].iso885915} centericq"
   fi
 # }}}
 
 # hl() highlighted less
 # http://ft.bewatermyfriend.org/comp/data/zsh/zfunct.html
-  if [[ -x $(which highlight) ]] ; then
+  if [ -x $(which highlight) ] ; then
     function hl() {
       local theme lang
       theme=${HL_THEME:-""}
 
 # Work around ion/xterm resize bug.
 #if [ "$SHLVL" = 1 ]; then
-#       if [ -x `which resize 2>/dev/null` ]; then
+#       if [ -x $(which resize) ]; then
 #               eval `resize </dev/null`
 #       fi
 #fi
index 6b71d16..46d3d64 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: Mit Mai 23 10:22:10 CEST 2007 [mika]
+# Latest change: Fre Mai 25 02:03:29 CEST 2007 [mika]
 ################################################################################
 # This file is sourced only for interactive shells. It
 # should contain commands to set up aliases, functions,
   fi
 # }}}
 
+# check for potentially old files in 'completion.d' {{{
+  setopt extendedglob
+  xof=(/etc/zsh/completion.d/*~/etc/zsh/completion.d/_*(N))
+  if (( ${#xof} > 0 )) ; then
+    printf '\n -!- INFORMATION\n\n'
+    printf ' -!- %s file(s) not starting with an underscore (_) found in\n' ${#xof}
+    printf ' -!- /etc/zsh/completion.d/.\n\n'
+    printf ' -!- While this has been the case in old versions of grml-etc-core,\n'
+    printf ' -!- recent versions of the grml-zsh-setup have all these files rewritten\n'
+    printf ' -!- and renamed. Furthermore, the grml-zsh-setup will *only* add files\n'
+    printf ' -!- named _* to that directory.\n\n'
+    printf ' -!- If you added functions to completion.d yourself, please consider\n'
+    printf ' -!- moving them to /etc/zsh/functions.d/. Files in that directory, not\n'
+    printf ' -!- starting with an underscore are marked for automatic loading\n'
+    printf ' -!- by default (so that is quite convenient).\n\n'
+    printf ' -!- If there are files *not* starting with an underscore from an older\n'
+    printf ' -!- grml-etc-core in completion.d, you may safely remove them.\n\n'
+    printf ' -!- Delete the files for example via running:\n\n'
+    printf "      rm ${xof}\n\n"
+    printf ' -!- Note, that this message will *not* go away, unless you yourself\n'
+    printf ' -!- resolve the situation manually.\n\n'
+  fi
+  unset xof
+# }}}
+
 # {{{ check for version/system
 # check for versions (compatibility reasons)
   if autoload is-at-least && is-at-least 2>/dev/null ; then
   # if we don't set $SHELL then aterm, rxvt,.. will use /bin/sh or /bin/bash :-/
   export SHELL='/bin/zsh'
   [[ -f ~/.terminfo/m/mostlike ]] && MYLESS='LESS=C TERMINFO=~/.terminfo TERM=mostlike less' || MYLESS='less'
-  [[ -x /usr/bin/dircolors ]] && eval `dircolors -b`
+  [ -x $(which dircolors) ] && eval `dircolors -b`
 
 # Search path for the cd comman
 #  cdpath=(.. ~)
@@ -669,7 +694,7 @@ ${BLUE}%n${NO_COLOUR}@%m %40<...<%B%~%b%<< %# "
   alias 0 &>/dev/null || functions 0 &>/dev/null || alias 0='return 0'
 
 # truecrypt; use e.g. via 'truec /dev/ice /mnt/ice' or 'truec -i'
-  if [ -x /usr/sbin/truecrypt ] ; then
+  if [ -x $(which truecrypt) ] ; then
      if isutfenv ; then
         alias truec='truecrypt --mount-options "rw,sync,dirsync,users,uid=1000,gid=users,umask=077,utf8" '
      else
@@ -764,7 +789,7 @@ Enjoy your grml system with the zsh!$reset_color"
   fi
 
 # sort installed Debian-packages by size
-  if [ -x /usr/bin/grep-status ] ; then
+  if [ -x $(which grep-status) ] ; then
      alias debs-by-size='grep-status -FStatus -sInstalled-Size,Package \
                 -n "install ok installed" | paste -sd "  \n" | sort -rn'
   fi
@@ -780,7 +805,7 @@ Please use the wodim binary instead' ; return 1"
   fi
 
 # get_tw_cli has been renamed into get_3ware
-  if [ -x /usr/bin/get_3ware ] ; then
+  if [ -x $(which get_3ware) ] ; then
      get_tw_cli() {
        echo 'Warning: get_tw_cli has been renamed into get_3ware. Invoking get_3ware for you.'>&2
        get_3ware
@@ -788,7 +813,7 @@ Please use the wodim binary instead' ; return 1"
   fi
 
 # I hate lacking backward compability, so provide an alternative therefore
-  if ! [ -x /usr/sbin/apache2-ssl-certificate ] ; then
+  if ! [ -x $(which apache2-ssl-certificate) ] ; then
    function apache2-ssl-certificate(){
 
      print 'Debian does not ship apache2-ssl-certificate anymore (see #398520). :('
@@ -978,17 +1003,17 @@ If you want to use xinit anyway please call \"/usr/bin/xinit\"."
     fi
   }
 
-  if [ -x /usr/sbin/915resolution ] ; then
+  if [ -x $(which 915resolution) ] ; then
      alias 855resolution='echo -e "Please use 915resolution as resolution modify tool for Intel graphic chipset."; return -1'
   fi
 
   alias grml-version='cat /etc/grml_version'
 
-  if [ -x /usr/sbin/rebuildfstab ] ; then
+  if [ -x $(which rebuildfstab) ] ; then
      alias grml-rebuildfstab='rebuildfstab -v -r -config'
   fi
 
-  if [ -x /usr/sbin/grml-debootstrap ] ; then
+  if [ -x $(which grml-debootstrap) ] ; then
      alias debian2hd='print "Installing debian to harddisk is possible via using grml-debootstrap." ; return 1'
   fi
 }
@@ -1057,7 +1082,7 @@ If you want to use xinit anyway please call \"/usr/bin/xinit\"."
      # manzsh()  { man zshall | $MYLESS -p $1 ; }
   fi
 
-  if [ -x /usr/bin/most ] ; then
+  if [ -x $(which most) ] ; then
   # use "dchange <package-name>" to view Debian's changelog of the package:
     dchange() {
       if [ -r /usr/share/doc/${1}/changelog.Debian.gz ] ; then