diff options
author | Axel Beckert <abe@deuxchevaux.org> | 2015-11-25 18:51:00 +0100 |
---|---|---|
committer | Axel Beckert <abe@deuxchevaux.org> | 2015-11-25 18:51:00 +0100 |
commit | 317ec32cb1cbd15b31e17bcb07f09c52cd37c44a (patch) | |
tree | 88a02c853dfafd82a2d551d862d8dfb056b1bee6 /Functions/Misc | |
parent | 1637291aaea12ddcfd549d50d49c480185995c1a (diff) | |
parent | cce4261a3c6f4bf78b483db61623c80e3c98d10b (diff) | |
download | zsh-317ec32cb1cbd15b31e17bcb07f09c52cd37c44a.tar.gz zsh-317ec32cb1cbd15b31e17bcb07f09c52cd37c44a.zip |
Merge tag 'zsh-5.1.1-test-1' into debian
Diffstat (limited to 'Functions/Misc')
-rw-r--r-- | Functions/Misc/add-zsh-hook | 2 | ||||
-rw-r--r-- | Functions/Misc/zcalc | 4 | ||||
-rw-r--r-- | Functions/Misc/zed | 35 | ||||
-rw-r--r-- | Functions/Misc/zrecompile | 2 |
4 files changed, 19 insertions, 24 deletions
diff --git a/Functions/Misc/add-zsh-hook b/Functions/Misc/add-zsh-hook index ee37d674d..fc39659ae 100644 --- a/Functions/Misc/add-zsh-hook +++ b/Functions/Misc/add-zsh-hook @@ -82,9 +82,11 @@ if (( del )); then else if (( ${(P)+hook} )); then if (( ${${(P)hook}[(I)$fn]} == 0 )); then + typeset -ga $hook set -A $hook ${(P)hook} $fn fi else + typeset -ga $hook set -A $hook $fn fi autoload $autoopts -- $fn diff --git a/Functions/Misc/zcalc b/Functions/Misc/zcalc index 63f67adb0..17700e48b 100644 --- a/Functions/Misc/zcalc +++ b/Functions/Misc/zcalc @@ -120,6 +120,10 @@ autoload -Uz zmathfuncdef float PI E (( PI = 4 * atan(1), E = exp(1) )) +if [[ -f "${ZDOTDIR:-$HOME}/.zcalcrc" ]]; then + . "${ZDOTDIR:-$HOME}/.zcalcrc" || return 1 +fi + # Process command line while [[ -n $1 && $1 = -(|[#-]*|f|e) ]]; do optlist=${1[2,-1]} diff --git a/Functions/Misc/zed b/Functions/Misc/zed index 010b69bee..eb8f557ea 100644 --- a/Functions/Misc/zed +++ b/Functions/Misc/zed @@ -6,31 +6,20 @@ # Use ^X^W to save, ^C to abort. # Option -f: edit shell functions. (Also if called as fned.) -local var opt zed_file_name +local var opts zed_file_name # We do not want timeout while we are editing a file integer TMOUT=0 okargs=1 fun bind local -a expand -while getopts "fbx:" opt; do - case $opt in - (f) - fun=1 - ;; - - (b) - bind=1 - ;; - - (x) - if [[ $OPTARG != <-> ]]; then - print -r "Integer expected after -x: $OPTARG" >&2 - return 1 - fi - expand=(-x $OPTARG) - ;; - esac -done -shift $(( OPTIND - 1 )) +zparseopts -D -A opts f b x: +fun=$+opts[-f] +bind=$+opts[-b] +if [[ $opts[-x] == <-> ]]; then + expand=(-x $opts[-x]) +elif (( $+opts[-x] )); then + print -r "Integer expected after -x: $opts[-x]" >&2 + return 1 +fi [[ $0 = fned ]] && fun=1 (( bind )) && okargs=0 @@ -80,10 +69,10 @@ fi setopt localoptions nobanghist if ((fun)) then - var="$(functions $expand $1)" + var="$(functions $expand -- $1)" # If function is undefined but autoloadable, load it if [[ $var = *\#\ undefined* ]] then - var="$(autoload +X $1; functions $1)" + var="$(autoload +X $1; functions -- $1)" elif [[ -z $var ]] then var="$1() { }" diff --git a/Functions/Misc/zrecompile b/Functions/Misc/zrecompile index 8fe990086..d9fc55020 100644 --- a/Functions/Misc/zrecompile +++ b/Functions/Misc/zrecompile @@ -52,7 +52,7 @@ while getopts ":tqp" opt; do fi esac done -shift OPTIND-${#tmp:-1} +shift OPTIND-${#tmp}-1 if [[ -n $check ]]; then ret=1 |