diff options
author | Peter Stephenson <pws@users.sourceforge.net> | 2005-10-25 22:50:46 +0000 |
---|---|---|
committer | Peter Stephenson <pws@users.sourceforge.net> | 2005-10-25 22:50:46 +0000 |
commit | a1bf618b569636bf5b0a9dedddc0b6d3d5c3efc6 (patch) | |
tree | 6b8561d52b393a62a3543d7a27e5728dd8bf2874 /Functions/MIME/zsh-mime-handler | |
parent | 4dc44ce027c07c68a766a2f7123d82ee8a166ddb (diff) | |
download | zsh-a1bf618b569636bf5b0a9dedddc0b6d3d5c3efc6.tar.gz zsh-a1bf618b569636bf5b0a9dedddc0b6d3d5c3efc6.tar.xz zsh-a1bf618b569636bf5b0a9dedddc0b6d3d5c3efc6.zip |
21933: R. Ramkumar: three new styles for MIME handler
21935: documentation for same.
Diffstat (limited to 'Functions/MIME/zsh-mime-handler')
-rw-r--r-- | Functions/MIME/zsh-mime-handler | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/Functions/MIME/zsh-mime-handler b/Functions/MIME/zsh-mime-handler index b64fd54cd..297b637be 100644 --- a/Functions/MIME/zsh-mime-handler +++ b/Functions/MIME/zsh-mime-handler @@ -44,13 +44,22 @@ local -a match mbegin mend suffix=$match[1] context=":mime:.${suffix}:" -local handler flags +local handler flags no_sh no_bg zstyle -s $context handler handler || handler="${zsh_mime_handlers[$suffix]}" zstyle -s $context flags flags || flags="${zsh_mime_flags[$suffix]}" +# Set to yes if we use eval instead of sh -c for complicated mailcap lines +# Can possibly break some mailcap entries which expect sh compatibility, +# is faster, as a new process is not spawned. +zstyle -T $context current-shell && no_sh=yes + +# Set to yes if the process shouldn't be backgrounded even if it doesn't need a +# terminal and display is set. +zstyle -T $context never-background && no_bg=yes + local -a files local hasmeta stdin @@ -82,7 +91,11 @@ if [[ $handler = *%s* ]]; then files=(${(q)argv}) zformat -f command $handler s:"$files" fi - execargs=(sh -c $command) + if [[ $no_sh = yes ]]; then + execargs=(eval $command) + else + execargs=(sh -c $command) + fi else # Simple command, one filename. # Split and add the file without extra quoting, @@ -95,7 +108,7 @@ if [[ $handler = *%s* ]]; then else # If there's no %s, the input is supposed to come from stdin. stdin=1 - if [[ -n $hasmeta ]]; then + if [[ -n $hasmeta && $no_sh != yes ]]; then execargs=(sh -c "$handler") else execargs=(${=handler}) @@ -113,7 +126,7 @@ if [[ $flags = *copiousoutput* ]]; then else $execargs | eval ${PAGER:-more} fi -elif [[ $flags = *needsterminal* || -z $DISPLAY ]]; then +elif [[ $no_bg = yes || $flags = *needsterminal* || -z $DISPLAY ]]; then # Needs a terminal, so run synchronously. # Obviously, if $DISPLAY is empty but the handler needs a # GUI we are in trouble anyway. However, it's possible for |