1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-08-07 01:30:59 +02:00

users/17955: new "disown" style for MIME handlers.

Makes handlers put into the background run without job control.
This commit is contained in:
Peter Stephenson 2013-08-29 10:48:49 +01:00
parent 1a4730b8ee
commit 1c9931cc7d
3 changed files with 18 additions and 3 deletions

View file

@ -1,5 +1,9 @@
2013-08-29 Peter Stephenson <p.stephenson@samsung.com> 2013-08-29 Peter Stephenson <p.stephenson@samsung.com>
* users/17955: Doc/Zsh/contrib.yo,
Functions/MIME/zsh-mime-handler: "disown" style makes MIME
handlers put into background run without job control.
* based on 31641, 31642: Completion/Unix/Command/_make: support * based on 31641, 31642: Completion/Unix/Command/_make: support
a couple of different variants of make. a couple of different variants of make.

View file

@ -2861,6 +2861,14 @@ question is run using the tt(eval) builtin instead of by starting a new
tt(sh) process. This is more efficient, but may not work in the occasional tt(sh) process. This is more efficient, but may not work in the occasional
cases where the mailcap handler uses strict POSIX syntax. cases where the mailcap handler uses strict POSIX syntax.
) )
kindex(disown, MIME style)
item(tt(disown))(
If this boolean style is true, mailcap handlers started in the
background will be disowned, i.e. not subject to job control within
the parent shell. Such handlers nearly always produce their own
windows, so the only likely harmful side effect of setting the style is
that it becomes harder to kill jobs from within the shell.
)
kindex(execute-as-is, MIME style) kindex(execute-as-is, MIME style)
item(tt(execute-as-is))( item(tt(execute-as-is))(
This style gives a list of patterns to be matched against files This style gives a list of patterns to be matched against files

View file

@ -74,7 +74,7 @@ if [[ $suffix != *.* ]]; then
fi fi
suffix=${suffix#*.} suffix=${suffix#*.}
local handler flags no_sh no_bg arg local handler flags no_sh no_bg arg bg_flag="&"
integer i integer i
local -a exec_asis hand_nonex local -a exec_asis hand_nonex
@ -89,6 +89,9 @@ zsh-mime-contexts -a $suffix execute-as-is exec_asis || exec_asis=('*(*)' '*(/)'
zsh-mime-contexts -a $suffix handle-nonexistent hand_nonex || zsh-mime-contexts -a $suffix handle-nonexistent hand_nonex ||
hand_nonex=('[[:alpha:]]#:/*') hand_nonex=('[[:alpha:]]#:/*')
# Set to true if the job should be disowned.
zsh-mime-contexts -t $suffix disown && bg_flag="&!"
local pattern local pattern
local -a files local -a files
@ -309,8 +312,8 @@ else
# Otherwise it's equivalent to removing the eval and all the quotes, # Otherwise it's equivalent to removing the eval and all the quotes,
# including the (q) flags. # including the (q) flags.
if [[ -n $stdin ]]; then if [[ -n $stdin ]]; then
eval cat ${(q)argv} "|" ${(q)execargs} "&" eval cat ${(q)argv} "|" ${(q)execargs} $bg_flag
else else
eval ${(q)execargs} "&" eval ${(q)execargs} $bg_flag
fi fi
fi fi