From a2eb5e1411e4ad4860c7c70735b9a59c703f16da Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Mon, 12 Oct 2009 01:10:30 +0200 Subject: [PATCH] zshrc: actively do: "setopt unset" It seems like some people think it is a good idea to unset that option. That is a very bad idea though. Why? Well, because of this: % unset foo % echo "foo$foo" zsh: foo: parameter not set That is totally incompatible with every other bourne like shell out there. And it breaks many shell idioms. In fact, it will break at least 'vcs_info()' and 'accept_line()' for us. Which is unacceptable. I also added 'emulate -L zsh' to accept-line() and vcs_info(), which are two functions, that will fail horribly with 'unset' unset. That will leave the shell intact even if someone wants to 'setopt no_unset' in his/her .zshrc.local --- debian/changelog | 3 ++- etc/zsh/zshrc | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/debian/changelog b/debian/changelog index c8e2dd3..196e937 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,8 +3,9 @@ grml-etc-core (0.3.76) UNRELEASED; urgency=low * zshrc: add openssl hash functions [Closes: issue741] * zshrc: use history-incremental-pattern-search-* for incremental history searches per default (via ^r and ^s). + * zshrc: actively do 'setopt unset' - -- Frank Terbeck Thu, 08 Oct 2009 11:29:38 +0200 + -- Frank Terbeck Mon, 12 Oct 2009 01:10:02 +0200 grml-etc-core (0.3.75) unstable; urgency=low diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 43e77a1..2cff02b 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -281,6 +281,7 @@ setopt nobeep # avoid "beep"ing setopt pushd_ignore_dups # don't push the same dir twice. setopt noglobdots # * shouldn't match dotfiles. ever. setopt noshwordsplit # use zsh style word splitting +setopt unset # don't error out when unset parameters are used # }}} @@ -649,7 +650,7 @@ fi zstyle ':acceptline:*' rehash true function Accept-Line() { - setopt localoptions noksharrays + emulate -L zsh local -a subs local -xi aldone local sub @@ -668,6 +669,7 @@ function Accept-Line() { } function Accept-Line-getdefault() { + emulate -L zsh local default_action zstyle -s ":acceptline:${alcontext}" default_action default_action @@ -682,7 +684,7 @@ function Accept-Line-getdefault() { } function accept-line() { - setopt localoptions noksharrays + emulate -L zsh local -a cmdline local -x alcontext local buf com fname format msg default_action @@ -1850,6 +1852,7 @@ vcs_info_printsys () { # {{{ } # }}} vcs_info_lastmsg () { # {{{ + emulate -L zsh local -i i VCS_INFO_maxexports @@ -1865,6 +1868,8 @@ vcs_info_lastmsg () { # {{{ } # }}} vcs_info () { # {{{ + emulate -L zsh + setopt extendedglob local pat local -i found local -a VCSs disabled dps -- 2.1.4