diff options
Diffstat (limited to 'Functions/MIME')
-rw-r--r-- | Functions/MIME/zsh-mime-handler | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Functions/MIME/zsh-mime-handler b/Functions/MIME/zsh-mime-handler index abaf0b6e3..24e5184fc 100644 --- a/Functions/MIME/zsh-mime-handler +++ b/Functions/MIME/zsh-mime-handler @@ -74,21 +74,25 @@ if [[ $suffix != *.* ]]; then fi suffix=${suffix#*.} -local handler flags no_sh no_bg arg +local handler flags no_sh no_bg arg bg_flag="&" integer i -local -a exec_asis hand_nonex +local -a exec_asis hand_nonex exec_never # Set to a list of patterns which are ignored and executed as they are, # despite being called for interpretation by the mime handler. # Defaults to executable files, which ensures that they are executed as # they are, even if they have a suffix. zsh-mime-contexts -a $suffix execute-as-is exec_asis || exec_asis=('*(*)' '*(/)') +zsh-mime-contexts -a $suffix execute-never exec_never # Set to a list of patterns for which the handler will be used even # if the file doesn't exist on the disk. zsh-mime-contexts -a $suffix handle-nonexistent hand_nonex || hand_nonex=('[[:alpha:]]#:/*') +# Set to true if the job should be disowned. +zsh-mime-contexts -t $suffix disown && bg_flag="&!" + local pattern local -a files @@ -122,6 +126,9 @@ fi for pattern in $exec_asis; do files=(${dirpref}${~pattern}) if [[ -n ${files[(r)$1]} ]]; then + for pattern in $exec_never; do + [[ ${1:A} = ${~pattern} ]] && break 2 + done if (( list )); then for (( i = 1; i <= $#; i++ )); do (( i == 1 )) || print -n " " @@ -309,8 +316,8 @@ else # Otherwise it's equivalent to removing the eval and all the quotes, # including the (q) flags. if [[ -n $stdin ]]; then - eval cat ${(q)argv} "|" ${(q)execargs} "&" + eval cat ${(q)argv} "|" ${(q)execargs} $bg_flag else - eval ${(q)execargs} "&" + eval ${(q)execargs} $bg_flag fi fi |