about summary refs log tree commit diff
path: root/Functions/MIME
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2006-04-05 10:26:30 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2006-04-05 10:26:30 +0000
commit293082867800add063072dbfcdd65458ae1fcb28 (patch)
tree1e839c5dfc36a966c337e388c35c302abe4da1f9 /Functions/MIME
parentfd92cf568670f733b36fb5bbb73607cbf915199f (diff)
downloadzsh-293082867800add063072dbfcdd65458ae1fcb28.tar.gz
zsh-293082867800add063072dbfcdd65458ae1fcb28.tar.xz
zsh-293082867800add063072dbfcdd65458ae1fcb28.zip
22394, 22043: execute-as-is style for MIME suffixes
Diffstat (limited to 'Functions/MIME')
-rw-r--r--Functions/MIME/zsh-mime-handler16
1 files changed, 16 insertions, 0 deletions
diff --git a/Functions/MIME/zsh-mime-handler b/Functions/MIME/zsh-mime-handler
index b8c6b6925..ab0c27fb0 100644
--- a/Functions/MIME/zsh-mime-handler
+++ b/Functions/MIME/zsh-mime-handler
@@ -45,6 +45,22 @@ suffix=$match[1]
 context=":mime:.${suffix}:"
 
 local handler flags no_sh no_bg
+local -a exec_asis
+
+# 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.
+zstyle -a $context execute-as-is exec_asis || exec_asis=('*(*)')
+
+local pattern
+
+for pattern in $exec_asis; do
+    if [[ $1 = ${~pattern} ]]; then
+	"$@"
+	return 0
+    fi
+done
 
 zstyle -s $context handler handler ||
   handler="${zsh_mime_handlers[$suffix]}"