From 1287b9d82382bf22e16edda67eae755f07397f2e Mon Sep 17 00:00:00 2001 From: "David Adam (zanchey)" Date: Sun, 12 May 2013 15:56:01 +0800 Subject: 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. --- doc_src/block.txt | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'doc_src/block.txt') diff --git a/doc_src/block.txt b/doc_src/block.txt index 670a39b2..0f4cff38 100644 --- a/doc_src/block.txt +++ b/doc_src/block.txt @@ -5,15 +5,36 @@ \subsection block-description Description -- -l or --local Release the block at the end of the currently innermost block scope +\c block prevents events triggered by \c fish or the +emit 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 begin, if, while or +for + +The following parameters are available: + +- -l or --local Release the block automatically at the end of the current innermost code block scope - -g or --global Never automatically release the lock - -e or --erase Release global block \subsection block-example Example
+# Create a function that listens for events
+function --on-event foo foo; echo 'foo fired'; end
+# Block the delivery of events
 block -g
-\#Do something that should not be interrupted
+emit foo
+# No output will be produced
 block -e
+# 'foo fired' will now be printed
 
-- cgit v1.2.3