+@node Formula syntax for Lisp, Field formulas, Formula syntax for Calc, The spreadsheet
+@subsection Emacs Lisp forms as formulas
+@cindex Lisp forms, as table formulas
+
+It is also possible to write a formula in Emacs Lisp; this can be useful
+for string manipulation and control structures. If a formula starts
+with a single quote followed by an opening parenthesis, then it is
+evaluated as a lisp form. The evaluation should return either a string
+or a number. Just as with @file{calc} formulas, you can specify modes
+and a printf format after a semicolon. A reference will be replaced
+with a string (in double quotes) containing the field. If you provide
+the @samp{N} mode switch, all referenced elements will be numbers.
+Ranges are inserted as space-separated fields, so you can embed them in
+list or vector syntax. A few examples, note how the @samp{N} mode is
+used when we do computations in lisp.
+
+@example
+@r{Swap the first two characters of the content of column 1}
+ '(concat (substring $1 1 2) (substring $1 0 1) (substring $1 2))
+@r{Add columns 1 and 2, equivalent to the Calc's @code{$1+$2}}
+ '(+ $1 $2);N
+@r{Compute the sum of columns 1-4, like Calc's @code{vsum($1..$4)}}
+ '(apply '+ '($1..$4));N
+@end example
+
+@node Field formulas, Column formulas, Formula syntax for Lisp, The spreadsheet
+@subsection Field formulas
+@cindex field formula
+@cindex formula, for individual table field
+
+To assign a formula to a particular field, type it directly into the
+field, preceded by @samp{:=}, for example @samp{:=$1+$2}. When you
+press @key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in
+the field, the formula will be stored as the formula for this field,
+evaluated, and the current field replaced with the result.
+
+Formulas are stored in a special line starting with @samp{#+TBLFM:}
+directly below the table. If you typed the equation in the 4th field of
+the 3rd data line in the table, the formula will look like
+@samp{@@3$2=$1+$2}. When inserting/deleting/swapping column and rows
+with the appropriate commands, @i{absolute references} (but not relative
+ones) in stored formulas are modified in order to
+still reference the same field. Of cause this is not true if you edit
+the table structure with normal editing commands - then you must go and
+fix equations yourself.
+
+Instead of typing an equation into the field, you may also use the
+following command
+
+@table @kbd
+@kindex C-u C-c =
+@item C-u C-c =
+Install a new formula for the current field. The command prompts for a
+formula, with default taken from the @samp{#+TBLFM:} line, applies
+it to the current field and stores it.
+@end table
+
+@node Column formulas, Editing and debugging formulas, Field formulas, The spreadsheet
+@subsection Column formulas
+@cindex column formula
+@cindex formula, for table column
+
+Often in a table, the same formula should be used for all fields in a
+particular column. Instead of having to copy the formula to all fields
+in that column, org-mode allows to assign a single formula to an entire
+column.
+
+To assign a formula to a column, type it directly into any field in the
+column, preceded by an equal sign, like @samp{=$1+$2}. When you press
+@key{TAB} or @key{RET} or @kbd{C-c C-c} with the cursor still in the
+field, the formula will be stored as the formula for the current column,
+evaluated and the current field replaced with the result. If the field
+contains only @samp{=}, the previously stored formula for this column is
+used. For each column, Org-mode will only remember the most recently
+used formula. In the @samp{TBLFM:} line, column formulas will look like
+@samp{$4=$1+$2}.
+
+Instead of typing an equation into the field, you may also use the
+following command:
+
+@table @kbd
+@kindex C-c =
+@item C-c =
+Install a new formula for the current column and replace current field
+with the result of the formula. The command prompts for a formula, with
+default taken from the @samp{#+TBLFM} line, applies it to the current
+field and stores it. With a numerical prefix (e.g. @kbd{C-5 C-c =})
+will apply it to that many consecutive fields in the current column.
+@end table
+
+
+@node Editing and debugging formulas, Updating the table, Column formulas, The spreadsheet
+@subsection Editing and Debugging formulas
+@cindex formula editing
+@cindex editing, of table formulas
+
+You can edit individual formulas in the minibuffer or directly in the
+field. Org-mode can also prepare a special buffer with all active
+formulas of a table.
+
+@table @kbd
+@kindex C-c =
+@kindex C-u C-c =
+@item C-c =
+@itemx C-u C-c =
+Edit the formula associated with the current column/field in the
+minibuffer. See @ref{Column formulas} and @ref{Field formulas}.
+@kindex C-u C-u C-c =
+@item C-u C-u C-c =
+Re-insert the active formula (either a
+field formula, or a column formula) into the current field, so that you
+can edit it directly in the field. The advantage over editing in the
+minibuffer is that you can use the command @kbd{C-c ?}.
+@kindex C-c ?
+@item C-c ?
+While editing a formula in a table field, highlight the field(s)
+referenced by the reference at the cursor position in the formula.
+@kindex C-c '
+@item C-c '
+Edit all formulas for the current table in a special buffer, where the
+formulas will be displayed one per line.
+While inside the special buffer, Org-mode will automatically highlight
+any field or range reference at the cursor position. You may edit,
+remove and add formulas, and use the following commands:
+@table @kbd
+@kindex C-c C-c
+@item C-c C-c
+Exit the buffer and store the modified formulas. With @kbd{C-u} prefix,
+also apply the new formulas to the entire table.
+@kindex C-c C-q
+@item C-c C-q
+Exit the buffer without installing changes.
+@kindex @key{TAB}
+@item @key{TAB}
+Pretty-print or indent lisp formula at point. When in a line containing
+a lisp formula, format the formula according to Emacs Lisp rules.
+Another @key{TAB} collapses the formula back again. In the open
+formula, @key{TAB} re-indents just like in Emacs-lisp-mode.
+@kindex M-@key{TAB}
+@item M-@key{TAB}
+Complete Lisp symbols, just like in Emacs-lisp-mode.
+@kindex S-@key{up}
+@kindex S-@key{down}
+@item S-@key{up}/@key{down}
+Move the reference line in the Org-mode buffer up and down. This is
+important for highlighting the references of column formulas for
+different rows.
+@kindex M-@key{up}
+@kindex M-@key{down}
+@item M-@key{up}/@key{down}
+Scroll the window displaying the table.
+@end table
+@kindex C-c @}
+@item C-c @}
+Toggle the display of row and column numbers for a table, using
+overlays. These are uptated each time the table is aligned, you can
+force it with @kbd{C-c C-c}.
+@kindex C-c @{
+@item C-c @{
+Toggle the formula debugger on and off. See below.
+@end table
+
+Making a table field blank does not remove the formula associated with
+the field, because that is stored in a different line (the @samp{TBLFM}
+line) - during the next recalculation the field will be filled again.
+To remove a formula from a field, you have to give an empty reply when
+prompted for the formula, or to edit the @samp{#+TBLFM} line.
+
+@kindex C-c C-c
+You may edit the @samp{#+TBLFM} directly and re-apply the changed
+equations with @kbd{C-c C-c} in that line, or with the normal
+recalculation commands in the table.
+
+@subsubheading Debugging formulas
+@cindex formula debugging
+@cindex debugging, of table formulas
+When the evaluation of a formula leads to an error, the field content
+becomes the string @samp{#ERROR}. If you would like see what is going
+on during variable substitution and calculation in order to find a bug,
+turn on formula debugging in the @code{Tbl} menu and repeat the
+calculation, for example by pressing @kbd{C-c = @key{RET}} in a field.
+Detailed information will be displayed.
+
+@node Updating the table, Advanced features, Editing and debugging formulas, The spreadsheet
+@subsection Updating the Table
+@cindex recomputing table fields
+@cindex updating, table
+
+Recalculation of a table is normally not automatic, but needs to be
+triggered by a command. See @ref{Advanced features} for a way to make
+recalculation at least semi-automatically.
+
+In order to recalculate a line of a table or the entire table, use the
+following commands:
+
+@table @kbd
+@kindex C-c *
+@item C-c *
+Recalculate the current row by first applying the stored column formulas
+from left to right, and all field formulas in the current row.
+
+@kindex C-u C-c *
+@item C-u C-c *
+@kindex C-u C-c C-c
+@itemx C-u C-c C-c
+Recompute the entire table, line by line. Any lines before the first
+hline are left alone, assuming that these are part of the table header.
+
+@kindex C-u C-u C-c *
+@item C-u C-u C-c *
+Iterate the table by recomputing it until no further changes occur.
+This may be necessary if some computed fields use the value of other
+fields that are computed @i{later} in the calculation sequence.
+@end table
+
+
+@node Advanced features, , Updating the table, The spreadsheet
+@subsection Advanced features
+
+If you want the recalculation of fields to happen automatically, or if
+you want to be able to assign @i{names} to fields and columns, you need
+to reserve the first column of the table for special marking characters.
+@table @kbd
+@kindex C-#
+@item C-#
+Rotate the calculation mark in first column through the states @samp{},
+@samp{#}, @samp{*}, @samp{!}, @samp{$}. The meaning of these characters
+is discussed below. When there is an active region, change all marks in
+the region.
+@end table
+
+Here is an example of a table that collects exam results of students and
+makes use of these features:
+
+@example
+@group
+|---+---------+--------+--------+--------+-------+------|
+| | Student | Prob 1 | Prob 2 | Prob 3 | Total | Note |
+|---+---------+--------+--------+--------+-------+------|
+| ! | | P1 | P2 | P3 | Tot | |
+| # | Maximum | 10 | 15 | 25 | 50 | 10.0 |
+| ^ | | m1 | m2 | m3 | mt | |
+|---+---------+--------+--------+--------+-------+------|
+| # | Peter | 10 | 8 | 23 | 41 | 8.2 |
+| # | Sara | 6 | 14 | 19 | 39 | 7.8 |
+| # | Sam | 2 | 4 | 3 | 9 | 1.8 |
+|---+---------+--------+--------+--------+-------+------|
+| | Average | | | | 29.7 | |
+| ^ | | | | | at | |
+| $ | max=50 | | | | | |
+|---+---------+--------+--------+--------+-------+------|
+#+TBLFM: $6=vsum($P1..$P3)::$7=10*$Tot/$max;%.1f::$at=vmean(@@-II..@@-I);%.1f
+@end group
+@end example
+
+@noindent @b{Important}: Please note that for these special tables,
+recalculating the table with @kbd{C-u C-c *} will only affect rows that
+are marked @samp{#} or @samp{*}, and fields that have a formula assigned
+to the field itself. The column formulas are not applied in rows with
+empty first field.
+
+@cindex marking characters, tables
+The marking characters have the following meaning:
+@table @samp
+@item !
+The fields in this line define names for the columns, so that you may
+refer to a column as @samp{$Tot} instead of @samp{$6}.
+@item ^
+This row defines names for the fields @emph{above} the row. With such
+a definition, any formula in the table may use @samp{$m1} to refer to
+the value @samp{10}. Also, if you assign a formula to a names field, it
+will be stored as @samp{$name=...}.
+@item _
+Similar to @samp{^}, but defines names for the fields in the row
+@emph{below}.
+@item $
+Fields in this row can define @emph{parameters} for formulas. For
+example, if a field in a @samp{$} row contains @samp{max=50}, then
+formulas in this table can refer to the value 50 using @samp{$max}.
+Parameters work exactly like constants, only that they can be defined on
+a per-table basis.
+@item #
+Fields in this row are automatically recalculated when pressing
+@key{TAB} or @key{RET} or @kbd{S-@key{TAB}} in this row. Also, this row
+is selected for a global recalculation with @kbd{C-u C-c *}. Unmarked
+lines will be left alone by this command.
+@item *
+Selects this line for global recalculation with @kbd{C-u C-c *}, but
+not for automatic recalculation. Use this when automatic
+recalculation slows down editing too much.
+@item
+Unmarked lines are exempt from recalculation with @kbd{C-u C-c *}.
+All lines that should be recalculated should be marked with @samp{#}
+or @samp{*}.
+@item /
+Do not export this line. Useful for lines that contain the narrowing
+@samp{<N>} markers.
+@end table
+
+Finally, just to whet your appetite on what can be done with the
+fantastic @file{calc} package, here is a table that computes the Taylor
+series of degree @code{n} at location @code{x} for a couple of functions
+(homework: try that with Excel :-)
+
+@example
+@group
+|---+-------------+---+-----+--------------------------------------|
+| | Func | n | x | Result |
+|---+-------------+---+-----+--------------------------------------|
+| # | exp(x) | 1 | x | 1 + x |
+| # | exp(x) | 2 | x | 1 + x + x^2 / 2 |
+| # | exp(x) | 3 | x | 1 + x + x^2 / 2 + x^3 / 6 |
+| # | x^2+sqrt(x) | 2 | x=0 | x*(0.5 / 0) + x^2 (2 - 0.25 / 0) / 2 |
+| # | x^2+sqrt(x) | 2 | x=1 | 2 + 2.5 x - 2.5 + 0.875 (x - 1)^2 |
+| * | tan(x) | 3 | x | 0.0175 x + 1.77e-6 x^3 |
+|---+-------------+---+-----+--------------------------------------|
+#+TBLFM: $5=taylor($2,$4,$3);n3
+@end group
+@end example
+
+@node Hyperlinks, TODO items, Tables, Top
+@chapter Hyperlinks
+@cindex hyperlinks
+
+Just like HTML, Org-mode provides links inside a file, and external
+links to other files, Usenet articles, emails, and much more.
+
+@menu
+* Link format:: How links in Org-mode are formatted
+* Internal links:: Links to other places in the current file
+* External links:: URL-like links to the world
+* Handling links:: Creating, inserting and following
+* Link abbreviations:: Shortcuts for writing complex links
+* Search options:: Linking to a specific location
+* Custom searches:: When the default search is not enough
+* Remember:: Org-trees store quick notes
+@end menu
+
+@node Link format, Internal links, Hyperlinks, Hyperlinks
+@section Link format
+@cindex link format
+@cindex format, of links
+
+Org-mode will recognize plain URL-like links and activate them as
+clickable links. The general link format, however, looks like this:
+
+@example
+[[link][description]] @r{or alternatively} [[link]]
+@end example
+
+Once a link in the buffer is complete (all brackets present), Org-mode
+will change the display so that @samp{description} is displayed instead
+of @samp{[[link][description]]} and @samp{link} is displayed instead of
+@samp{[[link]]}. Links will be highlighted in the face @code{org-link},
+which by default is an underlined face. You can directly edit the
+visible part of a link. Note that this can be either the @samp{link}
+part (if there is no description) or the @samp{description} part. To
+edit also the invisible @samp{link} part, use @kbd{C-c C-l} with the
+cursor on the link.
+
+If you place the cursor at the beginning or just behind the end of the
+displayed text and press @key{BACKSPACE}, you will remove the
+(invisible) bracket at that location. This makes the link incomplete
+and the internals are again displayed as plain text. Inserting the
+missing bracket hides the link internals again. To show the
+internal structure of all links, use the menu entry
+@code{Org->Hyperlinks->Literal links}.
+
+@node Internal links, External links, Link format, Hyperlinks
+@section Internal links
+@cindex internal links
+@cindex links, internal
+@cindex targets, for links
+
+If the link does not look like a URL, it is considered to be internal in
+the current file. Links such as @samp{[[My Target]]} or @samp{[[My
+Target][Find my target]]} lead to a text search in the current file.
+The link can be followed with @kbd{C-c C-o} when the cursor is on the
+link, or with a mouse click (@pxref{Handling links}). The preferred
+match for such a link is a dedicated target: the same string in double
+angular brackets. Targets may be located anywhere; sometimes it is
+convenient to put them into a comment line. For example
+
+@example
+# <<My Target>>
+@end example
+
+@noindent In HTML export (@pxref{HTML export}), such targets will become
+named anchors for direct access through @samp{http} links@footnote{Note
+that text before the first headline will never be exported, so the first
+such target must be after the first headline.}.
+
+If no dedicated target exists, Org-mode will search for the words in the
+link. In the above example the search would be for @samp{my target}.
+Links starting with a star like @samp{*My Target} restrict the search to
+headlines. When searching, Org-mode will first try an exact match, but
+then move on to more and more lenient searches. For example, the link
+@samp{[[*My Targets]]} will find any of the following:
+
+@example
+** My targets
+** TODO my targets are bright
+** my 20 targets are
+@end example
+
+To insert a link targeting a headline, in-buffer completion can be used.
+Just type a star followed by a few optional letters into the buffer and
+press @kbd{M-@key{TAB}}. All headlines in the current buffer will be
+offered as completions. @xref{Handling links}, for more commands
+creating links.
+
+Following a link pushes a mark onto Org-mode's own mark ring. You can
+return to the previous position with @kbd{C-c &}. Using this command
+several times in direct succession goes back to positions recorded
+earlier.
+
+@menu
+* Radio targets:: Make targets trigger links in plain text.
+@end menu
+
+@node Radio targets, , Internal links, Internal links
+@subsection Radio targets
+@cindex radio targets
+@cindex targets, radio
+@cindex links, radio targets
+
+You can configure Org-mode to link any occurrences of certain target
+names in normal text. So without explicitly creating a link, the text
+connects to the target radioing its position. Radio targets are
+enclosed by triple angular brackets. For example, a target
+@samp{<<<My Target>>>} causes each occurrence of @samp{my target} in
+normal text to become activated as a link. The Org-mode file is
+scanned automatically for radio targets only when the file is first
+loaded into Emacs. To update the target list during editing, press
+@kbd{C-c C-c} with the cursor on or at a target.
+
+@node External links, Handling links, Internal links, Hyperlinks
+@section External links
+@cindex links, external
+@cindex external links
+@cindex links, external
+@cindex GNUS links
+@cindex BBDB links
+@cindex URL links
+@cindex file links
+@cindex VM links
+@cindex RMAIL links
+@cindex WANDERLUST links
+@cindex MH-E links
+@cindex USENET links
+@cindex SHELL links
+@cindex Info links
+@cindex elisp links
+
+Org-mode supports links to files, websites, Usenet and email messages,
+and BBDB database entries. External links are URL-like locators. They
+start with a short identifying string followed by a colon. There can be
+no space after the colon. The following list shows examples for each
+link type.
+
+@example
+http://www.astro.uva.nl/~dominik @r{on the web}
+file:/home/dominik/images/jupiter.jpg @r{file, absolute path}
+file:papers/last.pdf @r{file, relative path}
+news:comp.emacs @r{Usenet link}
+mailto:adent@@galaxy.net @r{Mail link}
+vm:folder @r{VM folder link}
+vm:folder#id @r{VM message link}
+vm://myself@@some.where.org/folder#id @r{VM on remote machine}
+wl:folder @r{WANDERLUST folder link}
+wl:folder#id @r{WANDERLUST message link}
+mhe:folder @r{MH-E folder link}
+mhe:folder#id @r{MH-E message link}
+rmail:folder @r{RMAIL folder link}
+rmail:folder#id @r{RMAIL message link}
+gnus:group @r{GNUS group link}
+gnus:group#id @r{GNUS article link}
+bbdb:Richard Stallman @r{BBDB link}
+shell:ls *.org @r{A shell command}
+elisp:(find-file-other-frame "Elisp.org") @r{An elisp form to evaluate}
+@end example
+
+A link should be enclosed in double brackets and may contain a
+descriptive text to be displayed instead of the url (@pxref{Link
+format}), for example:
+
+@example
+[[http://www.gnu.org/software/emacs/][GNU Emacs]]
+@end example
+
+@noindent
+If the description is a file name or URL that points to an image, HTML
+export (@pxref{HTML export}) will inline the image as a clickable
+button. If there is no description at all and the link points to an
+image,
+that image will be inlined into the exported HTML file.
+
+@cindex angular brackets, around links
+@cindex plain text external links
+Org-mode also finds external links in the normal text and activates them
+as links. If spaces must be part of the link (for example in
+@samp{bbdb:Richard Stallman}), or if you need to remove ambiguities
+about the end of the link, enclose them in angular brackets.
+
+@node Handling links, Link abbreviations, External links, Hyperlinks
+@section Handling links
+@cindex links, handling
+
+Org-mode provides methods to create a link in the correct syntax, to
+insert it into an org-mode file, and to follow the link.
+
+@table @kbd
+@kindex C-c l
+@cindex storing links
+@item C-c l
+Store a link to the current location. This is a @emph{global} command
+which can be used in any buffer to create a link. The link will be
+stored for later insertion into an Org-mode buffer (see below). For
+Org-mode files, if there is a @samp{<<target>>} at the cursor, the link
+points to the target. Otherwise it points to the current headline. For
+VM, RMAIL, WANDERLUST, MH-E, GNUS and BBDB buffers, the link will
+indicate the current article/entry. For W3 and W3M buffers, the link
+goes to the current URL. For any other files, the link will point to
+the file, with a search string (@pxref{Search options}) pointing to the
+contents of the current line. If there is an active region, the
+selected words will form the basis of the search string. If the
+automatically created link is not working correctly or accurately
+enough, you can write custom functions to select the search string and
+to do the search for particular file types - see @ref{Custom searches}.
+The key binding @kbd{C-c l} is only a suggestion - see @ref{Installation}.
+
+@kindex C-c C-l
+@cindex link completion
+@cindex completion, of links
+@cindex inserting links
+@item C-c C-l
+Insert a link. This prompts for a link to be inserted into the buffer.
+You can just type a link, using text for an internal link, or one of the
+link type prefixes mentioned in the examples above. All links stored
+during the current session are part of the history for this prompt, so
+you can access them with @key{up} and @key{down}, or with
+completion@footnote{After insertion of a stored link, the link will be
+removed from the list of stored links. To keep it in the list later
+use, use a triple @kbd{C-u} prefix to @kbd{C-c C-l}, or configure the
+option @code{org-keep-stored-link-after-insertion}.}. The link will be
+inserted into the buffer, along with a descriptive text. If some text
+was selected when this command is called, the selected text becomes the
+default description.@* Note that you don't have to use this command to
+insert a link. Links in Org-mode are plain text, and you can type or
+paste them straight into the buffer. By using this command, the links
+are automatically enclosed in double brackets, and you will be asked for
+the optional descriptive text.
+
+@c If the link is a @samp{file:} link and
+@c the linked file is located in the same directory as the current file or
+@c a subdirectory of it, the path of the file will be inserted relative to
+@c the current directory.
+
+@kindex C-u C-c C-l
+@cindex file name completion
+@cindex completion, of file names
+@item C-u C-c C-l
+When @kbd{C-c C-l} is called with a @kbd{C-u} prefix argument, a link to
+a file will be inserted and you may use file name completion to select
+the name of the file. The path to the file is inserted relative to the
+directory of the current org file, if the linked file is in the current
+directory or in a subdirectory of it, or if the path is written relative
+to the current directory using @samp{../}. Otherwise an absolute path
+is used, if possible with @samp{~/} for your home directory. You can
+force an absolute path with two @kbd{C-u} prefixes.
+
+@item C-c C-l @r{with cursor on existing link}
+When the cursor is on an existing link, @kbd{C-c C-l} allows you to edit the
+link and description parts of the link.
+
+@cindex following links
+@kindex C-c C-o
+@item C-c C-o
+Open link at point. This will launch a web browser for URLs (using
+@command{browse-url-at-point}), run vm/mh-e/wanderlust/rmail/gnus/bbdb
+for the corresponding links, and execute the command in a shell link.
+When the cursor is on an internal link, this commands runs the
+corresponding search. When the cursor is on a TAG list in a headline,
+it creates the corresponding TAGS view. If the cursor is on a time
+stamp, it compiles the agenda for that date. Furthermore, it will visit
+text and remote files in @samp{file:} links with Emacs and select a
+suitable application for local non-text files. Classification of files
+is based on file extension only. See option @code{org-file-apps}. If
+you want to override the default application and visit the file with
+Emacs, use a @kbd{C-u} prefix.
+
+@kindex mouse-2
+@kindex mouse-1
+@item mouse-2
+@itemx mouse-1
+On links, @kbd{mouse-2} will open the link just as @kbd{C-c C-o}
+would. Under Emacs 22, also @kbd{mouse-1} will follow a link.
+
+@kindex mouse-3
+@item mouse-3
+Like @kbd{mouse-2}, but force file links to be opened with Emacs, and
+internal links to be displayed in another window@footnote{See the
+variable @code{org-display-internal-link-with-indirect-buffer}}.
+
+@cindex mark ring
+@kindex C-c %
+@item C-c %
+Push the current position onto the mark ring, to be able to return
+easily. Commands following an internal link do this automatically.
+
+@cindex links, returning to
+@kindex C-c &
+@item C-c &
+Jump back to a recorded position. A position is recorded by the
+commands following internal links, and by @kbd{C-c %}. Using this
+command several times in direct succession moves through a ring of
+previously recorded positions.
+
+@kindex C-c C-x C-n
+@kindex C-c C-x C-p
+@cindex links, finding next/previous
+@item C-c C-x C-n
+@itemx C-c C-x C-p
+Move forward/backward to the next link in the buffer. At the limit of
+the buffer, the search fails once, and then wraps around. The key
+bindings for this are really too long, you might want to bind this also
+to @kbd{C-n} and @kbd{C-p}
+@lisp
+(add-hook 'org-load-hook
+ (lambda ()
+ (define-key 'org-mode-map "\C-n" 'org-next-link)
+ (define-key 'org-mode-map "\C-p" 'org-previous-link)))
+@end lisp
+@end table
+
+@node Link abbreviations, Search options, Handling links, Hyperlinks
+@section Link abbreviations
+@cindex link abbreviations
+@cindex abbreviation, links
+
+Long URLs can be cumbersome to type, and often many similar links are
+needed in a document. For this you can use link abbreviations. An
+abbreviated link looks like this
+
+@example
+[[linkword:tag][description]]
+@end example
+
+@noindent
+where the tag is optional. Such abbreviations are resolved according to
+the information in the variable @code{org-link-abbrev-alist} that
+relates the linkwords to replacement text. Here is an example:
+
+@lisp
+@group
+(setq org-link-abbrev-alist
+ '(("bugzilla" . "http://10.1.2.9/bugzilla/show_bug.cgi?id=")
+ ("google" . "http://www.google.com/search?q=")
+ ("ads" . "http://adsabs.harvard.edu/cgi-bin/
+ nph-abs_connect?author=%s&db_key=AST")))
+@end group
+@end lisp
+
+If the replacement text contains the string @samp{%s}, it will be
+replaced with the tag. Otherwise the tag will be appended to the string
+in order to create the link. You may also specify a function that will
+be called with the tag as the only argument to create the link.
+
+With the above setting, you could link to a specific bug with
+@code{[[bugzilla:129]]}, search the web for @samp{OrgMode} with
+@code{[[google:OrgMode]]} and find out what the Org-mode author is
+doing besides Emacs hacking with @code{[[ads:Dominik,C]]}.
+
+If you need special abbreviations just for a single Org-mode buffer, you
+can define them in the file with
+
+@example
+#+LINK: bugzilla http://10.1.2.9/bugzilla/show_bug.cgi?id=
+#+LINK: google http://www.google.com/search?q=%s
+@end example
+
+@noindent
+In-buffer completion @pxref{Completion} can be used after @samp{[} to
+complete link abbreviations.
+
+@node Search options, Custom searches, Link abbreviations, Hyperlinks
+@section Search options in file links
+@cindex search option in file links
+@cindex file links, searching
+
+File links can contain additional information to make Emacs jump to a
+particular location in the file when following a link. This can be a
+line number or a search option after a double@footnote{For backward
+compatibility, line numbers can also follow a single colon.} colon. For
+example, when the command @kbd{C-c l} creates a link (@pxref{Handling
+links}) to a file, it encodes the words in the current line as a search
+string that can be used to find this line back later when following the
+link with @kbd{C-c C-o}.
+
+Here is the syntax of the different ways to attach a search to a file
+link, together with an explanation:
+
+@example
+[[file:~/code/main.c::255]]
+[[file:~/xx.org::My Target]]
+[[file:~/xx.org::*My Target]]
+[[file:~/xx.org::/regexp/]]
+@end example
+
+@table @code
+@item 255
+Jump to line 255.
+@item My Target
+Search for a link target @samp{<<My Target>>}, or do a text search for
+@samp{my target}, similar to the search in internal links, see
+@ref{Internal links}. In HTML export (@pxref{HTML export}), such a file
+link will become an HTML reference to the corresponding named anchor in
+the linked file.
+@item *My Target
+In an Org-mode file, restrict search to headlines.
+@item /regexp/
+Do a regular expression search for @code{regexp}. This uses the Emacs
+command @code{occur} to list all matches in a separate window. If the
+target file is in Org-mode, @code{org-occur} is used to create a
+sparse tree with the matches.
+@c If the target file is a directory,
+@c @code{grep} will be used to search all files in the directory.
+@end table
+
+As a degenerate case, a file link with an empty file name can be used
+to search the current file. For example, @code{[[file:::find me]]} does
+a search for @samp{find me} in the current file, just as
+@samp{[[find me]]} would.
+
+@node Custom searches, Remember, Search options, Hyperlinks
+@section Custom Searches
+@cindex custom search strings
+@cindex search strings, custom
+
+The default mechanism for creating search strings and for doing the
+actual search related to a file link may not work correctly in all
+cases. For example, BibTeX database files have many entries like
+@samp{year="1993"} which would not result in good search strings,
+because the only unique identification for a BibTeX entry is the
+citation key.
+
+If you come across such a problem, you can write custom functions to set
+the right search string for a particular file type, and to do the search
+for the string in the file. Using @code{add-hook}, these functions need
+to be added to the hook variables
+@code{org-create-file-search-functions} and
+@code{org-execute-file-search-functions}. See the docstring for these
+variables for more information. Org-mode actually uses this mechanism
+for Bib@TeX{} database files, and you can use the corresponding code as
+an implementation example. Search for @samp{BibTeX links} in the source
+file.
+
+
+@node Remember, , Custom searches, Hyperlinks
+@section Remember
+@cindex @file{remember.el}
+
+Another way to create org entries with links to other files is through
+the @i{remember} package by John Wiegley. @i{Remember} lets you store
+quick notes with little interruption of your work flow. See
+@uref{http://www.emacswiki.org/cgi-bin/wiki/RememberMode} for more
+information. The notes produced by @i{Remember} can be stored in
+different ways, and Org-mode files are a good target. Org-mode
+significantly expands the possibilities of @i{remember}: You may define
+templates for different note types, and to associate target files and
+headlines with specific templates. It also allows you to select the
+location where a note should be stored interactively, on the fly.
+
+@menu
+* Setting up remember:: Some code for .emacs to get things going
+* Remember templates:: Define the outline of different note types
+* Storing notes:: Directly get the note to where it belongs
+@end menu
+
+@node Setting up remember, Remember templates, Remember, Remember
+@subsection Setting up remember
+
+The following customization will tell @i{remember} to use org files as
+target, and to create annotations compatible with Org-mode links.
+
+@example
+(setq org-directory "~/path/to/my/orgfiles/")
+(setq org-default-notes-file "~/.notes")
+(setq remember-annotation-functions '(org-remember-annotation))
+(setq remember-handler-functions '(org-remember-handler))
+(add-hook 'remember-mode-hook 'org-remember-apply-template)
+@end example
+
+@node Remember templates, Storing notes, Setting up remember, Remember
+@subsection Remember templates
+@cindex templates, for remember
+
+In combination with Org-mode, you can use templates to generate
+different types of @i{remember} notes. For example, if you would like
+to use one template to create general TODO entries, another one for
+journal entries, and a third one for collecting random ideas, you could
+use:
+
+@example
+(setq org-remember-templates
+ '((?t "* TODO %?\n %i\n %a" "~/org/TODO.org")
+ (?j "* %U %?\n\n %i\n %a" "~/org/JOURNAL.org")
+ (?i "* %^@{Title@}\n %i\n %a" "~/org/JOURNAL.org" "New Ideas")))
+@end example
+
+@noindent In these entries, the character specifies how to select the
+template. The first string specifies the template. Two more (optional)
+strings give the file in which, and the headline under which the new
+note should be stored. The file defaults to
+@code{org-default-notes-file}, the heading to
+@code{org-remember-default-headline}. Both defaults help to get to the
+storing location quickly, but you can change the location interactively
+while storing the note.
+
+When you call @kbd{M-x remember} (or @kbd{M-x org-remember}) to remember
+something, org will prompt for a key to select the template (if you have
+more than one template) and then prepare the buffer like
+@example
+* TODO
+ [[file:link to where you called remember]]
+@end example
+
+@noindent or
+
+@example
+* [2006-03-21 Tue 15:37]
+
+ [[file:link to where you called remember]]
+@end example
+
+@noindent
+During expansion of the template, special @kbd{%}-escapes allow dynamic
+insertion of content:
+@example
+%^@{prompt@} @r{prompt the user for a string and replace this sequence with it.}
+%t @r{time stamp, date only}
+%T @r{time stamp with date and time}
+%u, %U @r{like the above, but inactive time stamps}
+%^t @r{like @code{%t}, but prompt for date. Similarly @code{%^T}, @code{%^u}, @code{%^U}}
+ @r{You may define a prompt like @code{%^@{Birthday@}t}}
+%n @r{user name (taken from @code{user-full-name})}
+%a @r{annotation, normally the link created with @code{org-store-link}}
+%i @r{initial content, the region when remember is called with C-u.}
+ @r{The entire text will be indented like @code{%i} itself.}
+%:keyword @r{specific information for certain link types, see below}
+@end example
+
+@noindent
+For specific link types, the following keywords will be defined:
+
+@example
+Link type | Available keywords
+-------------------+----------------------------------------------
+bbdb | %:name %:company
+vm, wl, mh, rmail | %:type %:subject %:message-id
+ | %:from %:fromname %:fromaddress
+ | %:to %:toname %:toaddress
+ | %:fromto @r{(either "to NAME" or "from NAME")@footnote{This will always be the other, not the user. See the variable @code{org-from-is-user-regexp}.}}
+gnus | %:group, @r{for messages also all email fields}
+w3, w3m | %:url
+info | %:file %:node
+calendar | %:date"
+@end example
+
+@noindent
+If you would like to have the cursor in a specific position after the
+template has been expanded:
+
+@example
+%? @r{After completing the template, position cursor here.}
+@end example
+
+@noindent
+If you change you mind about which template to use, call
+@code{org-remember} in the remember buffer. You may then select a new
+template that will be filled with the previoous context information.
+
+@node Storing notes, , Remember templates, Remember
+@subsection Storing notes
+
+When you are finished preparing a note with @i{remember}, you have to press
+@kbd{C-c C-c} to file the note away. The handler first prompts for a
+target file - if you press @key{RET}, the value specified for the
+template is used. Then the command offers the headings tree of the
+selected file, with the cursor position at the default headline (if you
+had specified one in the template). You can either immediately press
+@key{RET} to get the note placed there. Or you can use vertical cursor
+motion (@key{up} and @key{down}) and visibility cycling (@key{TAB}) to
+find a better place. Pressing @key{RET} or @key{left} or @key{right}
+then leads to the following result.
+
+@multitable @columnfractions 0.2 0.1 0.7
+@item @b{Cursor position} @tab @b{Key} @tab @b{Note gets inserted}
+@item buffer-start @tab @key{RET} @tab as level 2 heading at end of file
+@item on headline @tab @key{RET} @tab as sublevel of the heading at cursor
+@item @tab @key{left} @tab as same level, before current heading
+@item @tab @key{right} @tab as same level, after current heading
+@item not on headline @tab @key{RET}
+ @tab at cursor position, level taken from context.
+ Or use prefix arg to specify level manually.
+@end multitable
+
+So a fast way to store the note to its default location is to press
+@kbd{C-c C-c @key{RET} @key{RET}}. Even shorter would be @kbd{C-u C-c
+C-c}, which does the same without even asking for a file or showing the
+tree.
+
+Before inserting the text into a tree, the function ensures that the
+text has a headline, i.e. a first line that starts with a @samp{*}.
+If not, a headline is constructed from the current date and some
+additional data. If the variable @code{org-adapt-indentation} is
+non-nil, the entire text is also indented so that it starts in the
+same column as the headline (after the asterisks).
+
+
+@node TODO items, Timestamps, Hyperlinks, Top
+@chapter TODO items
+@cindex TODO items