2006-10-31 15:23:16 +00:00
|
|
|
\section block block - temporarily block delivery of events
|
2005-12-14 18:07:44 +00:00
|
|
|
|
|
|
|
\subsection block-synopsis Synopsis
|
|
|
|
<tt>block [OPTIONS...]</tt>
|
|
|
|
|
|
|
|
\subsection block-description Description
|
|
|
|
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 07:56:01 +00:00
|
|
|
\c block prevents events triggered by \c fish or the
|
|
|
|
<a href="commands.html#emit"><code>emit</code></a> command from
|
|
|
|
being delivered and acted upon while the block is in place.
|
|
|
|
|
|
|
|
In functions, \c block can be useful while performing work that
|
|
|
|
should not be interrupted by the shell.
|
|
|
|
|
|
|
|
The block can be removed. Any events which triggered while the
|
|
|
|
block was in place will then be delivered.
|
|
|
|
|
|
|
|
Event blocks should not be confused with code blocks, which are created
|
|
|
|
with <code>begin</code>, <code>if</code>, <code>while</code> or
|
|
|
|
<code>for</code>
|
|
|
|
|
|
|
|
The following parameters are available:
|
|
|
|
|
|
|
|
- <tt>-l</tt> or <tt>--local</tt> Release the block automatically at the end of the current innermost code block scope
|
2005-12-14 18:07:44 +00:00
|
|
|
- <tt>-g</tt> or <tt>--global</tt> Never automatically release the lock
|
|
|
|
- <tt>-e</tt> or <tt>--erase</tt> Release global block
|
|
|
|
|
|
|
|
\subsection block-example Example
|
|
|
|
|
2006-09-19 14:52:03 +00:00
|
|
|
<pre>
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 07:56:01 +00:00
|
|
|
# Create a function that listens for events
|
|
|
|
function --on-event foo foo; echo 'foo fired'; end
|
|
|
|
# Block the delivery of events
|
2006-09-19 14:52:03 +00:00
|
|
|
block -g
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 07:56:01 +00:00
|
|
|
emit foo
|
|
|
|
# No output will be produced
|
2005-12-14 18:07:44 +00:00
|
|
|
block -e
|
Help cleanup
Large list of changes, including formatting and typos for most commands.
More substantive changes have been made to alias, bind, block, break,
builtin, case, cd, commandline, count, else, emit, fish_config, funced,
function, functions, history, math, mimedb, nextd, not, popd, prevd,
pushd, pwd, random, read, set, set_color, switch, test, trap, type,
ulimit, umask, and while.
2013-05-12 07:56:01 +00:00
|
|
|
# 'foo fired' will now be printed
|
2005-12-14 18:07:44 +00:00
|
|
|
</pre>
|
|
|
|
|