From 061e80950223501fbcb77e987a9a0dafedf6f229 Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Sun, 8 Sep 2013 21:12:13 +0100 Subject: 31711: add execute-never style for MIME function system. Allows alien file systems to be marked as not having executable fiels --- Functions/MIME/zsh-mime-handler | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Functions') diff --git a/Functions/MIME/zsh-mime-handler b/Functions/MIME/zsh-mime-handler index 7245c20e2..24e5184fc 100644 --- a/Functions/MIME/zsh-mime-handler +++ b/Functions/MIME/zsh-mime-handler @@ -76,13 +76,14 @@ suffix=${suffix#*.} 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. @@ -125,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 " " -- cgit 1.4.1