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
2014-08-01 12:25:41 +00:00
\fish{synopsis}
2014-08-01 02:37:32 +00:00
block [OPTIONS...]
\endfish
2005-12-14 18:07:44 +00:00
\subsection block-description Description
2014-08-19 12:41:23 +00:00
`block` prevents events triggered by `fish` or the <a href="commands.html#emit">`emit`</a> command from being delivered and acted upon while the block is in place.
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
2014-08-19 12:41:23 +00:00
In functions, `block` can be useful while performing work that should not be interrupted by the shell.
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
2014-08-19 12:41:23 +00:00
The block can be removed. Any events which triggered while the block was in place will then be delivered.
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
2014-08-19 12:41:23 +00:00
Event blocks should not be confused with code blocks, which are created with `begin`, `if`, `while` or `for`
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
The following parameters are available:
2014-08-01 02:37:32 +00:00
- `-l` or `--local` Release the block automatically at the end of the current innermost code block scope
2014-08-19 12:41:23 +00:00
2014-08-01 02:37:32 +00:00
- `-g` or `--global` Never automatically release the lock
2014-08-19 12:41:23 +00:00
2014-08-01 02:37:32 +00:00
- `-e` or `--erase` Release global block
2005-12-14 18:07:44 +00:00
2014-08-19 12:41:23 +00:00
2005-12-14 18:07:44 +00:00
\subsection block-example Example
2014-08-01 02:37:32 +00:00
\fish
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
2014-08-01 02:37:32 +00:00
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
# Block the delivery of events
2006-09-19 14:52:03 +00:00
block -g
2014-08-01 02:37:32 +00:00
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
2014-08-01 02:37:32 +00:00
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
2014-08-01 02:37:32 +00:00
\endfish
2017-03-23 03:53:39 +00:00
2017-07-12 05:50:55 +00:00
\subsection block-notes Notes
2017-03-23 03:53:39 +00:00
Note that events are only received from the current fish process as there is no way to send events from one fish process to another.