aboutsummaryrefslogtreecommitdiffhomepage
path: root/doc_src
diff options
context:
space:
mode:
authorGravatar liljencrantz <liljencrantz@gmail.com>2008-01-17 08:25:31 +1000
committerGravatar liljencrantz <liljencrantz@gmail.com>2008-01-17 08:25:31 +1000
commit88a2b622df50d5f9c85a3912826ae93b603992a0 (patch)
tree3493db885f469b63fe7676f0f7d497f6a10825b8 /doc_src
parente10f75483fcbf44a813e9fd446529bccc1e52eee (diff)
Add more documentation on events
darcs-hash:20080116222531-75c98-ef30dabc492d7883dbb620c40ef95152469057a3.gz
Diffstat (limited to 'doc_src')
-rw-r--r--doc_src/function.txt6
-rw-r--r--doc_src/index.hdr.in1
2 files changed, 7 insertions, 0 deletions
diff --git a/doc_src/function.txt b/doc_src/function.txt
index 7bf7ced2..829530f6 100644
--- a/doc_src/function.txt
+++ b/doc_src/function.txt
@@ -6,6 +6,7 @@
\subsection function-description Description
- <code>-d DESCRIPTION</code> or \c --description=DESCRIPTION is a description of what the function does, suitable as a completion description
+- <code>-e</code> or <code>--on-event EVENT_NAME</code> tells fish to run this function when the specified named event is emitted. Fish internally generates named events e.g. when showing the prompt.
- <code>-j PID</code> or <code> --on-job-exit PID</code> tells fish to run this function when the job with group id PID exits. Instead of PID, the string 'caller' can be specified. This is only legal when in a command substitution, and will result in the handler being triggered by the exit of the job which created this command substitution.
- <code>-p PID</code> or <code> --on-process-exit PID</code> tells fish to run this function when the fish child process with process id PID exits
- <code>-s</code> or <code>--on-signal SIGSPEC</code> tells fish to run this function when the signal SIGSPEC is delivered. SIGSPEC can be a signal number, or the signal name, such as SIGHUP (or just HUP)
@@ -26,6 +27,11 @@ will write <code>hello</code> whenever the user enters \c hi.
If the user enters any additional arguments after the function, they
are inserted into the environment <a href="index.html#variables-arrays">variable array</a> argv.
+By using one of the event handler switches, a function can be made to run automatically at specific events. The user may generate new events using the <a href='#emit">emit</a> builtin. Fish generates the following named events:
+
+- \c fish_prompt, which is emitted whenever a new fish prompt is about to be displayed
+- \c fish_command_not_found, which is emitted whenever a command lookup failed
+
\subsection function-example Example
<pre>
diff --git a/doc_src/index.hdr.in b/doc_src/index.hdr.in
index 3ca0dbbd..51d5b32d 100644
--- a/doc_src/index.hdr.in
+++ b/doc_src/index.hdr.in
@@ -1266,6 +1266,7 @@ specific event takes place. Events that can trigger a handler currently are:
- When a process or job exits
- When the value of a variable is updated
- When the prompt is about to be shown
+- When a command lookup fails
Example: