summaryrefslogtreecommitdiff
path: root/Functions/MIME/zsh-mime-handler
diff options
context:
space:
mode:
authorAxel Beckert <abe@deuxchevaux.org>2013-11-07 14:52:31 +0100
committerAxel Beckert <abe@deuxchevaux.org>2013-11-07 14:52:31 +0100
commitd799ac78a744a5359563af55b4dee9e91255a1dc (patch)
tree73475ed7089e6ee050085a96b88018994b43bdfc /Functions/MIME/zsh-mime-handler
parentabfb3b136a4ad5b2832fb7d920442a2bb28c0697 (diff)
parent375115c7dfd6dff576915d25fe2ecdd381dd9d81 (diff)
downloadzsh-d799ac78a744a5359563af55b4dee9e91255a1dc.tar.gz
zsh-d799ac78a744a5359563af55b4dee9e91255a1dc.zip
Merge branch 'upstream' into debian
Diffstat (limited to 'Functions/MIME/zsh-mime-handler')
-rw-r--r--Functions/MIME/zsh-mime-handler15
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