aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaroly Lorentey2006-04-12 17:40:36 +0000
committerKaroly Lorentey2006-04-12 17:40:36 +0000
commit4c57cca724993ab1334cc5c0b35c22b06daee0c3 (patch)
tree009f6142b6abc0d6f3221b2098863b22ca678e73
parent21c5f634f04084467ca59d9232a83456e16a5c50 (diff)
parent163cb72dcb641bd2e68d3b6887cfef71bb1464ae (diff)
downloademacs-4c57cca724993ab1334cc5c0b35c22b06daee0c3.tar.gz
emacs-4c57cca724993ab1334cc5c0b35c22b06daee0c3.zip
Merged from emacs@sv.gnu.org
Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-207 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-208 Sync from erc--emacs--0 * emacs@sv.gnu.org/emacs--devo--0--patch-209 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-210 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-211 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-212 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-213 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-214 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-215 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-81 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-82 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-83 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-549
-rw-r--r--admin/FOR-RELEASE4
-rw-r--r--etc/ChangeLog14
-rw-r--r--etc/NEWS15
-rw-r--r--etc/PROBLEMS8
-rw-r--r--etc/orgcard.tex73
-rw-r--r--lisp/ChangeLog179
-rw-r--r--lisp/cus-edit.el46
-rw-r--r--lisp/custom.el76
-rw-r--r--lisp/emacs-lisp/bytecomp.el6
-rw-r--r--lisp/emacs-lisp/find-func.el4
-rw-r--r--lisp/erc/ChangeLog20
-rw-r--r--lisp/erc/erc-backend.el14
-rw-r--r--lisp/erc/erc-ezbounce.el2
-rw-r--r--lisp/erc/erc-join.el4
-rw-r--r--lisp/erc/erc-netsplit.el5
-rw-r--r--lisp/erc/erc.el12
-rw-r--r--lisp/files.el41
-rw-r--r--lisp/finder.el2
-rw-r--r--lisp/gnus/ChangeLog53
-rw-r--r--lisp/gnus/gnus-art.el32
-rw-r--r--lisp/gnus/gnus-sieve.el2
-rw-r--r--lisp/gnus/gnus-sum.el3
-rw-r--r--lisp/gnus/gnus-uu.el4
-rw-r--r--lisp/gnus/message.el3
-rw-r--r--lisp/gnus/mm-decode.el15
-rw-r--r--lisp/gnus/mm-extern.el24
-rw-r--r--lisp/gnus/nnslashdot.el2
-rw-r--r--lisp/gnus/rfc2047.el7
-rw-r--r--lisp/hexl.el74
-rw-r--r--lisp/international/mule-cmds.el4
-rw-r--r--lisp/loadhist.el22
-rw-r--r--lisp/progmodes/gdb-ui.el50
-rw-r--r--lisp/progmodes/perl-mode.el5
-rw-r--r--lisp/startup.el12
-rw-r--r--lisp/textmodes/org.el4053
-rw-r--r--lisp/vc.el123
-rw-r--r--lispref/ChangeLog4
-rw-r--r--lispref/customize.texi19
-rw-r--r--man/ChangeLog37
-rw-r--r--man/cmdargs.texi2
-rw-r--r--man/custom.texi7
-rw-r--r--man/emacs-xtra.texi887
-rw-r--r--man/emacs.texi4
-rw-r--r--man/files.texi966
-rw-r--r--man/gnus-faq.texi2
-rw-r--r--man/gnus.texi35
-rw-r--r--man/org.texi1084
-rw-r--r--src/ChangeLog20
-rw-r--r--src/data.c7
-rw-r--r--src/lisp.h2
-rw-r--r--src/s/ms-w32.h3
-rw-r--r--src/xrdb.c2
52 files changed, 4746 insertions, 3348 deletions
diff --git a/admin/FOR-RELEASE b/admin/FOR-RELEASE
index b04273d274e..934cda45906 100644
--- a/admin/FOR-RELEASE
+++ b/admin/FOR-RELEASE
@@ -33,6 +33,10 @@ Assigned to Bill Wohler <wohler@newt.com>.
33 33
34* BUGS 34* BUGS
35 35
36** Stefan Monnier's March 20 bug report about 3d boxes in header line.
37
38** Is there a basic problem with cl-byte-compile-compiler-macro?
39
36** Markus Gritsch's report about Emacs looping on Windoze with the following 40** Markus Gritsch's report about Emacs looping on Windoze with the following
37.emacs file, and then reduce Emacs frame width to "something quite narrow": 41.emacs file, and then reduce Emacs frame width to "something quite narrow":
38 (setq-default truncate-lines t) 42 (setq-default truncate-lines t)
diff --git a/etc/ChangeLog b/etc/ChangeLog
index 95b24e50e2d..3772b1251bd 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,17 @@
12006-04-11 Carsten Dominik <dominik@science.uva.nl>
2
3 * orgcard.tex: (section{Tables}): Document column narrowing.
4 (section{Links}): Document bracket links.
5
62006-04-11 Kenichi Handa <handa@m17n.org>
7
8 * PROBLEMS (C-SPC fails ...): Add description for fcitx.
9
102006-04-10 Bill Wohler <wohler@newt.com>
11
12 * NEWS: Add package-version keyword to `defcustom' and mention
13 associated variable `customize-package-emacs-version-alist'.
14
12006-04-07 Reiner Steib <Reiner.Steib@gmx.de> 152006-04-07 Reiner Steib <Reiner.Steib@gmx.de>
2 16
3 * NEWS: Add string-or-null-p. 17 * NEWS: Add string-or-null-p.
diff --git a/etc/NEWS b/etc/NEWS
index 8361207ed6f..a8092923ea5 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -3692,6 +3692,12 @@ variables, including buffer-local and frame-local variables.
3692** defcustom changes: 3692** defcustom changes:
3693 3693
3694+++ 3694+++
3695*** The package-version keyword has been added to provide
3696`customize-changed-options' functionality to packages in the future.
3697Developers who make use of this keyword must also update the new
3698variable `customize-package-emacs-version-alist'.
3699
3700+++
3695*** The new customization type `float' requires a floating point number. 3701*** The new customization type `float' requires a floating point number.
3696 3702
3697** String changes: 3703** String changes:
@@ -3961,6 +3967,12 @@ A file local variables list cannot specify a string with text
3961properties--any specified text properties are discarded. 3967properties--any specified text properties are discarded.
3962 3968
3963+++ 3969+++
3970*** The variable `enable-local-variables' controls how local variable
3971lists are handled. t, the default, specifies the standard querying
3972behavior. :safe means use only safe values, and ignore the rest.
3973nil means ignore them all. Anything else means always query.
3974
3975+++
3964*** The variable `safe-local-eval-forms' specifies a list of forms that 3976*** The variable `safe-local-eval-forms' specifies a list of forms that
3965are ok to evaluate when they appear in an `eval' local variables 3977are ok to evaluate when they appear in an `eval' local variables
3966specification. Normally Emacs asks for confirmation before evaluating 3978specification. Normally Emacs asks for confirmation before evaluating
@@ -10784,9 +10796,6 @@ SNMPv2 MIBs. It has entries on `auto-mode-alist'.
10784editing SQL files, and M-x sql-interactive-mode for interacting with 10796editing SQL files, and M-x sql-interactive-mode for interacting with
10785SQL interpreters. It has an entry on `auto-mode-alist'. 10797SQL interpreters. It has an entry on `auto-mode-alist'.
10786 10798
10787*** M-x highlight-changes-mode provides a minor mode displaying buffer
10788changes with a special face.
10789
10790*** ispell4.el has been deleted. It got in the way of ispell.el and 10799*** ispell4.el has been deleted. It got in the way of ispell.el and
10791this was hard to fix reliably. It has long been obsolete -- use 10800this was hard to fix reliably. It has long been obsolete -- use
10792Ispell 3.1 and ispell.el. 10801Ispell 3.1 and ispell.el.
diff --git a/etc/PROBLEMS b/etc/PROBLEMS
index de0dc31edff..f106f9a4a17 100644
--- a/etc/PROBLEMS
+++ b/etc/PROBLEMS
@@ -991,7 +991,7 @@ xmodmap command to the xdm setup script for that display.
991 991
992Use the shell command `xset bc' to make the old X Menu package work. 992Use the shell command `xset bc' to make the old X Menu package work.
993 993
994*** C-SPC fails to work on Fedora GNU/Linux. 994*** C-SPC fails to work on Fedora GNU/Linux (or with some input method).
995 995
996Fedora Core 4 steals the C-SPC key by default for the `iiimx' program 996Fedora Core 4 steals the C-SPC key by default for the `iiimx' program
997which is the input method for some languages. It blocks Emacs users 997which is the input method for some languages. It blocks Emacs users
@@ -1005,6 +1005,12 @@ Another is to specify `Emacs*useXIM: false' in your X resources.
1005 1005
1006Another is to build Emacs with the `--without-xim' configure option. 1006Another is to build Emacs with the `--without-xim' configure option.
1007 1007
1008The same problem happens on any other system if you are using fcitx
1009(Chinese input method) which by default use C-SPC for toggling. If
1010you want to use fcitx with Emacs, you have two choices. Toggle fcitx
1011by another key (e.g. C-\) by modifying ~/.fcitx/config, or be
1012accustomed to use C-@ for `set-mark-command'.
1013
1008*** M-SPC seems to be ignored as input. 1014*** M-SPC seems to be ignored as input.
1009 1015
1010See if your X server is set up to use this as a command 1016See if your X server is set up to use this as a command
diff --git a/etc/orgcard.tex b/etc/orgcard.tex
index cca7e525d91..c149e041c07 100644
--- a/etc/orgcard.tex
+++ b/etc/orgcard.tex
@@ -1,4 +1,6 @@
1% Reference Card for Org Mode 4.10 1% Reference Card for Org Mode
2\def\orgversionnumber{4.21}
3\def\year{2006}
2% 4%
3%**start of header 5%**start of header
4\newcount\columnsperpage 6\newcount\columnsperpage
@@ -58,9 +60,6 @@
58% Thanks to Paul Rubin, Bob Chassell, Len Tower, and Richard Mlynarik 60% Thanks to Paul Rubin, Bob Chassell, Len Tower, and Richard Mlynarik
59% for their many good ideas. 61% for their many good ideas.
60 62
61\def\orgversionnumber{4.10}
62\def\year{2006}
63
64\def\shortcopyrightnotice{\vskip 1ex plus 2 fill 63\def\shortcopyrightnotice{\vskip 1ex plus 2 fill
65 \centerline{\small \copyright\ 2004, 2005, 2006\ Free Software Foundation, Inc. 64 \centerline{\small \copyright\ 2004, 2005, 2006\ Free Software Foundation, Inc.
66 Permissions on back. v\orgversionnumber}} 65 Permissions on back. v\orgversionnumber}}
@@ -367,10 +366,8 @@ To set archive location for current file, add a line like$^3$:
367\key{insert SCHEDULED timestamp}{C-c C-s} 366\key{insert SCHEDULED timestamp}{C-c C-s}
368\key{create sparse tree with all deadlines due}{C-c C-w} 367\key{create sparse tree with all deadlines due}{C-c C-w}
369\key{the time between 2 dates in a time range}{C-c C-y} 368\key{the time between 2 dates in a time range}{C-c C-y}
370\key{change timestamp at cursor by $-1$ day}{S-LEFT$^4$} 369\key{change timestamp at cursor by $\pm 1$ day}{S-RIGHT/LEFT$^4$}
371\key{change timestamp at cursor by $+1$ day}{S-RIGHT$^4$} 370\key{change year/month/day at cursor by $\pm 1$}{S-UP/DOWN$^4$}
372\key{change year/month/day at cursor by $-1$}{S-DOWN$^4$}
373\key{change year/month/day at cursor by $+1$}{S-UP$^4$}
374\key{access the calendar for the current date}{C-c >} 371\key{access the calendar for the current date}{C-c >}
375\key{insert timestamp matching date in calendar}{C-c <} 372\key{insert timestamp matching date in calendar}{C-c <}
376\key{access agenda for current date}{C-c C-o} 373\key{access agenda for current date}{C-c C-o}
@@ -386,6 +383,7 @@ To set archive location for current file, add a line like$^3$:
386\key{globally store link to the current location}{C-c l$^2$} 383\key{globally store link to the current location}{C-c l$^2$}
387\key{insert a link (TAB completes stored links)}{C-c C-l} 384\key{insert a link (TAB completes stored links)}{C-c C-l}
388\key{insert file link with file name completion}{C-u C-c C-l} 385\key{insert file link with file name completion}{C-u C-c C-l}
386\key{edit (also hidden part of) link at point}{C-c C-l}
389 387
390\key{open file links in emacs (\kbd{C-u} : in emacs)}{C-c C-o} 388\key{open file links in emacs (\kbd{C-u} : in emacs)}{C-c C-o}
391\key{open link at point (3: in emacs)}{mouse-2/3} 389\key{open link at point (3: in emacs)}{mouse-2/3}
@@ -399,24 +397,26 @@ To set archive location for current file, add a line like$^3$:
399\key{\kbd{<<<My Target>>>}}{\rm radio target$^3$} 397\key{\kbd{<<<My Target>>>}}{\rm radio target$^3$}
400\key{\kbd{[[*this text]]}}{\rm find headline} 398\key{\kbd{[[*this text]]}}{\rm find headline}
401\metax{\kbd{[[this text]]}}{\rm find target or text in buffer} 399\metax{\kbd{[[this text]]}}{\rm find target or text in buffer}
400\metax{\kbd{[[this text][description]]}}{\rm optional link text}
402 401
403{\bf External Links} 402{\bf External Links}
404 403
405\key{\kbd{<file:/home/dominik/img/mars.jpg>}}{\rm file, absolute} 404\key{\kbd{file:/home/dominik/img/mars.jpg}}{\rm file, absolute}
406\key{\kbd{<file:papers/last.pdf>}}{\rm file, relative} 405\key{\kbd{file:papers/last.pdf}}{\rm file, relative}
407\key{\kbd{<file:projects.org::*that text>}}{\rm find headline} 406\key{\kbd{file:projects.org::*that text}}{\rm find headline}
408\key{\kbd{<file:projects.org::find me>}}{\rm find tgt/string} 407\key{\kbd{file:projects.org::find me}}{\rm find tgt/string}
409\key{\kbd{<file:projects.org::/regexp/>}}{\rm regexp search} 408\key{\kbd{file:projects.org::/regexp/}}{\rm regexp search}
410\key{\kbd{<http://www.astro.uva.nl/~dominik>}}{\rm on the web} 409\key{\kbd{http://www.astro.uva.nl/~dominik}}{\rm on the web}
411\key{\kbd{<mailto:adent@galaxy.net>}}{\rm EMail address} 410\key{\kbd{mailto:adent@galaxy.net}}{\rm EMail address}
412\key{\kbd{<news:comp.emacs>}}{\rm Usenet group} 411\key{\kbd{news:comp.emacs}}{\rm Usenet group}
413\key{\kbd{<bbdb:Richard Stallman>}}{\rm BBDB person} 412\key{\kbd{bbdb:Richard Stallman}}{\rm BBDB person}
414\key{\kbd{<shell:ls *.org>}}{\rm shell command} 413\key{\kbd{shell:ls *.org}}{\rm shell command}
415\key{\kbd{<gnus:group>}}{\rm GNUS group} 414\key{\kbd{gnus:group}}{\rm GNUS group}
416\key{\kbd{<gnus:group\#id>}}{\rm GNUS message} 415\key{\kbd{gnus:group\#id}}{\rm GNUS message}
417\key{\kbd{<vm|wl|mhe|rmail:folder>}}{\rm Mail folder} 416\key{\kbd{vm|wl|mhe|rmail:folder}}{\rm Mail folder}
418\key{\kbd{<vm|wl|mhe|rmail:folder\#id>}}{\rm Mail message} 417\key{\kbd{vm|wl|mhe|rmail:folder\#id}}{\rm Mail message}
419%\key{\kbd{<vm://myself@some.where.org/folder\#id>}}{\rm VM remote} 418\metax{\kbd{[[external link][description]]}}{\rm optional link text}
419%\key{\kbd{vm://myself@some.where.org/folder\#id}}{\rm VM remote}
420 420
421\section{Tables} 421\section{Tables}
422 422
@@ -425,11 +425,10 @@ To set archive location for current file, add a line like$^3$:
425 425
426{\bf Creating a table} 426{\bf Creating a table}
427 427
428\metax{insert a new Org-mode table}{M-x org-table-create} 428%\metax{insert a new Org-mode table}{M-x org-table-create}
429\metax{... or just start typing, e.g.}{|Name|Phone|Age RET |- TAB} 429\metax{just start typing, e.g.}{|Name|Phone|Age RET |- TAB}
430\key{convert region to table}{C-c C-c} 430\key{convert region to table}{C-c |}
431\key{... separator at least 3 spaces}{C-3 C-c C-c} 431\key{... separator at least 3 spaces}{C-3 C-c |}
432%\key{... prompt for separator regexp}{C-u C-c C-c}
433 432
434{\bf Commands available inside tables} 433{\bf Commands available inside tables}
435 434
@@ -465,9 +464,7 @@ Outside of tables, the same keys may have other functionality.
465\key{paste rectangular region}{C-c C-x C-y} 464\key{paste rectangular region}{C-c C-x C-y}
466\key{fill paragraph across selected cells}{C-c C-q} 465\key{fill paragraph across selected cells}{C-c C-q}
467 466
468{\bf Calculations} 467{\bf Calculations} (in combination with Emacs \kbd{calc} package)
469
470These need the Emacs calc package installed.
471 468
472\key{set and eval column formula}{C-c =} 469\key{set and eval column formula}{C-c =}
473\key{set and eval named-field formula}{C-u C-c =} 470\key{set and eval named-field formula}{C-u C-c =}
@@ -475,8 +472,8 @@ These need the Emacs calc package installed.
475\key{re-apply all stored equations to current line}{C-c *} 472\key{re-apply all stored equations to current line}{C-c *}
476\key{re-apply all stored equations to entire table}{C-u C-c *} 473\key{re-apply all stored equations to entire table}{C-u C-c *}
477 474
478\kbd{TAB}, \kbd{RET} and \kbd{C-c C-c} trigger automatic recalculation 475%\kbd{TAB}, \kbd{RET} and \kbd{C-c C-c} trigger automatic recalculation
479in lines starting with: {\tt | \# |}. 476%in lines starting with: {\tt | \# |}.
480 477
481\key{rotate calculation mark through \# * ! \^ \_ \$}{C-\#} 478\key{rotate calculation mark through \# * ! \^ \_ \$}{C-\#}
482 479
@@ -484,9 +481,9 @@ in lines starting with: {\tt | \# |}.
484\key{sum numbers in current column/rectangle}{C-c +} 481\key{sum numbers in current column/rectangle}{C-c +}
485\key{copy down with increment}{S-RET$^4$} 482\key{copy down with increment}{S-RET$^4$}
486 483
487A formula can also be typed directly into into a field and will 484Formulas typed in field are executed by \kbd{TAB},
488executed by \kbd{TAB}, \kbd{RET} and \kbd{C-c C-c}. A leading \kbd{=} 485\kbd{RET} and \kbd{C-c C-c}. \kbd{=} introduces a column
489introduces a column formula, \kbd{:=} a named-field formula. 486formula, \kbd{:=} a named-field formula.
490 487
491\key{Example: Add Col1 and Col2}{=\$1+\$2} 488\key{Example: Add Col1 and Col2}{=\$1+\$2}
492\key{... with printf format specification}{=\$1+\$2;\%.2f} 489\key{... with printf format specification}{=\$1+\$2;\%.2f}
@@ -496,7 +493,9 @@ introduces a column formula, \kbd{:=} a named-field formula.
496 493
497{\bf Miscellaneous} 494{\bf Miscellaneous}
498 495
499\key{toggle visibility of vertical lines}{C-c |} 496\key{to limit column width to \kbd{N} characters, use}{...| <N> |...}
497\key{edit the current field in a separate window}{C-c `}
498\key{make current field fully visible}{C-u TAB}
500\metax{export as tab-separated file}{M-x org-table-export} 499\metax{export as tab-separated file}{M-x org-table-export}
501\metax{import tab-separated file}{M-x org-table-import} 500\metax{import tab-separated file}{M-x org-table-import}
502 501
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 2adf8adf559..32b8304044f 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,152 @@
12006-04-12 Stefan Monnier <monnier@iro.umontreal.ca>
2
3 * progmodes/perl-mode.el (perl-indent-new-calculate):
4 Recompute parse-start after jumping backward by a whole sexp.
5
62006-04-11 Stefan Monnier <monnier@iro.umontreal.ca>
7
8 * vc.el (vc-ensure-vc-buffer): Only change current-buffer, not the
9 window configuration.
10 (vc-annotate-display-select): Select the buffer so that current-buffer
11 (and selected-window) is the output buffer at the end of vc-annotate.
12
132006-04-11 J.D. Smith <jdsmith@as.arizona.edu>
14
15 * vc.el (vc-annotate-color-map): Add custom TTY color map for
16 8-color terminals, to use all of the colors in a sensible order.
17 256-color terminals work well with the standard map.
18 (vc-annotate-lines): Only strip the first color character if it
19 is "#", to allow for terminal-style named colors.
20 (vc-annotate-warp-version): Pass buf to `goto-line' to ensure
21 the correct buffer is scrolled.
22
232006-04-11 Richard Stallman <rms@gnu.org>
24
25 * emacs-lisp/bytecomp.el (byte-compile-file):
26 Bind enable-local-variables to :safe, and make normal-mode obey it.
27
28 * files.el (enable-local-variables): Allow value :safe.
29 (normal-mode): Doc fix.
30 (hack-local-variables): Implement enable-local-variables = :safe.
31 (hack-local-variables-confirm): Don't prevent quitting.
32
332006-04-11 Stefan Monnier <monnier@iro.umontreal.ca>
34
35 * loadhist.el (unload-feature): A bit of sanity check of
36 load-history entries. Cancel timer-vars before unbinding them.
37
38 * hexl.el (hexl-isearch-search-function): Fix regexp-building code to
39 quote special chars, and make the trick work on the hex part of the
40 buffer as well.
41 (hexl-mode, hexl-save-buffer, hexl-mode-exit)
42 (hexl-maybe-dehexlify-buffer): Use restore-buffer-modified-p.
43
44 * startup.el (normal-splash-screen): Fix last change so we don't wait
45 2 minutes if we don't show the splash screen.
46
472006-04-11 Carsten Dominik <dominik@science.uva.nl>
48
49 * textmodes/org.el (org-export-plain-list-max-depth)
50 (org-table-spaces-around-separators)
51 (org-radio-targets, org-activate-camels)
52 (org-table-spaces-around-invisible-separators): Options removed.
53 (org-time-stamp-rounding-minutes, org-remember-templates)
54 (org-ellipsis, org-activate-links, org-descriptive-links):
55 New options.
56 (org-remember-apply-template, org-current-time)
57 (org-finish-edit-table-field)
58 (org-link-unescape, org-link-escape)
59 (org-string-width, org-table-clean-line, org-html-do-expand)
60 (org-edit-agenda-file-list, org-store-new-agenda-file-list)
61 (org-read-agenda-file-list): New functions.
62 (org-table-edit-field)
63 (org-table-create-or-convert-from-region): New commands
64 (org-table-toggle-vline-visibility): Command removed.
65 (org-table-convert-region): Made a command.
66 (orgtbl-deleta-backward-char,orgtbl-delete-char): Remove commands.
67 Replace with the normal org- functions.
68 (org-self-insert-command): Don't trigger realign unnecessarily
69 when blanking a field that is not full.
70 (org-mode): `Set buffer-invisibility-spec' for links.
71 (org-activate-links2): Hide link part and only show descriptive
72 part of the link.
73 (org-insert-link): Modify for new linking system.
74 (org-store-link): Store description separately, for use by
75 `org-insert-link'.
76 (org-table-align): Use `org-string-width'.
77 (defgroup): Completely new group structure for custom variables.
78 (org-agenda-files): Option: Single file name allowed. Function:
79 Optional argument unrestrited means ignore any restricitons.
80 (org-install-agenda-files-menu): Find a buffer in Org-mode before
81 trying to modify the menu. Use generalized access to
82 `org-agenda-files.'
83 (org-agenda-list, org-todo-list, org-cycle-agenda-files)
84 (org-agenda-file-to-front, org-remove-file, org-diary)
85 (org-tags-view, org-export-icalendar-all-agenda-files)
86 (org-export-icalendar-combine-agenda-files): Use generalized
87 access to `org-agenda-files'.
88 (org-remember-handler): Correctly preserve heading if present.
89 (org-table-insert-row, org-table-insert-hline): Deal with
90 invisible characters.
91
922006-04-10 J.D. Smith <jdsmith@as.arizona.edu>
93
94 * vc.el (vc-annotate-display-mode): Made default 'fullscale.
95 (vc-annotate-color-map): New 18 element constant
96 value/saturation, rotating hue colormap, from red->blue.
97 (vc-annotate-mode-menu): "Default" -> "By Color Map Range".
98 (vc-annotate-display-select): Switch to annotate-mode elsewhere.
99 (vc-annotate): To avoid killing the required local variables,
100 set them before the end of `with-output-to-temp-buffer', and
101 after first switching to annotate-mode.
102 (vc-annotate-warp-version): Add buffer argument in goto-line to
103 ensure annotation, not source, is scrolled.
104
1052006-04-10 Bill Wohler <wohler@newt.com>
106
107 * custom.el (defcustom, custom-handle-keyword):
108 Add :package-version keyword.
109 (custom-add-package-version): New function. Sets value of new
110 property 'custom-package-version from :package-version keyword.
111 (defcustom): Create Common Keywords section in docstring.
112 (defface, defgroup): Replace definitions of a select few keywords
113 with a reference to the Common Keywords in defcustom.
114 (defcustom, defface, defgroup): Replace reference to Customization
115 chapter in manual with hyperlink.
116
117 * cus-edit.el (customize-package-emacs-version-alist):
118 New variable.
119 (customize-changed-options): Add check for custom-package-version.
120 (customize-package-emacs-version): New function to look up Emacs
121 version corresponding to the given package version.
122
123 * emacs-lisp/find-func.el (find-function-regexp): Allow dashes in
124 defun name, in similar fashion to find-variable-regexp.
125
1262006-04-10 Eli Zaretskii <eliz@gnu.org>
127
128 * international/mule-cmds.el (set-locale-environment): Fix last
129 change for when the locale's preferences don't specify any encoding.
130
1312006-04-10 Stefan Monnier <monnier@iro.umontreal.ca>
132
133 * emacs-lisp/find-func.el (find-function-search-for-symbol): Fix regexp
134 so the defined var/fun doesn't need to be quoted.
135
1362006-04-10 Richard Stallman <rms@gnu.org>
137
138 * finder.el (finder-mode-map): Add n and p bindings.
139
1402006-04-10 Nick Roberts <nickrob@snap.net.nz>
141
142 * progmodes/gdb-ui.el (gdb-init-1): Re-initialise gdb-main-file to nil.
143 (gdb-get-version): Make it work for pre "interpreter mi" (GDB 5.3?).
144 (gdb-setup-windows): Put something in source window if we can't find
145 the source file.
146 (gdb-frame-handler): Make it work again with just assembly.
147 (gdb-data-list-register-values-handler): Make it work when there is
148 no stack.
149
12006-04-09 Richard Stallman <rms@gnu.org> 1502006-04-09 Richard Stallman <rms@gnu.org>
2 151
3 * mail/rmail.el (rmail-mime-charset-pattern): Ignore format and delsp 152 * mail/rmail.el (rmail-mime-charset-pattern): Ignore format and delsp
@@ -94,12 +243,11 @@
94 (rcirc-multiline-minor-mode-map): New mode map. 243 (rcirc-multiline-minor-mode-map): New mode map.
95 (rcirc-edit-multiline): Put multiline-edit buffer in 244 (rcirc-edit-multiline): Put multiline-edit buffer in
96 rcirc-multiline-major-mode along with rcirc-multiline-minor-mode. 245 rcirc-multiline-major-mode along with rcirc-multiline-minor-mode.
97 (rcirc-print): Any line starting with an ignored nick will be 246 (rcirc-print): Ignore any line starting with an ignored nick.
98 ignored.
99 (rcirc-print): Decode using rcirc-decode-coding-system. 247 (rcirc-print): Decode using rcirc-decode-coding-system.
100 (rcirc-track-minor-mode): Update global-mode-string when disabling 248 (rcirc-track-minor-mode): Update global-mode-string when disabling
101 this mode. 249 this mode.
102 (minor-mode-alist): add LowPri indicator. 250 (minor-mode-alist): Add LowPri indicator.
103 (rcirc-toggle-low-priority): New function. 251 (rcirc-toggle-low-priority): New function.
104 (rcirc-last-non-irc-buffer): Prefix arg now no means switch to 252 (rcirc-last-non-irc-buffer): Prefix arg now no means switch to
105 next lowpriority buffer with activity. 253 next lowpriority buffer with activity.
@@ -132,8 +280,7 @@
132 280
1332006-04-07 Reiner Steib <Reiner.Steib@gmx.de> 2812006-04-07 Reiner Steib <Reiner.Steib@gmx.de>
134 282
135 * pgg-gpg.el: Revert to revision 1.8 to allow the use of 283 * pgg-gpg.el: Revert to revision 1.8 to allow the use of gpg-agent.
136 gpg-agent.
137 284
1382006-04-07 Nick Roberts <nickrob@snap.net.nz> 2852006-04-07 Nick Roberts <nickrob@snap.net.nz>
139 286
@@ -146,21 +293,20 @@
146 293
147 * textmodes/paragraphs.el (sentence-end): Use string-or-null-p. 294 * textmodes/paragraphs.el (sentence-end): Use string-or-null-p.
148 295
149 * textmodes/ispell.el (ispell-local-dictionary): Use 296 * textmodes/ispell.el (ispell-local-dictionary): Use string-or-null-p.
150 string-or-null-p.
151 297
152 * files.el: Update comment about safe-local-variable declarations. 298 * files.el: Update comment about safe-local-variable declarations.
153 299
1542006-04-06 J.D. Smith <jdsmith@as.arizona.edu> 3002006-04-06 J.D. Smith <jdsmith@as.arizona.edu>
155 301
156 * progmodes/idlwave.el: Updated to IDLWAVE version 6.0. See 302 * progmodes/idlwave.el: Updated to IDLWAVE version 6.0.
157 idlwave.org. 303 See idlwave.org.
158 304
159 * progmodes/idlw-shell.el: Updated to IDLWAVE version 6.0. See 305 * progmodes/idlw-shell.el: Updated to IDLWAVE version 6.0.
160 idlwave.org. Includes code to obsolete idlw-rinfo.el. 306 See idlwave.org. Includes code to obsolete idlw-rinfo.el.
161 307
162 * progmodes/idlw-help.el: Updated to IDLWAVE version 6.0. See 308 * progmodes/idlw-help.el: Updated to IDLWAVE version 6.0.
163 idlwave.org. 309 See idlwave.org.
164 310
165 * progmodes/idlw-complete-structtag.el: Updated to IDLWAVE 311 * progmodes/idlw-complete-structtag.el: Updated to IDLWAVE
166 version 6.0 (minimal changes). See idlwave.org. 312 version 6.0 (minimal changes). See idlwave.org.
@@ -231,8 +377,8 @@
231 377
2322006-04-05 Daiki Ueno <ueno@unixuser.org> 3782006-04-05 Daiki Ueno <ueno@unixuser.org>
233 379
234 * pgg-gpg.el (pgg-gpg-encrypt-region, pgg-gpg-sign-region): Wait 380 * pgg-gpg.el (pgg-gpg-encrypt-region, pgg-gpg-sign-region):
235 for BEGIN_SIGNING too, new in GnuPG 1.4.3. 381 Wait for BEGIN_SIGNING too, new in GnuPG 1.4.3.
236 382
2372006-04-05 Kenichi Handa <handa@m17n.org> 3832006-04-05 Kenichi Handa <handa@m17n.org>
238 384
@@ -245,8 +391,7 @@
245 default-enable-multibyte-characters. This reverts the change from 391 default-enable-multibyte-characters. This reverts the change from
246 revision 6.17 which is no longer necessary because the passphrase 392 revision 6.17 which is no longer necessary because the passphrase
247 is sent separately now. GnuPG messages are unreadable under 393 is sent separately now. GnuPG messages are unreadable under
248 multibyte locales with default-enable-multibyte-characters set to 394 multibyte locales with default-enable-multibyte-characters set to nil.
249 nil.
250 395
2512006-04-04 Andreas Schwab <schwab@suse.de> 3962006-04-04 Andreas Schwab <schwab@suse.de>
252 397
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index e2275ce356d..4de2a431392 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -786,7 +786,7 @@ when the action is chosen.")
786 (if (or (and (= 1 (length children)) 786 (if (or (and (= 1 (length children))
787 (memq (widget-type (car children)) 787 (memq (widget-type (car children))
788 '(custom-variable custom-face))) 788 '(custom-variable custom-face)))
789 (y-or-n-p "Reset all settings' buffer text to show current values? ")) 789 (y-or-n-p "Reset all settings' buffer text to show current values? "))
790 (mapc (lambda (widget) 790 (mapc (lambda (widget)
791 (if (memq (widget-get widget :custom-state) 791 (if (memq (widget-get widget :custom-state)
792 '(modified changed)) 792 '(modified changed))
@@ -1079,6 +1079,18 @@ Show the buffer in another window, but don't select it."
1079(defvar customize-changed-options-previous-release "21.1" 1079(defvar customize-changed-options-previous-release "21.1"
1080 "Version for `customize-changed-options' to refer back to by default.") 1080 "Version for `customize-changed-options' to refer back to by default.")
1081 1081
1082;; Packages will update this variable, so make it available.
1083;;;###autoload
1084(defvar customize-package-emacs-version-alist nil
1085 "Alist that maps packages to alists of package to Emacs versions.
1086The value alists map all package versions used with
1087the :package-version keyword to Emacs versions. Packages are
1088symbols and versions are strings.
1089
1090For example:
1091 '((MH-E (\"7.4\" \"22.1\") (\"8.0\" \"22.1\"))
1092 (Gnus (\"5.11\" \"22.1\")))")
1093
1082;;;###autoload 1094;;;###autoload
1083(defalias 'customize-changed 'customize-changed-options) 1095(defalias 'customize-changed 'customize-changed-options)
1084 1096
@@ -1119,7 +1131,12 @@ that were added or redefined since that version."
1119 (let (found) 1131 (let (found)
1120 (mapatoms 1132 (mapatoms
1121 (lambda (symbol) 1133 (lambda (symbol)
1122 (let ((version (get symbol 'custom-version))) 1134 (let* ((package-version (get symbol 'custom-package-version))
1135 (version
1136 (or (and package-version
1137 (customize-package-emacs-version symbol
1138 package-version))
1139 (get symbol 'custom-version))))
1123 (if version 1140 (if version
1124 (when (customize-version-lessp since-version version) 1141 (when (customize-version-lessp since-version version)
1125 (if (or (get symbol 'custom-group) 1142 (if (or (get symbol 'custom-group)
@@ -1135,6 +1152,31 @@ that were added or redefined since that version."
1135 (error "No user option defaults have been changed since Emacs %s" 1152 (error "No user option defaults have been changed since Emacs %s"
1136 since-version)))) 1153 since-version))))
1137 1154
1155(defun customize-package-emacs-version (symbol package-version)
1156 "Return Emacs version of SYMBOL.
1157PACKAGE-VERSION has the form (PACKAGE VERSION). The VERSION of
1158PACKAGE is looked up in the associated list
1159`customize-package-emacs-version-alist' to find the version of
1160Emacs that is associated with it."
1161 (let (package-versions emacs-version)
1162 ;; Use message instead of error since we want user to be able to
1163 ;; see the rest of the symbols even if a package author has
1164 ;; botched things up.
1165 (cond ((not (listp package-version))
1166 (message "Invalid package-version value for %s" symbol))
1167 ((setq package-versions (assq (car package-version)
1168 customize-package-emacs-version-alist))
1169 (setq emacs-version
1170 (cadr (assoc (cadr package-version) package-versions)))
1171 (unless emacs-version
1172 (message "Package version of %s not found in %s" symbol
1173 "customize-package-emacs-version-alist")))
1174 (t
1175 (message "Package %s neglected to update %s"
1176 (car package-version)
1177 "customize-package-emacs-version-alist")))
1178 emacs-version))
1179
1138(defun customize-version-lessp (version1 version2) 1180(defun customize-version-lessp (version1 version2)
1139 ;; Why are the versions strings, and given that they are, why aren't 1181 ;; Why are the versions strings, and given that they are, why aren't
1140 ;; they converted to numbers and compared as such here? -- fx 1182 ;; they converted to numbers and compared as such here? -- fx
diff --git a/lisp/custom.el b/lisp/custom.el
index c67f3b06272..cd97b425038 100644
--- a/lisp/custom.el
+++ b/lisp/custom.el
@@ -203,8 +203,27 @@ The following keywords are meaningful:
203 203
204:type VALUE should be a widget type for editing the symbol's value. 204:type VALUE should be a widget type for editing the symbol's value.
205:options VALUE should be a list of valid members of the widget type. 205:options VALUE should be a list of valid members of the widget type.
206:initialize
207 VALUE should be a function used to initialize the
208 variable. It takes two arguments, the symbol and value
209 given in the `defcustom' call. The default is
210 `custom-initialize-reset'.
211:set VALUE should be a function to set the value of the symbol.
212 It takes two arguments, the symbol to set and the value to
213 give it. The default choice of function is `custom-set-default'.
214:get VALUE should be a function to extract the value of symbol.
215 The function takes one argument, a symbol, and should return
216 the current value for that symbol. The default choice of function
217 is `custom-default-value'.
218:require
219 VALUE should be a feature symbol. If you save a value
220 for this option, then when your `.emacs' file loads the value,
221 it does (require VALUE) first.
222
223The following common keywords are also meaningful.
224
206:group VALUE should be a customization group. 225:group VALUE should be a customization group.
207 Add SYMBOL to that group. 226 Add SYMBOL (or FACE with `defface') to that group.
208:link LINK-DATA 227:link LINK-DATA
209 Include an external link after the documentation string for this 228 Include an external link after the documentation string for this
210 item. This is a sentence containing an active field which 229 item. This is a sentence containing an active field which
@@ -248,26 +267,16 @@ The following keywords are meaningful:
248 267
249 An item can have more than one external link; however, most items 268 An item can have more than one external link; however, most items
250 have none at all. 269 have none at all.
251:initialize
252 VALUE should be a function used to initialize the
253 variable. It takes two arguments, the symbol and value
254 given in the `defcustom' call. The default is
255 `custom-initialize-reset'.
256:set VALUE should be a function to set the value of the symbol.
257 It takes two arguments, the symbol to set and the value to
258 give it. The default choice of function is `custom-set-default'.
259:get VALUE should be a function to extract the value of symbol.
260 The function takes one argument, a symbol, and should return
261 the current value for that symbol. The default choice of function
262 is `custom-default-value'.
263:require
264 VALUE should be a feature symbol. If you save a value
265 for this option, then when your `.emacs' file loads the value,
266 it does (require VALUE) first.
267:version 270:version
268 VALUE should be a string specifying that the variable was 271 VALUE should be a string specifying that the variable was
269 first introduced, or its default value was changed, in Emacs 272 first introduced, or its default value was changed, in Emacs
270 version VERSION. 273 version VERSION.
274:package-version
275 VALUE should be a list with the form (PACKAGE VERSION)
276 specifying that the variable was first introduced, or its
277 default value was changed, in PACKAGE version VERSION. This
278 keyword takes priority over :version. The PACKAGE and VERSION
279 must appear in the alist `customize-package-emacs-version-alist'.
271:tag LABEL 280:tag LABEL
272 Use LABEL, a string, instead of the item's name, to label the item 281 Use LABEL, a string, instead of the item's name, to label the item
273 in customization menus and buffers. 282 in customization menus and buffers.
@@ -286,8 +295,8 @@ to load a file defining variables with this form, or with
286_outside_ any bindings for these variables. \(`defvar' and 295_outside_ any bindings for these variables. \(`defvar' and
287`defconst' behave similarly in this respect.) 296`defconst' behave similarly in this respect.)
288 297
289Read the section about customization in the Emacs Lisp manual for more 298See Info node `(elisp) Customization' in the Emacs Lisp manual
290information." 299for more information."
291 (declare (doc-string 3)) 300 (declare (doc-string 3))
292 ;; It is better not to use backquote in this file, 301 ;; It is better not to use backquote in this file,
293 ;; because that makes a bootstrapping problem 302 ;; because that makes a bootstrapping problem
@@ -314,10 +323,8 @@ The remaining arguments should have the form
314 323
315 [KEYWORD VALUE]... 324 [KEYWORD VALUE]...
316 325
317The following KEYWORDs are defined: 326For a list of valid keywords, see the common keywords listed in
318 327`defcustom'.
319:group VALUE should be a customization group.
320 Add FACE to that group.
321 328
322SPEC should be an alist of the form ((DISPLAY ATTS)...). 329SPEC should be an alist of the form ((DISPLAY ATTS)...).
323 330
@@ -368,8 +375,8 @@ corresponding ITEMs. These are the defined REQ values:
368 the function `display-supports-face-attributes-p' for more 375 the function `display-supports-face-attributes-p' for more
369 information on exactly how testing is done. 376 information on exactly how testing is done.
370 377
371Read the section about customization in the Emacs Lisp manual for more 378See Info node `(elisp) Customization' in the Emacs Lisp manual
372information." 379for more information."
373 (declare (doc-string 3)) 380 (declare (doc-string 3))
374 ;; It is better not to use backquote in this file, 381 ;; It is better not to use backquote in this file,
375 ;; because that makes a bootstrapping problem 382 ;; because that makes a bootstrapping problem
@@ -426,16 +433,11 @@ The remaining arguments should have the form
426 433
427 [KEYWORD VALUE]... 434 [KEYWORD VALUE]...
428 435
429The following KEYWORDs are defined: 436For a list of valid keywords, see the common keywords listed in
430 437`defcustom'.
431:group VALUE should be a customization group.
432 Add SYMBOL to that group.
433 438
434:version VALUE should be a string specifying that the group was introduced 439See Info node `(elisp) Customization' in the Emacs Lisp manual
435 in Emacs version VERSION. 440for more information."
436
437Read the section about customization in the Emacs Lisp manual for more
438information."
439 (declare (doc-string 3)) 441 (declare (doc-string 3))
440 ;; It is better not to use backquote in this file, 442 ;; It is better not to use backquote in this file,
441 ;; because that makes a bootstrapping problem 443 ;; because that makes a bootstrapping problem
@@ -489,6 +491,8 @@ Fourth argument TYPE is the custom option type."
489 (custom-add-to-group value symbol type)) 491 (custom-add-to-group value symbol type))
490 ((eq keyword :version) 492 ((eq keyword :version)
491 (custom-add-version symbol value)) 493 (custom-add-version symbol value))
494 ((eq keyword :package-version)
495 (custom-add-package-version symbol value))
492 ((eq keyword :link) 496 ((eq keyword :link)
493 (custom-add-link symbol value)) 497 (custom-add-link symbol value))
494 ((eq keyword :load) 498 ((eq keyword :load)
@@ -540,6 +544,10 @@ For other custom types, this has no effect."
540 "To the custom option SYMBOL add the version VERSION." 544 "To the custom option SYMBOL add the version VERSION."
541 (put symbol 'custom-version (purecopy version))) 545 (put symbol 'custom-version (purecopy version)))
542 546
547(defun custom-add-package-version (symbol version)
548 "To the custom option SYMBOL add the package version VERSION."
549 (put symbol 'custom-package-version (purecopy version)))
550
543(defun custom-add-load (symbol load) 551(defun custom-add-load (symbol load)
544 "To the custom option SYMBOL add the dependency LOAD. 552 "To the custom option SYMBOL add the dependency LOAD.
545LOAD should be either a library file name, or a feature name." 553LOAD should be either a library file name, or a feature name."
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 83620f3344f..da284e94548 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -1650,8 +1650,12 @@ The value is non-nil if there were no errors, nil if errors."
1650 ;; If they change the file name, then change it for the output also. 1650 ;; If they change the file name, then change it for the output also.
1651 (let ((buffer-file-name filename) 1651 (let ((buffer-file-name filename)
1652 (default-major-mode 'emacs-lisp-mode) 1652 (default-major-mode 'emacs-lisp-mode)
1653 ;; Ignore unsafe local variables.
1654 ;; We only care about a few of them for our purposes.
1655 (enable-local-variables :safe)
1653 (enable-local-eval nil)) 1656 (enable-local-eval nil))
1654 (normal-mode) 1657 ;; Arg of t means don't alter enable-local-variables.
1658 (normal-mode t)
1655 (setq filename buffer-file-name)) 1659 (setq filename buffer-file-name))
1656 ;; Set the default directory, in case an eval-when-compile uses it. 1660 ;; Set the default directory, in case an eval-when-compile uses it.
1657 (setq default-directory (file-name-directory filename))) 1661 (setq default-directory (file-name-directory filename)))
diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
index 4f961df0791..754ad9fdf19 100644
--- a/lisp/emacs-lisp/find-func.el
+++ b/lisp/emacs-lisp/find-func.el
@@ -64,7 +64,7 @@
64 (concat 64 (concat
65 "^\\s-*(\\(def\\(ine-skeleton\\|ine-generic-mode\\|ine-derived-mode\\|\ 65 "^\\s-*(\\(def\\(ine-skeleton\\|ine-generic-mode\\|ine-derived-mode\\|\
66ine\\(?:-global\\)?-minor-mode\\|ine-compilation-mode\\|un-cvs-mode\\|\ 66ine\\(?:-global\\)?-minor-mode\\|ine-compilation-mode\\|un-cvs-mode\\|\
67foo\\|[^cfgv]\\w+\\*?\\)\\|easy-mmode-define-[a-z-]+\\|easy-menu-define\\|\ 67foo\\|[^cfgv]\\(\\w\\|\\s_\\)+\\*?\\)\\|easy-mmode-define-[a-z-]+\\|easy-menu-define\\|\
68menu-bar-make-toggle\\)" 68menu-bar-make-toggle\\)"
69 find-function-space-re 69 find-function-space-re
70 "\\('\\|\(quote \\)?%s\\(\\s-\\|$\\|\(\\|\)\\)") 70 "\\('\\|\(quote \\)?%s\\(\\s-\\|$\\|\(\\|\)\\)")
@@ -229,7 +229,7 @@ The search is done in the source for library LIBRARY."
229 (goto-char (point-min)) 229 (goto-char (point-min))
230 (if (or (re-search-forward regexp nil t) 230 (if (or (re-search-forward regexp nil t)
231 (re-search-forward 231 (re-search-forward
232 (concat "^([^ ]+" find-function-space-re "['(]" 232 (concat "^([^ ]+" find-function-space-re "['(]?"
233 (regexp-quote (symbol-name symbol)) 233 (regexp-quote (symbol-name symbol))
234 "\\_>") 234 "\\_>")
235 nil t)) 235 nil t))
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog
index 67799d73049..49b274b5149 100644
--- a/lisp/erc/ChangeLog
+++ b/lisp/erc/ChangeLog
@@ -1,3 +1,23 @@
12006-04-05 Diane Murray <disumu@x3y2z1.net>
2
3 * erc.el (erc-cmd-SV): Removed the exclamation point. Show the
4 build date as it's shown in `emacs-version'.
5
6 * erc-capab.el (erc-capab-identify-add-prefix): Insert the prefix
7 with the same face property as the previous character.
8
92006-04-02 Michael Olson <mwolson@gnu.org>
10
11 * erc-backend.el, erc-ezbounce.el, erc-join.el, erc-netsplit.el,
12 erc.el: Make sure to include a newline inside of negated classes,
13 so that a newline is not matched.
14
152006-04-01 Michael Olson <mwolson@gnu.org>
16
17 * erc-backend.el (erc-server-connect-function): Don't try to
18 detect the existence of the `open-network-stream-nowait' function,
19 since I can't find it in Emacs21, XEmacs21, or Emacs22.
20
12006-03-26 Michael Olson <mwolson@gnu.org> 212006-03-26 Michael Olson <mwolson@gnu.org>
2 22
3 * erc.el (erc-header-line): New face that will be used to colorize 23 * erc.el (erc-header-line): New face that will be used to colorize
diff --git a/lisp/erc/erc-backend.el b/lisp/erc/erc-backend.el
index a99af9dea64..3ea0f74eed7 100644
--- a/lisp/erc/erc-backend.el
+++ b/lisp/erc/erc-backend.el
@@ -312,13 +312,7 @@ alist."
312 :type '(repeat (cons (string :tag "Target") 312 :type '(repeat (cons (string :tag "Target")
313 coding-system))) 313 coding-system)))
314 314
315(defcustom erc-server-connect-function 315(defcustom erc-server-connect-function 'open-network-stream
316 (if (and (fboundp 'open-network-stream-nowait)
317 ;; CVS Emacs claims to define open-network-stream-nowait on
318 ;; windows, however, it does, in fact, not work.
319 (not (memq system-type '(windows-nt cygwin ms-dos darwin))))
320 'open-network-stream-nowait
321 'open-network-stream)
322 "Function used to initiate a connection. 316 "Function used to initiate a connection.
323It should take same arguments as `open-network-stream' does." 317It should take same arguments as `open-network-stream' does."
324 :group 'erc-server 318 :group 'erc-server
@@ -762,10 +756,10 @@ PROCs `process-buffer' is `current-buffer' when this function is called."
762 (substring string 1 posn))) 756 (substring string 1 posn)))
763 757
764 (setf (erc-response.command msg) 758 (setf (erc-response.command msg)
765 (let* ((bposn (string-match "[^ ]" string posn)) 759 (let* ((bposn (string-match "[^ \n]" string posn))
766 (eposn (string-match " " string bposn))) 760 (eposn (string-match " " string bposn)))
767 (setq posn (and eposn 761 (setq posn (and eposn
768 (string-match "[^ ]" string eposn))) 762 (string-match "[^ \n]" string eposn)))
769 (substring string bposn eposn))) 763 (substring string bposn eposn)))
770 764
771 (while (and posn 765 (while (and posn
@@ -773,7 +767,7 @@ PROCs `process-buffer' is `current-buffer' when this function is called."
773 (push (let* ((bposn posn) 767 (push (let* ((bposn posn)
774 (eposn (string-match " " string bposn))) 768 (eposn (string-match " " string bposn)))
775 (setq posn (and eposn 769 (setq posn (and eposn
776 (string-match "[^ ]" string eposn))) 770 (string-match "[^ \n]" string eposn)))
777 (substring string bposn eposn)) 771 (substring string bposn eposn))
778 (erc-response.command-args msg))) 772 (erc-response.command-args msg)))
779 (when posn 773 (when posn
diff --git a/lisp/erc/erc-ezbounce.el b/lisp/erc/erc-ezbounce.el
index 48395bf1dab..d04fe782f7e 100644
--- a/lisp/erc/erc-ezbounce.el
+++ b/lisp/erc/erc-ezbounce.el
@@ -139,7 +139,7 @@ in the alist is `nil', prompt for the appropriate values."
139(defun erc-ezb-add-session (message) 139(defun erc-ezb-add-session (message)
140 "Add an EZBounce session to the session list." 140 "Add an EZBounce session to the session list."
141 (when (and erc-ezb-inside-session-listing 141 (when (and erc-ezb-inside-session-listing
142 (string-match "^\\([^ ]+\\) +\\([^ ]+\\) +\\([^ ]+\\) +\\([^ ]+\\)$" message)) 142 (string-match "^\\([^ \n]+\\) +\\([^ \n]+\\) +\\([^ \n]+\\) +\\([^ \n]+\\)$" message))
143 (let ((id (match-string 1 message)) 143 (let ((id (match-string 1 message))
144 (nick (match-string 2 message)) 144 (nick (match-string 2 message))
145 (to (match-string 3 message))) 145 (to (match-string 3 message)))
diff --git a/lisp/erc/erc-join.el b/lisp/erc/erc-join.el
index 0d2c1f98706..86b79c538f1 100644
--- a/lisp/erc/erc-join.el
+++ b/lisp/erc/erc-join.el
@@ -92,7 +92,7 @@ servers, presumably in the same domain."
92 (or erc-server-announced-name erc-session-server)))) 92 (or erc-server-announced-name erc-session-server))))
93 (when (erc-current-nick-p nick) 93 (when (erc-current-nick-p nick)
94 (when (and erc-autojoin-domain-only 94 (when (and erc-autojoin-domain-only
95 (string-match "[^.]+\\.\\([^.]+\\.[^.]+\\)$" server)) 95 (string-match "[^.\n]+\\.\\([^.\n]+\\.[^.\n]+\\)$" server))
96 (setq server (match-string 1 server))) 96 (setq server (match-string 1 server)))
97 (let ((elem (assoc server erc-autojoin-channels-alist))) 97 (let ((elem (assoc server erc-autojoin-channels-alist)))
98 (if elem 98 (if elem
@@ -115,7 +115,7 @@ servers, presumably in the same domain."
115 (or erc-server-announced-name erc-session-server)))) 115 (or erc-server-announced-name erc-session-server))))
116 (when (erc-current-nick-p nick) 116 (when (erc-current-nick-p nick)
117 (when (and erc-autojoin-domain-only 117 (when (and erc-autojoin-domain-only
118 (string-match "[^.]+\\.\\([^.]+\\.[^.]+\\)$" server)) 118 (string-match "[^.\n]+\\.\\([^.\n]+\\.[^.\n]+\\)$" server))
119 (setq server (match-string 1 server))) 119 (setq server (match-string 1 server)))
120 (let ((elem (assoc server erc-autojoin-channels-alist))) 120 (let ((elem (assoc server erc-autojoin-channels-alist)))
121 (when elem 121 (when elem
diff --git a/lisp/erc/erc-netsplit.el b/lisp/erc/erc-netsplit.el
index a982b5e7c7e..72e7b8bbd7f 100644
--- a/lisp/erc/erc-netsplit.el
+++ b/lisp/erc/erc-netsplit.el
@@ -64,7 +64,8 @@ sever buffer."
64 :group 'erc-netsplit 64 :group 'erc-netsplit
65 :type 'boolean) 65 :type 'boolean)
66 66
67(defcustom erc-netsplit-regexp "^[^ @!\"]+\\.[^ @!]+ [^ @!]+\\.[^ @!\"]+$" 67(defcustom erc-netsplit-regexp
68 "^[^ @!\"\n]+\\.[^ @!\n]+ [^ @!\n]+\\.[^ @!\"\n]+$"
68 "This regular expression should match quit reasons produced 69 "This regular expression should match quit reasons produced
69by netsplits." 70by netsplits."
70 :group 'erc-netsplit 71 :group 'erc-netsplit
@@ -131,7 +132,7 @@ join from that split has been detected or not.")
131(defun erc-netsplit-MODE (proc parsed) 132(defun erc-netsplit-MODE (proc parsed)
132 "Hide mode changes from servers." 133 "Hide mode changes from servers."
133 ;; regexp matches things with a . in them, and no ! or @ in them. 134 ;; regexp matches things with a . in them, and no ! or @ in them.
134 (when (string-match "^[^@!]+\\.[^@!]+$" (erc-response.sender parsed)) 135 (when (string-match "^[^@!\n]+\\.[^@!\n]+$" (erc-response.sender parsed))
135 (and erc-netsplit-debug 136 (and erc-netsplit-debug
136 (erc-display-message 137 (erc-display-message
137 parsed 'notice (process-buffer proc) 138 parsed 'notice (process-buffer proc)
diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el
index 63aac8a625e..1baede01259 100644
--- a/lisp/erc/erc.el
+++ b/lisp/erc/erc.el
@@ -3132,7 +3132,7 @@ the message given by REASON."
3132 3132
3133(defun erc-cmd-SV () 3133(defun erc-cmd-SV ()
3134 "Say the current ERC and Emacs version into channel." 3134 "Say the current ERC and Emacs version into channel."
3135 (erc-send-message (format "I'm using ERC %s with %s %s (%s%s%s)!" 3135 (erc-send-message (format "I'm using ERC %s with %s %s (%s%s) of %s."
3136 erc-version-string 3136 erc-version-string
3137 (if (featurep 'xemacs) "XEmacs" "GNU Emacs") 3137 (if (featurep 'xemacs) "XEmacs" "GNU Emacs")
3138 emacs-version 3138 emacs-version
@@ -3155,7 +3155,7 @@ the message given by REASON."
3155 x-toolkit-scroll-bars))) 3155 x-toolkit-scroll-bars)))
3156 "") 3156 "")
3157 (if (featurep 'multi-tty) ", multi-tty" "")) 3157 (if (featurep 'multi-tty) ", multi-tty" ""))
3158 (concat ", built " erc-emacs-build-time))) 3158 erc-emacs-build-time))
3159 t) 3159 t)
3160 3160
3161(defun erc-cmd-SM () 3161(defun erc-cmd-SM ()
@@ -3490,7 +3490,7 @@ If FACE is non-nil, it will be used to propertize the prompt. If it is nil,
3490If `point' is at the beginning of a channel name, use that as default." 3490If `point' is at the beginning of a channel name, use that as default."
3491 (interactive 3491 (interactive
3492 (list 3492 (list
3493 (let ((chnl (if (looking-at "\\([&#+!][^ ]+\\)") (match-string 1) "")) 3493 (let ((chnl (if (looking-at "\\([&#+!][^ \n]+\\)") (match-string 1) ""))
3494 (table (when (erc-server-buffer-live-p) 3494 (table (when (erc-server-buffer-live-p)
3495 (set-buffer (process-buffer erc-server-process)) 3495 (set-buffer (process-buffer erc-server-process))
3496 erc-channel-list))) 3496 erc-channel-list)))
@@ -4734,12 +4734,12 @@ EmacsSpeak support."
4734 4734
4735Return a list of the three separate tokens." 4735Return a list of the three separate tokens."
4736 (cond 4736 (cond
4737 ((string-match "^\\([^!]*\\)!\\([^@]*\\)@\\(.*\\)$" string) 4737 ((string-match "^\\([^!\n]*\\)!\\([^@\n]*\\)@\\(.*\\)$" string)
4738 (list (match-string 1 string) 4738 (list (match-string 1 string)
4739 (match-string 2 string) 4739 (match-string 2 string)
4740 (match-string 3 string))) 4740 (match-string 3 string)))
4741 ;; Some bogus bouncers send Nick!(null), try to live with that. 4741 ;; Some bogus bouncers send Nick!(null), try to live with that.
4742 ((string-match "^\\([^!]*\\)!\\(.*\\)$" string) 4742 ((string-match "^\\([^!\n]*\\)!\\(.*\\)$" string)
4743 (list (match-string 1 string) 4743 (list (match-string 1 string)
4744 "" 4744 ""
4745 (match-string 2 string))) 4745 (match-string 2 string)))
@@ -5053,7 +5053,7 @@ user matches any regexp in `erc-ignore-reply-list'."
5053 "Return the addressed target in MSG. 5053 "Return the addressed target in MSG.
5054 5054
5055The addressed target is the string before the first colon in MSG." 5055The addressed target is the string before the first colon in MSG."
5056 (if (string-match "^\\([^: ]*\\):" msg) 5056 (if (string-match "^\\([^: \n]*\\):" msg)
5057 (match-string 1 msg) 5057 (match-string 1 msg)
5058 nil)) 5058 nil))
5059 5059
diff --git a/lisp/files.el b/lisp/files.el
index b21b29957b5..440f2ea4f27 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -444,14 +444,19 @@ use `before-save-hook'.")
444 444
445(defcustom enable-local-variables t 445(defcustom enable-local-variables t
446 "*Control use of local variables in files you visit. 446 "*Control use of local variables in files you visit.
447The value can be t, nil or something else. 447The value can be t, nil, :safe, or something else.
448 448
449A value of t means file local variables specifications are obeyed 449A value of t means file local variables specifications are obeyed
450if all the specified variable values are safe; if any values are 450if all the specified variable values are safe; if any values are
451not safe, Emacs queries you, once, whether to set them all. 451not safe, Emacs queries you, once, whether to set them all.
452\(When you say yes to certain values, they are remembered as safe.)
453
454:safe means set the safe variables, and ignore the rest.
455nil means always ignore the file local variables.
452 456
453A value of nil means always ignore the file local variables.
454Any other value means always query you once whether to set them all. 457Any other value means always query you once whether to set them all.
458\(When you say yes to certain values, they are remembered as safe, but
459this has no effect when `enable-local-variables' is \"something else\".)
455 460
456This variable also controls use of major modes specified in 461This variable also controls use of major modes specified in
457a -*- line. 462a -*- line.
@@ -460,6 +465,7 @@ The command \\[normal-mode], when used interactively,
460always obeys file local variable specifications and the -*- line, 465always obeys file local variable specifications and the -*- line,
461and ignores this variable." 466and ignores this variable."
462 :type '(choice (const :tag "Obey" t) 467 :type '(choice (const :tag "Obey" t)
468 (const :tag "Safe Only" :safe)
463 (const :tag "Ignore" nil) 469 (const :tag "Ignore" nil)
464 (other :tag "Query" other)) 470 (other :tag "Query" other))
465 :group 'find-file) 471 :group 'find-file)
@@ -1779,8 +1785,7 @@ Uses the visited file name, the -*- line, and the local variables spec.
1779 1785
1780This function is called automatically from `find-file'. In that case, 1786This function is called automatically from `find-file'. In that case,
1781we may set up the file-specified mode and local variables, 1787we may set up the file-specified mode and local variables,
1782depending on the value of `enable-local-variables': if it is t, we do; 1788depending on the value of `enable-local-variables'.
1783if it is nil, we don't; otherwise, we query.
1784In addition, if `local-enable-local-variables' is nil, we do 1789In addition, if `local-enable-local-variables' is nil, we do
1785not set local variables (though we do notice a mode specified with -*-.) 1790not set local variables (though we do notice a mode specified with -*-.)
1786 1791
@@ -2414,8 +2419,7 @@ n -- to ignore the local variables list.")
2414 "" 2419 ""
2415 ", or C-v to scroll"))) 2420 ", or C-v to scroll")))
2416 (goto-char (point-min)) 2421 (goto-char (point-min))
2417 (let ((inhibit-quit t) 2422 (let ((cursor-in-echo-area t)
2418 (cursor-in-echo-area t)
2419 (exit-chars 2423 (exit-chars
2420 (if offer-save '(?! ?y ?n ?\s ?\C-g) '(?y ?n ?\s ?\C-g))) 2424 (if offer-save '(?! ?y ?n ?\s ?\C-g) '(?y ?n ?\s ?\C-g)))
2421 done) 2425 done)
@@ -2427,9 +2431,7 @@ n -- to ignore the local variables list.")
2427 (condition-case nil 2431 (condition-case nil
2428 (scroll-up) 2432 (scroll-up)
2429 (error (goto-char (point-min)))) 2433 (error (goto-char (point-min))))
2430 (setq done (memq (downcase char) exit-chars))))) 2434 (setq done (memq (downcase char) exit-chars))))))
2431 (if (= char ?\C-g)
2432 (setq quit-flag nil)))
2433 (setq char (downcase char)) 2435 (setq char (downcase char))
2434 (when (and offer-save (= char ?!) unsafe-vars) 2436 (when (and offer-save (= char ?!) unsafe-vars)
2435 (dolist (elt unsafe-vars) 2437 (dolist (elt unsafe-vars)
@@ -2617,13 +2619,22 @@ is specified, returning t if it is specified."
2617 (and (risky-local-variable-p var val) 2619 (and (risky-local-variable-p var val)
2618 (push elt risky-vars)) 2620 (push elt risky-vars))
2619 (push elt unsafe-vars)))) 2621 (push elt unsafe-vars))))
2620 (if (or (and (eq enable-local-variables t) 2622 (if (eq enable-local-variables :safe)
2621 (null unsafe-vars) 2623 ;; If caller wants only the safe variables,
2622 (null risky-vars)) 2624 ;; install only them.
2623 (hack-local-variables-confirm
2624 result unsafe-vars risky-vars))
2625 (dolist (elt result) 2625 (dolist (elt result)
2626 (hack-one-local-variable (car elt) (cdr elt))))) 2626 (unless (or (memq (car elt) unsafe-vars)
2627 (memq (car elt) risky-vars))
2628 (hack-one-local-variable (car elt) (cdr elt))))
2629 ;; Query, except in the case where all are known safe
2630 ;; if the user wants no quuery in that case.
2631 (if (or (and (eq enable-local-variables t)
2632 (null unsafe-vars)
2633 (null risky-vars))
2634 (hack-local-variables-confirm
2635 result unsafe-vars risky-vars))
2636 (dolist (elt result)
2637 (hack-one-local-variable (car elt) (cdr elt))))))
2627 (run-hooks 'hack-local-variables-hook)))))) 2638 (run-hooks 'hack-local-variables-hook))))))
2628 2639
2629(defun safe-local-variable-p (sym val) 2640(defun safe-local-variable-p (sym val)
diff --git a/lisp/finder.el b/lisp/finder.el
index fc96381e8f7..1374e1f4e76 100644
--- a/lisp/finder.el
+++ b/lisp/finder.el
@@ -104,6 +104,8 @@
104 (define-key map [mouse-2] 'finder-mouse-select) 104 (define-key map [mouse-2] 'finder-mouse-select)
105 (define-key map "\C-m" 'finder-select) 105 (define-key map "\C-m" 'finder-select)
106 (define-key map "?" 'finder-summary) 106 (define-key map "?" 'finder-summary)
107 (define-key map "n" 'next-line)
108 (define-key map "p" 'previous-line)
107 (define-key map "q" 'finder-exit) 109 (define-key map "q" 'finder-exit)
108 (define-key map "d" 'finder-list-keywords) 110 (define-key map "d" 'finder-list-keywords)
109 map)) 111 map))
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 0e077ce0b04..792fb2a5c0d 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,56 @@
12006-04-12 Katsumi Yamaoka <yamaoka@jpl.org>
2
3 * gnus-art.el (gnus-mime-view-part-as-charset): Ignore charset
4 that the part specifies.
5
6 * mm-decode.el (mm-display-part): Work with external parts and
7 usual parts similarly.
8
9 * mm-extern.el (mm-inline-external-body): Use mm-display-part
10 instead of gnus-display-mime.
11
12 * gnus-uu.el (gnus-uu-save-article): Put mml tags instead of part
13 tag to summarized topics part in order to encode non-ASCII text.
14
152006-04-12 Kenichi Handa <handa@m17n.org>
16
17 * rfc2231.el (rfc2231-decode-encoded-string): Work on unibyte
18 buffer and then decode the buffer text if necessary.
19 (rfc2231-encode-string): Be sure to work on multibyte buffer at
20 first, and after mm-encode-body, change the buffer to unibyte.
21
222006-04-11 Reiner Steib <Reiner.Steib@gmx.de>
23
24 * gnus-art.el (gnus-button-valid-localpart-regexp): Exclude `@'.
25
262006-04-11 Arne J,Ax(Brgensen <arne@arnested.dk>
27
28 * gnus-sieve.el (gnus-sieve-generate): Delete from the start of
29 the sieve region.
30
312006-04-11 Reiner Steib <Reiner.Steib@gmx.de>
32
33 * gnus.el: Gnus v5.10.8 is released.
34
352006-04-11 Lars Magne Ingebrigtsen <larsi@gnus.org>
36
37 * nnslashdot.el (nnslashdot-retrieve-headers-1): Fix up to new
38 layout.
39
40 * rfc2047.el (rfc2047-decode-encoded-words): Don't message about
41 unknown charset.
42
43 * message.el (message-header-synonyms): Add Original-To to the
44 default.
45
46 * gnus-sum.el (gnus-get-newsgroup-headers-xover): group is an
47 optional parameter.
48
492006-04-07 Reiner Steib <Reiner.Steib@gmx.de>
50
51 * pgg-gpg.el: Revert to revision 7.15 to allow the use of
52 gpg-agent.
53
12006-04-06 Reiner Steib <Reiner.Steib@gmx.de> 542006-04-06 Reiner Steib <Reiner.Steib@gmx.de>
2 55
3 * gnus-fun.el (gnus): Require it for gnus-directory. 56 * gnus-fun.el (gnus): Require it for gnus-directory.
diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el
index 69fe8159c10..a4da4ae85f3 100644
--- a/lisp/gnus/gnus-art.el
+++ b/lisp/gnus/gnus-art.el
@@ -4477,19 +4477,29 @@ are decompressed."
4477specified charset." 4477specified charset."
4478 (interactive (list nil current-prefix-arg)) 4478 (interactive (list nil current-prefix-arg))
4479 (gnus-article-check-buffer) 4479 (gnus-article-check-buffer)
4480 (let* ((handle (or handle (get-text-property (point) 'gnus-data))) 4480 (let ((handle (or handle (get-text-property (point) 'gnus-data)))
4481 contents charset 4481 (fun (get-text-property (point) 'gnus-callback))
4482 (b (point)) 4482 (gnus-newsgroup-ignored-charsets 'gnus-all)
4483 (inhibit-read-only t)) 4483 gnus-newsgroup-charset type charset)
4484 (when handle 4484 (when handle
4485 (if (mm-handle-undisplayer handle) 4485 (if (mm-handle-undisplayer handle)
4486 (mm-remove-part handle)) 4486 (mm-remove-part handle))
4487 (let ((gnus-newsgroup-charset 4487 (when fun
4488 (or (cdr (assq arg 4488 (setq gnus-newsgroup-charset
4489 gnus-summary-show-article-charset-alist)) 4489 (or (cdr (assq arg gnus-summary-show-article-charset-alist))
4490 (mm-read-coding-system "Charset: "))) 4490 (mm-read-coding-system "Charset: ")))
4491 (gnus-newsgroup-ignored-charsets 'gnus-all)) 4491 ;; Strip the charset parameter from `handle'.
4492 (gnus-article-press-button))))) 4492 (setq type (mm-handle-type
4493 (if (equal (mm-handle-media-type handle)
4494 "message/external-body")
4495 (progn
4496 (unless (mm-handle-cache handle)
4497 (mm-extern-cache-contents handle))
4498 (mm-handle-cache handle))
4499 handle))
4500 charset (assq 'charset (cdr type)))
4501 (delq charset type)
4502 (funcall fun handle)))))
4493 4503
4494(defun gnus-mime-view-part-externally (&optional handle) 4504(defun gnus-mime-view-part-externally (&optional handle)
4495 "View the MIME part under point with an external viewer." 4505 "View the MIME part under point with an external viewer."
@@ -5972,7 +5982,7 @@ groups."
5972 5982
5973;; Regexp suggested by Felix Wiemann in <87oeuomcz9.fsf@news2.ososo.de> 5983;; Regexp suggested by Felix Wiemann in <87oeuomcz9.fsf@news2.ososo.de>
5974(defcustom gnus-button-valid-localpart-regexp 5984(defcustom gnus-button-valid-localpart-regexp
5975 "[a-z0-9$%(*-=?[_][^<>\")!;:,{}\n\t ]*" 5985 "[a-z0-9$%(*-=?[_][^<>\")!;:,{}\n\t @]*"
5976 "Regular expression that matches a localpart of mail addresses or MIDs." 5986 "Regular expression that matches a localpart of mail addresses or MIDs."
5977 :version "22.1" 5987 :version "22.1"
5978 :group 'gnus-article-buttons 5988 :group 'gnus-article-buttons
diff --git a/lisp/gnus/gnus-sieve.el b/lisp/gnus/gnus-sieve.el
index 99e8f6b4986..0e6c500d0f2 100644
--- a/lisp/gnus/gnus-sieve.el
+++ b/lisp/gnus/gnus-sieve.el
@@ -107,7 +107,7 @@ See the documentation for these variables and functions for details."
107 (find-file gnus-sieve-file) 107 (find-file gnus-sieve-file)
108 (goto-char (point-min)) 108 (goto-char (point-min))
109 (if (re-search-forward (regexp-quote gnus-sieve-region-start) nil t) 109 (if (re-search-forward (regexp-quote gnus-sieve-region-start) nil t)
110 (delete-region (match-end 0) 110 (delete-region (match-beginning 0)
111 (or (re-search-forward (regexp-quote 111 (or (re-search-forward (regexp-quote
112 gnus-sieve-region-end) nil t) 112 gnus-sieve-region-end) nil t)
113 (point))) 113 (point)))
diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el
index 4fc01a8fad3..bea7cb2445e 100644
--- a/lisp/gnus/gnus-sum.el
+++ b/lisp/gnus/gnus-sum.el
@@ -5962,7 +5962,8 @@ Return a list of headers that match SEQUENCE (see
5962 (allp (cond 5962 (allp (cond
5963 ((eq gnus-read-all-available-headers t) 5963 ((eq gnus-read-all-available-headers t)
5964 t) 5964 t)
5965 ((stringp gnus-read-all-available-headers) 5965 ((and (stringp gnus-read-all-available-headers)
5966 group)
5966 (string-match gnus-read-all-available-headers group)) 5967 (string-match gnus-read-all-available-headers group))
5967 (t 5968 (t
5968 nil))) 5969 nil)))
diff --git a/lisp/gnus/gnus-uu.el b/lisp/gnus/gnus-uu.el
index e9756547167..46f810b2fbb 100644
--- a/lisp/gnus/gnus-uu.el
+++ b/lisp/gnus/gnus-uu.el
@@ -839,7 +839,9 @@ When called interactively, prompt for REGEXP."
839 "Date: %s\nFrom: %s\nSubject: %s Digest\n\n" 839 "Date: %s\nFrom: %s\nSubject: %s Digest\n\n"
840 (message-make-date) name name)) 840 (message-make-date) name name))
841 (when (and message-forward-as-mime gnus-uu-digest-buffer) 841 (when (and message-forward-as-mime gnus-uu-digest-buffer)
842 (insert "<#part type=message/rfc822>\nSubject: Topics\n\n")) 842 (insert
843 "<#mml type=message/rfc822>\nSubject: Topics\n\n<#/mml>\n")
844 (forward-line -1))
843 (insert "Topics:\n"))) 845 (insert "Topics:\n")))
844 (when (not (eq in-state 'end)) 846 (when (not (eq in-state 'end))
845 (setq state (list 'middle)))) 847 (setq state (list 'middle))))
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 236ec1bc23f..741b193f779 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -2749,7 +2749,8 @@ prefix FORCE is given."
2749 (message-carefully-insert-headers headers))) 2749 (message-carefully-insert-headers headers)))
2750 2750
2751(defcustom message-header-synonyms 2751(defcustom message-header-synonyms
2752 '((To Cc Bcc)) 2752 '((To Cc Bcc)
2753 (Original-To))
2753 "List of lists of header synonyms. 2754 "List of lists of header synonyms.
2754E.g., if this list contains a member list with elements `Cc' and `To', 2755E.g., if this list contains a member list with elements `Cc' and `To',
2755then `message-carefully-insert-headers' will not insert a `To' header 2756then `message-carefully-insert-headers' will not insert a `To' header
diff --git a/lisp/gnus/mm-decode.el b/lisp/gnus/mm-decode.el
index 60cbb413473..5ee47a8ce26 100644
--- a/lisp/gnus/mm-decode.el
+++ b/lisp/gnus/mm-decode.el
@@ -672,7 +672,14 @@ external if displayed external."
672 (mailcap-parse-mailcaps) 672 (mailcap-parse-mailcaps)
673 (if (mm-handle-displayed-p handle) 673 (if (mm-handle-displayed-p handle)
674 (mm-remove-part handle) 674 (mm-remove-part handle)
675 (let* ((type (mm-handle-media-type handle)) 675 (let* ((ehandle (if (equal (mm-handle-media-type handle)
676 "message/external-body")
677 (progn
678 (unless (mm-handle-cache handle)
679 (mm-extern-cache-contents handle))
680 (mm-handle-cache handle))
681 handle))
682 (type (mm-handle-media-type ehandle))
676 (method (mailcap-mime-info type)) 683 (method (mailcap-mime-info type))
677 (filename (or (mail-content-type-get 684 (filename (or (mail-content-type-get
678 (mm-handle-disposition handle) 'filename) 685 (mm-handle-disposition handle) 'filename)
@@ -680,8 +687,8 @@ external if displayed external."
680 (mm-handle-type handle) 'name) 687 (mm-handle-type handle) 'name)
681 "<file>")) 688 "<file>"))
682 (external mm-enable-external)) 689 (external mm-enable-external))
683 (if (and (mm-inlinable-p handle) 690 (if (and (mm-inlinable-p ehandle)
684 (mm-inlined-p handle)) 691 (mm-inlined-p ehandle))
685 (progn 692 (progn
686 (forward-line 1) 693 (forward-line 1)
687 (mm-display-inline handle) 694 (mm-display-inline handle)
@@ -689,7 +696,7 @@ external if displayed external."
689 (when (or method 696 (when (or method
690 (not no-default)) 697 (not no-default))
691 (if (and (not method) 698 (if (and (not method)
692 (equal "text" (car (split-string type)))) 699 (equal "text" (car (split-string type "/"))))
693 (progn 700 (progn
694 (forward-line 1) 701 (forward-line 1)
695 (mm-insert-inline handle (mm-get-part handle)) 702 (mm-insert-inline handle (mm-get-part handle))
diff --git a/lisp/gnus/mm-extern.el b/lisp/gnus/mm-extern.el
index b736374f016..c574bd6156e 100644
--- a/lisp/gnus/mm-extern.el
+++ b/lisp/gnus/mm-extern.el
@@ -157,25 +157,11 @@ If NO-DISPLAY is nil, display it. Otherwise, do nothing after replacing."
157 (save-excursion 157 (save-excursion
158 (save-restriction 158 (save-restriction
159 (narrow-to-region (point) (point)) 159 (narrow-to-region (point) (point))
160 (let* ((type (regexp-quote 160 (mm-display-part (mm-handle-cache handle))))
161 (mm-handle-media-type (mm-handle-cache handle)))) 161 ;; Move undisplayer added to the cached handle to the parent.
162 ;; Force the part to be displayed (but if there is no 162 (mm-handle-set-undisplayer
163 ;; method to display, a user will be prompted to save). 163 handle (mm-handle-undisplayer (mm-handle-cache handle)))
164 ;; See `gnus-mime-display-single'. 164 (mm-handle-set-undisplayer (mm-handle-cache handle) nil)))
165 (mm-inline-override-types nil)
166 (mm-attachment-override-types
167 (cons type mm-attachment-override-types))
168 (mm-automatic-display (cons type mm-automatic-display))
169 (mm-automatic-external-display
170 (cons type mm-automatic-external-display))
171 ;; Suppress adding of button to the cached part.
172 (gnus-inhibit-mime-unbuttonizing nil))
173 (gnus-display-mime (mm-handle-cache handle)))
174 ;; Move undisplayer added to the cached handle to the parent.
175 (mm-handle-set-undisplayer
176 handle
177 (mm-handle-undisplayer (mm-handle-cache handle)))
178 (mm-handle-set-undisplayer (mm-handle-cache handle) nil)))))
179 165
180(provide 'mm-extern) 166(provide 'mm-extern)
181 167
diff --git a/lisp/gnus/nnslashdot.el b/lisp/gnus/nnslashdot.el
index 38468d7d194..66ce4d54472 100644
--- a/lisp/gnus/nnslashdot.el
+++ b/lisp/gnus/nnslashdot.el
@@ -142,7 +142,7 @@
142 (setq article (if (and article (< start article)) article start)) 142 (setq article (if (and article (< start article)) article start))
143 (goto-char point) 143 (goto-char point)
144 (while (re-search-forward 144 (while (re-search-forward
145 "<a name=\"\\([0-9]+\\)\">\\([^<]+\\)</a>.*\n.*score:\\([^)]+\\))" 145 "<a name=\"\\([0-9]+\\)\">\\([^<]+\\)</a>.*\n.*\n.*score:\\([^)]+\\))"
146 nil t) 146 nil t)
147 (setq cid (match-string 1) 147 (setq cid (match-string 1)
148 subject (match-string 2) 148 subject (match-string 2)
diff --git a/lisp/gnus/rfc2047.el b/lisp/gnus/rfc2047.el
index c89528a30db..aa30d9ba783 100644
--- a/lisp/gnus/rfc2047.el
+++ b/lisp/gnus/rfc2047.el
@@ -851,11 +851,8 @@ ENCODED-WORD)."
851 (let (word charset cs encoding text rest) 851 (let (word charset cs encoding text rest)
852 (while words 852 (while words
853 (setq word (pop words)) 853 (setq word (pop words))
854 (if (and (or (setq cs (rfc2047-charset-to-coding-system 854 (if (and (setq cs (rfc2047-charset-to-coding-system
855 (setq charset (car word)))) 855 (setq charset (car word))))
856 (progn
857 (message "Unknown charset: %s" charset)
858 nil))
859 (condition-case code 856 (condition-case code
860 (cond ((char-equal ?B (nth 1 word)) 857 (cond ((char-equal ?B (nth 1 word))
861 (setq text (base64-decode-string 858 (setq text (base64-decode-string
diff --git a/lisp/hexl.el b/lisp/hexl.el
index bdece19f96b..1e724aa418a 100644
--- a/lisp/hexl.el
+++ b/lisp/hexl.el
@@ -38,7 +38,7 @@
38;; grouping. 38;; grouping.
39;; 39;;
40;; -iso in `hexl-options' will allow iso characters to display in the 40;; -iso in `hexl-options' will allow iso characters to display in the
41;; ASCII region of the screen (if your emacs supports this) instead of 41;; ASCII region of the screen (if your Emacs supports this) instead of
42;; changing them to dots. 42;; changing them to dots.
43 43
44;;; Code: 44;;; Code:
@@ -62,7 +62,7 @@ and \"-de\" when dehexlifying a buffer."
62 :group 'hexl) 62 :group 'hexl)
63 63
64(defcustom hexl-iso "" 64(defcustom hexl-iso ""
65 "If your emacs can handle ISO characters, this should be set to 65 "If your Emacs can handle ISO characters, this should be set to
66\"-iso\" otherwise it should be \"\"." 66\"-iso\" otherwise it should be \"\"."
67 :type 'string 67 :type 'string
68 :group 'hexl) 68 :group 'hexl)
@@ -229,7 +229,7 @@ You can use \\[hexl-find-file] to visit a file in Hexl mode.
229 original-point)) 229 original-point))
230 (or (bolp) (setq original-point (1- original-point)))) 230 (or (bolp) (setq original-point (1- original-point))))
231 (hexlify-buffer) 231 (hexlify-buffer)
232 (set-buffer-modified-p modified)) 232 (restore-buffer-modified-p modified))
233 (make-local-variable 'hexl-max-address) 233 (make-local-variable 'hexl-max-address)
234 (setq hexl-max-address max-address) 234 (setq hexl-max-address max-address)
235 (condition-case nil 235 (condition-case nil
@@ -300,9 +300,16 @@ You can use \\[hexl-find-file] to visit a file in Hexl mode.
300 (lambda (string &optional bound noerror count) 300 (lambda (string &optional bound noerror count)
301 (funcall 301 (funcall
302 (if isearch-forward 're-search-forward 're-search-backward) 302 (if isearch-forward 're-search-forward 're-search-backward)
303 (if (> (length string) 80) 303 (let ((textre
304 (regexp-quote string) 304 (if (> (length string) 80)
305 (mapconcat 'string string "\\(?:\n\\(?:[:a-f0-9]+ \\)+ \\)?")) 305 (regexp-quote string)
306 (mapconcat (lambda (c) (regexp-quote (string c))) string
307 "\\(?:\n\\(?:[:a-f0-9]+ \\)+ \\)?"))))
308 (if (string-match "\\` ?\\([a-f0-9]+ \\)*[a-f0-9]+ ?\\'" string)
309 (concat textre "\\|"
310 (mapconcat 'regexp-quote (split-string string " ")
311 " \\(?: .+\n[a-f0-9]+: \\)?"))
312 textre))
306 bound noerror count)) 313 bound noerror count))
307 (let ((isearch-search-fun-function nil)) 314 (let ((isearch-search-fun-function nil))
308 (isearch-search-fun)))) 315 (isearch-search-fun))))
@@ -318,34 +325,33 @@ You can use \\[hexl-find-file] to visit a file in Hexl mode.
318 "Save a hexl format buffer as binary in visited file if modified." 325 "Save a hexl format buffer as binary in visited file if modified."
319 (interactive) 326 (interactive)
320 (if hexl-in-save-buffer nil 327 (if hexl-in-save-buffer nil
321 (set-buffer-modified-p (if (buffer-modified-p) 328 (restore-buffer-modified-p
322 (save-excursion 329 (if (buffer-modified-p)
323 (let ((buf (generate-new-buffer " hexl")) 330 (let ((buf (generate-new-buffer " hexl"))
324 (name (buffer-name)) 331 (name (buffer-name))
325 (file-name (buffer-file-name)) 332 (start (point-min))
326 (start (point-min)) 333 (end (point-max))
327 (end (point-max)) 334 modified)
328 modified) 335 (with-current-buffer buf
329 (set-buffer buf) 336 (insert-buffer-substring name start end)
330 (insert-buffer-substring name start end) 337 (set-buffer name)
331 (set-buffer name) 338 (dehexlify-buffer)
332 (dehexlify-buffer) 339 ;; Prevent infinite recursion.
333 ;; Prevent infinite recursion. 340 (let ((hexl-in-save-buffer t))
334 (let ((hexl-in-save-buffer t)) 341 (save-buffer))
335 (save-buffer)) 342 (setq modified (buffer-modified-p))
336 (setq modified (buffer-modified-p)) 343 (delete-region (point-min) (point-max))
337 (delete-region (point-min) (point-max)) 344 (insert-buffer-substring buf start end)
338 (insert-buffer-substring buf start end) 345 (kill-buffer buf)
339 (kill-buffer buf) 346 modified))
340 modified)) 347 (message "(No changes need to be saved)")
341 (message "(No changes need to be saved)") 348 nil))
342 nil))
343 ;; Return t to indicate we have saved t 349 ;; Return t to indicate we have saved t
344 t)) 350 t))
345 351
346;;;###autoload 352;;;###autoload
347(defun hexl-find-file (filename) 353(defun hexl-find-file (filename)
348 "Edit file FILENAME in hexl-mode. 354 "Edit file FILENAME in `hexl-mode'.
349Switch to a buffer visiting file FILENAME, creating one in none exists." 355Switch to a buffer visiting file FILENAME, creating one in none exists."
350 (interactive 356 (interactive
351 (list 357 (list
@@ -367,7 +373,7 @@ With arg, don't unhexlify buffer."
367 (original-point (1+ (hexl-current-address)))) 373 (original-point (1+ (hexl-current-address))))
368 (dehexlify-buffer) 374 (dehexlify-buffer)
369 (remove-hook 'write-contents-functions 'hexl-save-buffer t) 375 (remove-hook 'write-contents-functions 'hexl-save-buffer t)
370 (set-buffer-modified-p modified) 376 (restore-buffer-modified-p modified)
371 (goto-char original-point) 377 (goto-char original-point)
372 ;; Maybe adjust point for the removed CR characters. 378 ;; Maybe adjust point for the removed CR characters.
373 (when (eq (coding-system-eol-type buffer-file-coding-system) 1) 379 (when (eq (coding-system-eol-type buffer-file-coding-system) 1)
@@ -403,7 +409,7 @@ Ask the user for confirmation."
403 (original-point (1+ (hexl-current-address)))) 409 (original-point (1+ (hexl-current-address))))
404 (dehexlify-buffer) 410 (dehexlify-buffer)
405 (remove-hook 'write-contents-functions 'hexl-save-buffer t) 411 (remove-hook 'write-contents-functions 'hexl-save-buffer t)
406 (set-buffer-modified-p modified) 412 (restore-buffer-modified-p modified)
407 (goto-char original-point)))) 413 (goto-char original-point))))
408 414
409(defun hexl-current-address (&optional validate) 415(defun hexl-current-address (&optional validate)
@@ -917,14 +923,14 @@ Customize the variable `hexl-follow-ascii' to disable this feature."
917 ))))) 923 )))))
918 924
919(defun hexl-activate-ruler () 925(defun hexl-activate-ruler ()
920 "Activate `ruler-mode'" 926 "Activate `ruler-mode'."
921 (require 'ruler-mode) 927 (require 'ruler-mode)
922 (set (make-local-variable 'ruler-mode-ruler-function) 928 (set (make-local-variable 'ruler-mode-ruler-function)
923 'hexl-mode-ruler) 929 'hexl-mode-ruler)
924 (ruler-mode 1)) 930 (ruler-mode 1))
925 931
926(defun hexl-follow-line () 932(defun hexl-follow-line ()
927 "Activate `hl-line-mode'" 933 "Activate `hl-line-mode'."
928 (require 'frame) 934 (require 'frame)
929 (require 'hl-line) 935 (require 'hl-line)
930 (with-no-warnings 936 (with-no-warnings
@@ -1071,5 +1077,5 @@ This function is assumed to be used as call back function for `hl-line-mode'."
1071 1077
1072(provide 'hexl) 1078(provide 'hexl)
1073 1079
1074;;; arch-tag: d5a7aa8a-9bce-480b-bcff-6c4c7ca5ea4a 1080;; arch-tag: d5a7aa8a-9bce-480b-bcff-6c4c7ca5ea4a
1075;;; hexl.el ends here 1081;;; hexl.el ends here
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index 9b7a7bee77f..c666669d797 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -2531,7 +2531,9 @@ See also `locale-charset-language-names', `locale-language-names',
2531 ;; If a specific EOL conversion was specified in the default 2531 ;; If a specific EOL conversion was specified in the default
2532 ;; buffer-file-coding-system, preserve it in the coding system 2532 ;; buffer-file-coding-system, preserve it in the coding system
2533 ;; we will be using from now on. 2533 ;; we will be using from now on.
2534 (if (memq default-eol-type '(0 1 2 unix dos mac)) 2534 (if (and (memq default-eol-type '(0 1 2 unix dos mac))
2535 coding-system
2536 (coding-system-p coding-system))
2535 (setq coding-system (coding-system-change-eol-conversion 2537 (setq coding-system (coding-system-change-eol-conversion
2536 coding-system default-eol-type))) 2538 coding-system default-eol-type)))
2537 2539
diff --git a/lisp/loadhist.el b/lisp/loadhist.el
index dc0e4bdc3a2..635059f93e5 100644
--- a/lisp/loadhist.el
+++ b/lisp/loadhist.el
@@ -32,6 +32,8 @@
32 32
33;;; Code: 33;;; Code:
34 34
35(eval-when-compile (require 'cl))
36
35(defun feature-symbols (feature) 37(defun feature-symbols (feature)
36 "Return the file and list of definitions associated with FEATURE. 38 "Return the file and list of definitions associated with FEATURE.
37The value is actually the element of `load-history' 39The value is actually the element of `load-history'
@@ -207,23 +209,29 @@ such as redefining an Emacs function."
207 (elp-restore-function elt)))) 209 (elp-restore-function elt))))
208 (dolist (x unload-hook-features-list) 210 (dolist (x unload-hook-features-list)
209 (if (consp x) 211 (if (consp x)
210 (cond 212 (case (car x)
211 ;; Remove any feature names that this file provided. 213 ;; Remove any feature names that this file provided.
212 ((eq (car x) 'provide) 214 (provide
213 (setq features (delq (cdr x) features))) 215 (setq features (delq (cdr x) features)))
214 ((eq (car x) 'defun) 216 (defun
215 (let ((fun (cdr x))) 217 (let ((fun (cdr x)))
216 (when (fboundp fun) 218 (when (fboundp fun)
217 (when (fboundp 'ad-unadvise) 219 (when (fboundp 'ad-unadvise)
218 (ad-unadvise fun)) 220 (ad-unadvise fun))
219 (fmakunbound fun)
220 (let ((aload (get fun 'autoload))) 221 (let ((aload (get fun 'autoload)))
221 (when aload 222 (if aload
222 (fset fun (cons 'autoload aload)))))))) 223 (fset fun (cons 'autoload aload))
224 (fmakunbound fun))))))
225 (require nil)
226 (t (message "Unexpected element %s in load-history" x)))
223 ;; Kill local values as much as possible. 227 ;; Kill local values as much as possible.
224 (dolist (buf (buffer-list)) 228 (dolist (buf (buffer-list))
225 (with-current-buffer buf 229 (with-current-buffer buf
230 (if (and (boundp x) (timerp (symbol-value x)))
231 (cancel-timer (symbol-value x)))
226 (kill-local-variable x))) 232 (kill-local-variable x)))
233 (if (and (boundp x) (timerp (symbol-value x)))
234 (cancel-timer (symbol-value x)))
227 ;; Get rid of the default binding if we can. 235 ;; Get rid of the default binding if we can.
228 (unless (local-variable-if-set-p x) 236 (unless (local-variable-if-set-p x)
229 (makunbound x)))) 237 (makunbound x))))
@@ -232,5 +240,5 @@ such as redefining an Emacs function."
232 240
233(provide 'loadhist) 241(provide 'loadhist)
234 242
235;;; arch-tag: 70bb846a-c413-4f01-bf88-78dba4ac0798 243;; arch-tag: 70bb846a-c413-4f01-bf88-78dba4ac0798
236;;; loadhist.el ends here 244;;; loadhist.el ends here
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el
index 9f527d12f9f..244570170fa 100644
--- a/lisp/progmodes/gdb-ui.el
+++ b/lisp/progmodes/gdb-ui.el
@@ -524,6 +524,7 @@ With arg, use separate IO iff arg is positive."
524 gdb-frame-number nil 524 gdb-frame-number nil
525 gdb-var-list nil 525 gdb-var-list nil
526 gdb-force-update t 526 gdb-force-update t
527 gdb-main-file nil
527 gdb-first-post-prompt t 528 gdb-first-post-prompt t
528 gdb-prompting nil 529 gdb-prompting nil
529 gdb-input-queue nil 530 gdb-input-queue nil
@@ -580,8 +581,7 @@ With arg, use separate IO iff arg is positive."
580 581
581(defun gdb-get-version () 582(defun gdb-get-version ()
582 (goto-char (point-min)) 583 (goto-char (point-min))
583 (if (and (re-search-forward gdb-error-regexp nil t) 584 (if (re-search-forward "Undefined\\( mi\\)* command:" nil t)
584 (string-match ".*(missing implementation)" (match-string 1)))
585 (setq gdb-version "pre-6.4") 585 (setq gdb-version "pre-6.4")
586 (setq gdb-version "6.4+")) 586 (setq gdb-version "6.4+"))
587 (gdb-init-2)) 587 (gdb-init-2))
@@ -2746,7 +2746,11 @@ corresponding to the mode line clicked."
2746 (switch-to-buffer 2746 (switch-to-buffer
2747 (if gud-last-last-frame 2747 (if gud-last-last-frame
2748 (gud-find-file (car gud-last-last-frame)) 2748 (gud-find-file (car gud-last-last-frame))
2749 (gud-find-file gdb-main-file))) 2749 (if gdb-main-file
2750 (gud-find-file gdb-main-file)
2751 ;; Put buffer list in window if we
2752 ;; can't find a source file.
2753 (list-buffers-noselect))))
2750 (when gdb-use-separate-io-buffer 2754 (when gdb-use-separate-io-buffer
2751 (split-window-horizontally) 2755 (split-window-horizontally)
2752 (other-window 1) 2756 (other-window 1)
@@ -3139,19 +3143,18 @@ BUFFER nil or omitted means use the current buffer."
3139 (if (re-search-forward "Stack level \\([0-9]+\\)" nil t) 3143 (if (re-search-forward "Stack level \\([0-9]+\\)" nil t)
3140 (setq gdb-frame-number (match-string 1))) 3144 (setq gdb-frame-number (match-string 1)))
3141 (goto-char (point-min)) 3145 (goto-char (point-min))
3142 (if (re-search-forward 3146 (when (re-search-forward ".*=\\s-+0x0*\\(\\S-*\\)\\s-+in\\s-+\\(\\S-+?\\)\
3143 ".*=\\s-+0x0*\\(\\S-*\\)\\s-+in\\s-+\\(\\S-*?\\) (\\(\\S-*?\\):[0-9]+?);? " 3147\\(?: (\\(\\S-+?\\):[0-9]+?)\\)*;? "
3144 nil t) 3148 nil t)
3145 (progn 3149 (setq gdb-selected-frame (match-string 2))
3146 (setq gdb-selected-frame (match-string 2)) 3150 (if (gdb-get-buffer 'gdb-locals-buffer)
3147 (if (gdb-get-buffer 'gdb-locals-buffer) 3151 (with-current-buffer (gdb-get-buffer 'gdb-locals-buffer)
3148 (with-current-buffer (gdb-get-buffer 'gdb-locals-buffer) 3152 (setq mode-name (concat "Locals:" gdb-selected-frame))))
3149 (setq mode-name (concat "Locals:" gdb-selected-frame)))) 3153 (if (gdb-get-buffer 'gdb-assembler-buffer)
3150 (if (gdb-get-buffer 'gdb-assembler-buffer) 3154 (with-current-buffer (gdb-get-buffer 'gdb-assembler-buffer)
3151 (with-current-buffer (gdb-get-buffer 'gdb-assembler-buffer) 3155 (setq mode-name (concat "Machine:" gdb-selected-frame))))
3152 (setq mode-name (concat "Machine:" gdb-selected-frame)))) 3156 (setq gdb-frame-address (match-string 1))
3153 (setq gdb-frame-address (match-string 1)))) 3157 (if (and (match-string 3) gud-overlay-arrow-position)
3154 (if gud-overlay-arrow-position
3155 (let ((buffer (marker-buffer gud-overlay-arrow-position)) 3158 (let ((buffer (marker-buffer gud-overlay-arrow-position))
3156 (position (marker-position gud-overlay-arrow-position))) 3159 (position (marker-position gud-overlay-arrow-position)))
3157 (when (and buffer (string-equal (buffer-name buffer) (match-string 3))) 3160 (when (and buffer (string-equal (buffer-name buffer) (match-string 3)))
@@ -3160,9 +3163,9 @@ BUFFER nil or omitted means use the current buffer."
3160 (if (string-equal gdb-frame-number "0") 3163 (if (string-equal gdb-frame-number "0")
3161 nil 3164 nil
3162 '((overlay-arrow . hollow-right-triangle)))) 3165 '((overlay-arrow . hollow-right-triangle))))
3163 (set-marker gud-overlay-arrow-position position))))) 3166 (set-marker gud-overlay-arrow-position position))))))
3164 (goto-char (point-min)) 3167 (goto-char (point-min))
3165 (if (re-search-forward " source language \\(\\S-*\\)\." nil t) 3168 (if (re-search-forward " source language \\(\\S-+\\)\." nil t)
3166 (setq gdb-current-language (match-string 1))) 3169 (setq gdb-current-language (match-string 1)))
3167 (gdb-invalidate-assembler)) 3170 (gdb-invalidate-assembler))
3168 3171
@@ -3281,11 +3284,12 @@ in_scope=\"\\(.*?\\)\".*?}")
3281 gdb-pending-triggers)) 3284 gdb-pending-triggers))
3282 (goto-char (point-min)) 3285 (goto-char (point-min))
3283 (if (re-search-forward gdb-error-regexp nil t) 3286 (if (re-search-forward gdb-error-regexp nil t)
3284 (with-current-buffer (gdb-get-buffer 'gdb-registers-buffer) 3287 (let ((err (match-string 1)))
3285 (let ((buffer-read-only nil)) 3288 (with-current-buffer (gdb-get-buffer 'gdb-registers-buffer)
3286 (erase-buffer) 3289 (let ((buffer-read-only nil))
3287 (insert (match-string 1)) 3290 (erase-buffer)
3288 (goto-char (point-min)))) 3291 (insert err)
3292 (goto-char (point-min)))))
3289 (let ((register-list (reverse gdb-register-names)) 3293 (let ((register-list (reverse gdb-register-names))
3290 (register nil) (register-string nil) (register-values nil)) 3294 (register nil) (register-string nil) (register-values nil))
3291 (goto-char (point-min)) 3295 (goto-char (point-min))
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el
index b0e31bafc28..e92bb1053a6 100644
--- a/lisp/progmodes/perl-mode.el
+++ b/lisp/progmodes/perl-mode.el
@@ -721,7 +721,10 @@ changed by, or (parse-state) if line starts in a quoted string."
721 (save-excursion 721 (save-excursion
722 (forward-char 1) 722 (forward-char 1)
723 (forward-sexp -1) 723 (forward-sexp -1)
724 (perl-indent-new-calculate 'virtual nil parse-start))) 724 (perl-indent-new-calculate
725 ;; Recalculate the parsing-start, since we may have jumped
726 ;; dangerously close (typically in the case of nested functions).
727 'virtual nil (save-excursion (perl-beginning-of-function)))))
725 (and (and (= (following-char) ?{) 728 (and (and (= (following-char) ?{)
726 (save-excursion (forward-char) (perl-hanging-paren-p))) 729 (save-excursion (forward-char) (perl-hanging-paren-p)))
727 (+ (or default (perl-calculate-indent parse-start)) 730 (+ (or default (perl-calculate-indent parse-start))
diff --git a/lisp/startup.el b/lisp/startup.el
index a79a0e7516e..5a35249378b 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -1536,9 +1536,15 @@ Type \\[describe-distribution] for information on getting the latest version."))
1536 ;; Display the input that we set up in the buffer. 1536 ;; Display the input that we set up in the buffer.
1537 (set-buffer-modified-p nil) 1537 (set-buffer-modified-p nil)
1538 (goto-char (point-min)) 1538 (goto-char (point-min))
1539 (save-window-excursion 1539 (if (or (window-minibuffer-p)
1540 (switch-to-buffer (current-buffer)) 1540 (window-dedicated-p (selected-window)))
1541 (sit-for 120))) 1541 ;; There's no point is using pop-to-buffer since creating
1542 ;; a new frame will generate enough events that the
1543 ;; subsequent `sit-for' will immediately return anyway.
1544 nil ;; (pop-to-buffer (current-buffer))
1545 (save-window-excursion
1546 (switch-to-buffer (current-buffer))
1547 (sit-for 120))))
1542 ;; Unwind ... ensure splash buffer is killed 1548 ;; Unwind ... ensure splash buffer is killed
1543 (kill-buffer "GNU Emacs")))) 1549 (kill-buffer "GNU Emacs"))))
1544 1550
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el
index 5d1efeb6902..2ef9c60ce7c 100644
--- a/lisp/textmodes/org.el
+++ b/lisp/textmodes/org.el
@@ -5,7 +5,7 @@
5;; Author: Carsten Dominik <dominik at science dot uva dot nl> 5;; Author: Carsten Dominik <dominik at science dot uva dot nl>
6;; Keywords: outlines, hypermedia, calendar, wp 6;; Keywords: outlines, hypermedia, calendar, wp
7;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ 7;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/
8;; Version: 4.10 8;; Version: 4.21
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
@@ -81,6 +81,30 @@
81;; 81;;
82;; Changes since version 4.00: 82;; Changes since version 4.00:
83;; --------------------------- 83;; ---------------------------
84;; Version 4.21
85;; - Bug fixes.
86;;
87;; Version 4.20
88;; - Links use now the [[link][description]] format by default.
89;; When inserting links, the user is prompted for a description.
90;; - If a link has a description, only the description is displayed
91;; the link part is hidden. Use C-c C-l to edit the link part.
92;; - TAGS are now bold, but in the same color as the headline.
93;; - The width of a table column can be limited by using a field "<N>".
94;; - New structure for the customization tree.
95;; - Bug fixes.
96;;
97;; Version 4.13
98;; - The list of agenda files can be maintainted in an external file.
99;; - Bug fixes.
100;;
101;; Version 4.12
102;; - Templates for remember buffer. Note that the remember setup changes.
103;; To set up templates, see `org-remember-templates'.
104;; - The time in new time stamps can be rounded, see new option
105;; `org-time-stamp-rounding-minutes'.
106;; - Bug fixes (there are *always* more bugs).
107;;
84;; Version 4.10 108;; Version 4.10
85;; - Bug fixes. 109;; - Bug fixes.
86;; 110;;
@@ -98,7 +122,7 @@
98;; - Leading stars in headlines can be hidden, so make the outline look 122;; - Leading stars in headlines can be hidden, so make the outline look
99;; cleaner. 123;; cleaner.
100;; - Mouse-1 can be used to follow links. 124;; - Mouse-1 can be used to follow links.
101;; 125;;
102;; Version 4.06 126;; Version 4.06
103;; - HTML exporter treats targeted internal links. 127;; - HTML exporter treats targeted internal links.
104;; - Bug fixes. 128;; - Bug fixes.
@@ -137,30 +161,35 @@
137;; 161;;
138;;; Code: 162;;; Code:
139 163
140(eval-when-compile (require 'cl) (require 'calendar)) 164(eval-when-compile
165 (require 'cl)
166 (require 'calendar))
141(require 'outline) 167(require 'outline)
142(require 'time-date) 168(require 'time-date)
143(require 'easymenu) 169(require 'easymenu)
144 170
145(defvar calc-embedded-close-formula) 171(defvar calc-embedded-close-formula) ; defined by the calc package
146(defvar calc-embedded-open-formula) 172(defvar calc-embedded-open-formula) ; defined by the calc package
147(defvar font-lock-unfontify-region-function) 173(defvar font-lock-unfontify-region-function) ; defined by font-lock.el
148 174
149;;; Customization variables 175;;; Customization variables
150 176
151(defvar org-version "4.10" 177(defvar org-version "4.21"
152 "The version number of the file org.el.") 178 "The version number of the file org.el.")
153(defun org-version () 179(defun org-version ()
154 (interactive) 180 (interactive)
155 (message "Org-mode version %s" org-version)) 181 (message "Org-mode version %s" org-version))
156 182
157;; The following two constants are for compatibility with different Emacs 183;; The following constant is for compatibility with different versions
158;; versions (Emacs versus XEmacs) and with different versions of outline.el. 184;; of outline.el.
159;; The compatibility code in org.el is based on these two constants.
160(defconst org-xemacs-p (featurep 'xemacs)
161 "Are we running XEmacs?")
162(defconst org-noutline-p (featurep 'noutline) 185(defconst org-noutline-p (featurep 'noutline)
163 "Are we using the new outline mode?") 186 "Are we using the new outline mode?")
187(defconst org-xemacs-p (featurep 'xemacs))
188(defconst org-format-transports-properties-p
189 (let ((x "a"))
190 (add-text-properties 0 1 '(test t) x)
191 (get-text-property 0 'test (format "%s" x)))
192 "Does format transport text properties?")
164 193
165(defgroup org nil 194(defgroup org nil
166 "Outline-based notes management and organizer." 195 "Outline-based notes management and organizer."
@@ -174,44 +203,6 @@
174 :tag "Org Startup" 203 :tag "Org Startup"
175 :group 'org) 204 :group 'org)
176 205
177(defcustom org-CUA-compatible nil
178 "Non-nil means use alternative key bindings for S-<cursor movement>.
179Org-mode used S-<cursor movement> for changing timestamps and priorities.
180S-<cursor movement> is also used for example by `CUA-mode' to select text.
181If you want to use Org-mode together with `CUA-mode', Org-mode needs to use
182alternative bindings. Setting this variable to t will replace the following
183keys both in Org-mode and in the Org-agenda buffer.
184
185S-RET -> C-S-RET
186S-up -> M-p
187S-down -> M-n
188S-left -> M--
189S-right -> M-+
190
191If you do not like the alternative keys, take a look at the variable
192`org-disputed-keys'.
193
194This option is only relevant at load-time of Org-mode. Changing it requires
195a restart of Emacs to become effective."
196 :group 'org-startup
197 :type 'boolean)
198
199(defvar org-disputed-keys
200 '((S-up [(shift up)] [(meta ?p)])
201 (S-down [(shift down)] [(meta ?n)])
202 (S-left [(shift left)] [(meta ?-)])
203 (S-right [(shift right)] [(meta ?+)])
204 (S-return [(shift return)] [(control shift return)]))
205 "Keys for which Org-mode and other modes compete.
206This is an alist, cars are symbols for lookup, 1st element is the default key,
207second element will be used when `org-CUA-compatible' is t.")
208
209(defun org-key (key)
210 "Select a key according to `org-CUA-compatible'."
211 (nth (if org-CUA-compatible 2 1)
212 (or (assq key org-disputed-keys)
213 (error "Invalid Key %s in `org-key'" key))))
214
215(defcustom org-startup-folded t 206(defcustom org-startup-folded t
216 "Non-nil means, entering Org-mode will switch to OVERVIEW. 207 "Non-nil means, entering Org-mode will switch to OVERVIEW.
217This can also be configured on a per-file basis by adding one of 208This can also be configured on a per-file basis by adding one of
@@ -233,6 +224,13 @@ uninteresting. Also tables look terrible when wrapped."
233 :group 'org-startup 224 :group 'org-startup
234 :type 'boolean) 225 :type 'boolean)
235 226
227(defcustom org-startup-align-all-tables nil
228 "Non-nil means, align all tables when visiting a file.
229This is useful when the column width in tables is forced with <N> cookies
230in table fields. Such tables will look correct only after the first re-align."
231 :group 'org-startup
232 :type 'boolean)
233
236(defcustom org-startup-with-deadline-check nil 234(defcustom org-startup-with-deadline-check nil
237 "Non-nil means, entering Org-mode will run the deadline check. 235 "Non-nil means, entering Org-mode will run the deadline check.
238This means, if you start editing an org file, you will get an 236This means, if you start editing an org file, you will get an
@@ -255,71 +253,61 @@ has been set."
255 :group 'org-startup 253 :group 'org-startup
256 :type 'boolean) 254 :type 'boolean)
257 255
258(defgroup org-keywords nil 256(defcustom org-CUA-compatible nil
259 "Options concerning TODO items in Org-mode." 257 "Non-nil means use alternative key bindings for S-<cursor movement>.
260 :tag "Org Keywords" 258Org-mode used S-<cursor movement> for changing timestamps and priorities.
261 :group 'org) 259S-<cursor movement> is also used for example by `CUA-mode' to select text.
260If you want to use Org-mode together with `CUA-mode', Org-mode needs to use
261alternative bindings. Setting this variable to t will replace the following
262keys both in Org-mode and in the Org-agenda buffer.
262 263
263(defcustom org-todo-keywords '("TODO" "DONE") 264S-RET -> C-S-RET
264 "List of TODO entry keywords. 265S-up -> M-p
265\\<org-mode-map>By default, this is '(\"TODO\" \"DONE\"). The last entry in the list is 266S-down -> M-n
266considered to mean that the entry is \"done\". All the other mean that 267S-left -> M--
267action is required, and will make the entry show up in todo lists, diaries 268S-right -> M-+
268etc.
269The command \\[org-todo] cycles an entry through these states, and an
270additional state where no keyword is present. For details about this
271cycling, see also the variable `org-todo-interpretation'
272Changes become only effective after restarting Emacs."
273 :group 'org-keywords
274 :type '(repeat (string :tag "Keyword")))
275 269
276(defcustom org-todo-interpretation 'sequence 270If you do not like the alternative keys, take a look at the variable
277 "Controls how TODO keywords are interpreted. 271`org-disputed-keys'.
278\\<org-mode-map>Possible values are `sequence' and `type'.
279This variable is only relevant if `org-todo-keywords' contains more than two
280states. There are two ways how these keywords can be used:
281
282- As a sequence in the process of working on a TODO item, for example
283 (setq org-todo-keywords '(\"TODO\" \"STARTED\" \"VERIFY\" \"DONE\")
284 org-todo-interpretation 'sequence)
285
286- As different types of TODO items, for example
287 (setq org-todo-keywords '(\"URGENT\" \"RELAXED\" \"REMIND\" \"FOR_TOM\" \"DONE\")
288 org-todo-interpretation 'type)
289
290When the states are interpreted as a sequence, \\[org-todo] always cycles
291to the next state, in order to walk through all different states. So with
292\\[org-todo], you turn an empty entry into the state TODO. When you started
293working on the item, you use \\[org-todo] again to switch it to \"STARTED\",
294later to VERIFY and finally to DONE.
295
296When the states are interpreted as types, \\[org-todo] still cycles through
297when it is called several times in direct succession, in order to initially
298select the type. However, if not called immediately after a previous
299\\[org-todo], it switches from each type directly to DONE. So with the
300above example, you could use `\\[org-todo] \\[org-todo]' to label an entry
301RELAXED. If you later return to this entry and press \\[org-todo] again,
302RELAXED will not be changed REMIND, but directly to DONE.
303
304You can create a large number of types. To initially select a
305type, it is then best to use \\[universal-argument] \\[org-todo] in order to specify the
306type with completion. Of course, you can also type the keyword
307directly into the buffer. M-TAB completes TODO keywords at the
308beginning of a headline."
309 :group 'org-keywords
310 :type '(choice (const sequence)
311 (const type)))
312 272
313(defcustom org-default-priority ?B 273This option is only relevant at load-time of Org-mode. Changing it requires
314 "The default priority of TODO items. 274a restart of Emacs to become effective."
315This is the priority an item get if no explicit priority is given." 275 :group 'org-startup
316 :group 'org-keywords 276 :type 'boolean)
317 :type 'character)
318 277
319(defcustom org-lowest-priority ?C 278(defvar org-disputed-keys
320 "The lowest priority of TODO items. A character like ?A, ?B etc." 279 '((S-up [(shift up)] [(meta ?p)])
321 :group 'org-keywords 280 (S-down [(shift down)] [(meta ?n)])
322 :type 'character) 281 (S-left [(shift left)] [(meta ?-)])
282 (S-right [(shift right)] [(meta ?+)])
283 (S-return [(shift return)] [(control shift return)]))
284 "Keys for which Org-mode and other modes compete.
285This is an alist, cars are symbols for lookup, 1st element is the default key,
286second element will be used when `org-CUA-compatible' is t.")
287
288(defun org-key (key)
289 "Select a key according to `org-CUA-compatible'."
290 (nth (if org-CUA-compatible 2 1)
291 (or (assq key org-disputed-keys)
292 (error "Invalid Key %s in `org-key'" key))))
293
294(defcustom org-ellipsis nil
295 "The ellipsis to use in the Org-mode outline.
296When nil, just use the standard three dots. When a string, use that instead,
297and just in Org-mode (which will then use its own display table).
298Changing this requires executing `M-x org-mode' in a buffer to become
299effective."
300 :group 'org-startup
301 :type '(choice (const :tag "Default" nil)
302 (string :tag "String" :value "...#")))
303
304(defvar org-display-table nil
305 "The display table for org-mode, in case `org-ellipsis' is non-nil.")
306
307(defgroup org-keywords nil
308 "Keywords in Org-mode."
309 :tag "Org Keywords"
310 :group 'org)
323 311
324(defcustom org-deadline-string "DEADLINE:" 312(defcustom org-deadline-string "DEADLINE:"
325 "String to mark deadline entries. 313 "String to mark deadline entries.
@@ -361,405 +349,22 @@ An entry can be toggled between QUOTE and normal with
361 :group 'org-keywords 349 :group 'org-keywords
362 :type 'string) 350 :type 'string)
363 351
364(defcustom org-after-todo-state-change-hook nil
365 "Hook which is run after the state of a TODO item was changed.
366The new state (a string with a TODO keyword, or nil) is available in the
367Lisp variable `state'."
368 :group 'org-keywords
369 :type 'hook)
370
371;; Variables for pre-computed regular expressions, all buffer local
372(defvar org-todo-kwd-priority-p nil
373 "Do TODO items have priorities?")
374(make-variable-buffer-local 'org-todo-kwd-priority-p)
375(defvar org-todo-kwd-max-priority nil
376 "Maximum priority of TODO items.")
377(make-variable-buffer-local 'org-todo-kwd-max-priority)
378(defvar org-ds-keyword-length 12
379 "Maximum length of the Deadline and SCHEDULED keywords.")
380(make-variable-buffer-local 'org-ds-keyword-length)
381(defvar org-done-string nil
382 "The last string in `org-todo-keywords', indicating an item is DONE.")
383(make-variable-buffer-local 'org-done-string)
384(defvar org-todo-regexp nil
385 "Matches any of the TODO state keywords.")
386(make-variable-buffer-local 'org-todo-regexp)
387(defvar org-not-done-regexp nil
388 "Matches any of the TODO state keywords except the last one.")
389(make-variable-buffer-local 'org-not-done-regexp)
390(defvar org-todo-line-regexp nil
391 "Matches a headline and puts TODO state into group 2 if present.")
392(make-variable-buffer-local 'org-todo-line-regexp)
393(defvar org-nl-done-regexp nil
394 "Matches newline followed by a headline with the DONE keyword.")
395(make-variable-buffer-local 'org-nl-done-regexp)
396(defvar org-looking-at-done-regexp nil
397 "Matches the DONE keyword a point.")
398(make-variable-buffer-local 'org-looking-at-done-regexp)
399(defvar org-deadline-regexp nil
400 "Matches the DEADLINE keyword.")
401(make-variable-buffer-local 'org-deadline-regexp)
402(defvar org-deadline-time-regexp nil
403 "Matches the DEADLINE keyword together with a time stamp.")
404(make-variable-buffer-local 'org-deadline-time-regexp)
405(defvar org-deadline-line-regexp nil
406 "Matches the DEADLINE keyword and the rest of the line.")
407(make-variable-buffer-local 'org-deadline-line-regexp)
408(defvar org-scheduled-regexp nil
409 "Matches the SCHEDULED keyword.")
410(make-variable-buffer-local 'org-scheduled-regexp)
411(defvar org-scheduled-time-regexp nil
412 "Matches the SCHEDULED keyword together with a time stamp.")
413(make-variable-buffer-local 'org-scheduled-time-regexp)
414
415(defvar org-category nil
416 "Variable used by org files to set a category for agenda display.
417Such files should use a file variable to set it, for example
418
419 -*- mode: org; org-category: \"ELisp\"
420
421or contain a special line
422
423#+CATEGORY: ELisp
424
425If the file does not specify a category, then file's base name
426is used instead.")
427(make-variable-buffer-local 'org-category)
428
429(defgroup org-time nil
430 "Options concerning time stamps and deadlines in Org-mode."
431 :tag "Org Time"
432 :group 'org)
433
434(defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>")
435 "Formats for `format-time-string' which are used for time stamps.
436It is not recommended to change this constant.")
437
438
439(defcustom org-deadline-warning-days 30
440 "No. of days before expiration during which a deadline becomes active.
441This variable governs the display in the org file."
442 :group 'org-time
443 :type 'number)
444
445(defcustom org-popup-calendar-for-date-prompt t
446 "Non-nil means, pop up a calendar when prompting for a date.
447In the calendar, the date can be selected with mouse-1. However, the
448minibuffer will also be active, and you can simply enter the date as well.
449When nil, only the minibuffer will be available."
450 :group 'org-time
451 :type 'boolean)
452
453(defcustom org-calendar-follow-timestamp-change t
454 "Non-nil means, make the calendar window follow timestamp changes.
455When a timestamp is modified and the calendar window is visible, it will be
456moved to the new date."
457 :group 'org-time
458 :type 'boolean)
459
460(defcustom org-log-done nil
461 "When set, insert a (non-active) time stamp when TODO entry is marked DONE.
462When the state of an entry is changed from nothing to TODO, remove a previous
463closing date."
464 :group 'org-time
465 :type 'boolean)
466
467(defgroup org-agenda nil
468 "Options concerning agenda display Org-mode."
469 :tag "Org Agenda"
470 :group 'org)
471
472(defcustom org-agenda-files nil
473 "A list of org files for agenda/diary display.
474Entries are added to this list with \\[org-agenda-file-to-front] and removed with
475\\[org-remove-file]. You can also use customize to edit the list."
476 :group 'org-agenda
477 :type '(repeat file))
478
479(defcustom org-agenda-custom-commands '(("w" todo "WAITING"))
480 "Custom commands for the agenda.
481These commands will be offered on the splash screen displayed by the
482agenda dispatcher \\[org-agenda]. Each entry is a list of 3 items:
483
484key The key (a single char as a string) to be associated with the command.
485type The command type, any of the following symbols:
486 todo Entries with a specific TODO keyword, in all agenda files.
487 tags Tags match in all agenda files.
488 todo-tree Sparse tree of specific TODO keyword in *current* file.
489 tags-tree Sparse tree with all tags matches in *current* file.
490 occur-tree Occur sparse tree for current file.
491match What to search for:
492 - a single keyword for TODO keyword searches
493 - a tags match expression for tags searches
494 - a regular expression for occur searches"
495 :group 'org-agenda
496 :type '(repeat
497 (list (string :tag "Key")
498 (choice :tag "Type"
499 (const :tag "Tags search in all agenda files" tags)
500 (const :tag "TODO keyword search in all agenda files" todo)
501 (const :tag "Tags sparse tree in current buffer" tags-tree)
502 (const :tag "TODO keyword tree in current buffer" todo-tree)
503 (const :tag "Occur tree in current buffer" occur-tree))
504 (string :tag "Match"))))
505
506(defcustom org-select-timeline-window t
507 "Non-nil means, after creating a timeline, move cursor into Timeline window.
508When nil, cursor will remain in the current window."
509 :group 'org-agenda
510 :type 'boolean)
511
512(defcustom org-select-agenda-window t
513 "Non-nil means, after creating an agenda, move cursor into Agenda window.
514When nil, cursor will remain in the current window."
515 :group 'org-agenda
516 :type 'boolean)
517
518(defcustom org-fit-agenda-window t
519 "Non-nil means, change window size of agenda to fit content."
520 :group 'org-agenda
521 :type 'boolean)
522
523(defcustom org-agenda-show-all-dates t
524 "Non-nil means, `org-agenda' shows every day in the selected range.
525When nil, only the days which actually have entries are shown."
526 :group 'org-agenda
527 :type 'boolean)
528
529;; FIXME: First day of month works only for current month because it would
530;; require a variable ndays treatment.
531(defcustom org-agenda-start-on-weekday 1
532 "Non-nil means, start the overview always on the specified weekday.
5330 Denotes Sunday, 1 denotes Monday etc.
534When nil, always start on the current day."
535 :group 'org-agenda
536 :type '(choice (const :tag "Today" nil)
537 (const :tag "First day of month" t)
538 (number :tag "Weekday No.")))
539
540(defcustom org-agenda-ndays 7
541 "Number of days to include in overview display."
542 :group 'org-agenda
543 :type 'number)
544
545(defcustom org-agenda-include-all-todo t
546 "Non-nil means, the agenda will always contain all TODO entries.
547When nil, date-less entries will only be shown if `org-agenda' is called
548with a prefix argument.
549When non-nil, the TODO entries will be listed at the top of the agenda, before
550the entries for specific days."
551 :group 'org-agenda
552 :type 'boolean)
553
554(defcustom org-agenda-include-diary nil
555 "If non-nil, include in the agenda entries from the Emacs Calendar's diary."
556 :group 'org-agenda
557 :type 'boolean)
558
559(defcustom org-calendar-to-agenda-key [?c]
560 "The key to be installed in `calendar-mode-map' for switching to the agenda.
561The command `org-calendar-goto-agenda' will be bound to this key. The
562default is the character `c' because then `c' can be used to switch back and
563forth between agenda and calendar."
564 :group 'org-agenda
565 :type 'sexp)
566
567(defcustom org-agenda-sorting-strategy '(time-up category-keep priority-down)
568 "Sorting structure for the agenda items of a single day.
569This is a list of symbols which will be used in sequence to determine
570if an entry should be listed before another entry. The following
571symbols are recognized:
572
573time-up Put entries with time-of-day indications first, early first
574time-down Put entries with time-of-day indications first, late first
575category-keep Keep the default order of categories, corresponding to the
576 sequence in `org-agenda-files'.
577category-up Sort alphabetically by category, A-Z.
578category-down Sort alphabetically by category, Z-A.
579priority-up Sort numerically by priority, high priority last.
580priority-down Sort numerically by priority, high priority first.
581
582The different possibilities will be tried in sequence, and testing stops
583if one comparison returns a \"not-equal\". For example, the default
584 '(time-up category-keep priority-down)
585means: Pull out all entries having a specified time of day and sort them,
586in order to make a time schedule for the current day the first thing in the
587agenda listing for the day. Of the entries without a time indication, keep
588the grouped in categories, don't sort the categories, but keep them in
589the sequence given in `org-agenda-files'. Within each category sort by
590priority.
591
592Leaving out `category-keep' would mean that items will be sorted across
593categories by priority."
594 :group 'org-agenda
595 :type '(repeat
596 (choice
597 (const time-up)
598 (const time-down)
599 (const category-keep)
600 (const category-up)
601 (const category-down)
602 (const priority-up)
603 (const priority-down))))
604
605(defcustom org-agenda-prefix-format " %-12:c%?-12t% s"
606 "Format specification for the prefix of items in the agenda buffer.
607This format works similar to a printf format, with the following meaning:
608
609 %c the category of the item, \"Diary\" for entries from the diary, or
610 as given by the CATEGORY keyword or derived from the file name.
611 %T the first tag of the item.
612 %t the time-of-day specification if one applies to the entry, in the
613 format HH:MM
614 %s Scheduling/Deadline information, a short string
615
616All specifiers work basically like the standard `%s' of printf, but may
617contain two additional characters: A question mark just after the `%' and
618a whitespace/punctuation character just before the final letter.
619
620If the first character after `%' is a question mark, the entire field
621will only be included if the corresponding value applies to the
622current entry. This is useful for fields which should have fixed
623width when present, but zero width when absent. For example,
624\"%?-12t\" will result in a 12 character time field if a time of the
625day is specified, but will completely disappear in entries which do
626not contain a time.
627
628If there is punctuation or whitespace character just before the final
629format letter, this character will be appended to the field value if
630the value is not empty. For example, the format \"%-12:c\" leads to
631\"Diary: \" if the category is \"Diary\". If the category were be
632empty, no additional colon would be interted.
633
634The default value of this option is \" %-12:c%?-12t% s\", meaning:
635- Indent the line with two space characters
636- Give the category in a 12 chars wide field, padded with whitespace on
637 the right (because of `-'). Append a colon if there is a category
638 (because of `:').
639- If there is a time-of-day, put it into a 12 chars wide field. If no
640 time, don't put in an empty field, just skip it (because of '?').
641- Finally, put the scheduling information and append a whitespace.
642
643As another example, if you don't want the time-of-day of entries in
644the prefix, you could use:
645
646 (setq org-agenda-prefix-format \" %-11:c% s\")
647
648See also the variables `org-agenda-remove-times-when-in-prefix' and
649`org-agenda-remove-tags-when-in-prefix'."
650 :type 'string
651 :group 'org-agenda)
652
653(defcustom org-timeline-prefix-format " % s"
654 "Like `org-agenda-prefix-format', but for the timeline of a single file."
655 :type 'string
656 :group 'org-agenda)
657
658(defvar org-prefix-format-compiled nil
659 "The compiled version of the most recently used prefix format.
660Depending on which command was used last, this may be the compiled version
661of `org-agenda-prefix-format' or `org-timeline-prefix-format'.")
662
663(defcustom org-agenda-use-time-grid t
664 "Non-nil means, show a time grid in the agenda schedule.
665A time grid is a set of lines for specific times (like every two hours between
6668:00 and 20:00). The items scheduled for a day at specific times are
667sorted in between these lines.
668For details about when the grid will be shown, and what it will look like, see
669the variable `org-agenda-time-grid'."
670 :group 'org-agenda
671 :type 'boolean)
672
673(defcustom org-agenda-time-grid
674 '((daily today require-timed)
675 "----------------"
676 (800 1000 1200 1400 1600 1800 2000))
677
678 "The settings for time grid for agenda display.
679This is a list of three items. The first item is again a list. It contains
680symbols specifying conditions when the grid should be displayed:
681
682 daily if the agenda shows a single day
683 weekly if the agenda shows an entire week
684 today show grid on current date, independent of daily/weekly display
685 require-timed show grid only if at least on item has a time specification
686
687The second item is a string which will be places behing the grid time.
688
689The third item is a list of integers, indicating the times that should have
690a grid line."
691 :group 'org-agenda
692 :type
693 '(list
694 (set :greedy t :tag "Grid Display Options"
695 (const :tag "Show grid in single day agenda display" daily)
696 (const :tag "Show grid in weekly agenda display" weekly)
697 (const :tag "Always show grid for today" today)
698 (const :tag "Show grid only if any timed entries are present"
699 require-timed)
700 (const :tag "Skip grid times already present in an entry"
701 remove-match))
702 (string :tag "Grid String")
703 (repeat :tag "Grid Times" (integer :tag "Time"))))
704
705(defcustom org-agenda-remove-times-when-in-prefix t
706 "Non-nil means, remove duplicate time specifications in agenda items.
707When the format `org-agenda-prefix-format' contains a `%t' specifier, a
708time-of-day specification in a headline or diary entry is extracted and
709placed into the prefix. If this option is non-nil, the original specification
710\(a timestamp or -range, or just a plain time(range) specification like
71111:30-4pm) will be removed for agenda display. This makes the agenda less
712cluttered.
713The option can be t or nil. It may also be the symbol `beg', indicating
714that the time should only be removed what it is located at the beginning of
715the headline/diary entry."
716 :group 'org-agenda
717 :type '(choice
718 (const :tag "Always" t)
719 (const :tag "Never" nil)
720 (const :tag "When at beginning of entry" beg)))
721
722(defcustom org-sort-agenda-notime-is-late t
723 "Non-nil means, items without time are considered late.
724This is only relevant for sorting. When t, items which have no explicit
725time like 15:30 will be considered as 24:01, i.e. later than any items which
726do have a time. When nil, the default time is before 0:00. You can use this
727option to decide if the schedule for today should come before or after timeless
728agenda entries."
729 :group 'org-agenda
730 :type 'boolean)
731
732(defcustom org-agenda-remove-tags-when-in-prefix nil
733 "Non-nil means, the tags from copy of headline in agenda.
734When this is the symbol `prefix', only remove tags when
735`org-agenda-prefix-format' contains a `%T' specifier."
736 :group 'org-agenda
737 :type '(choice
738 (const :tag "Always" t)
739 (const :tag "Never" nil)
740 (const :tag "When prefix format contains %T" prefix)))
741
742(defgroup org-structure nil 352(defgroup org-structure nil
743 "Options concerning structure editing in Org-mode." 353 "Options concerning the general structure of Org-mode files."
744 :tag "Org Structure" 354 :tag "Org Structure"
745 :group 'org) 355 :group 'org)
746 356
747(defcustom org-cycle-include-plain-lists nil 357(defgroup org-cycle nil
748 "Non-nil means, include plain lists into visibility cycling. 358 "Options concerning visibility cycling in Org-mode."
749This means that during cycling, plain list items will *temporarily* be 359 :tag "Org Cycle"
750interpreted as outline headlines with a level given by 1000+i where i is the 360 :group 'org-structure)
751indentation of the bullet. In all other operations, plain list items are
752not seen as headlines. For example, you cannot assign a TODO keyword to
753such an item."
754 :group 'org-structure
755 :type 'boolean)
756 361
757(defcustom org-cycle-emulate-tab t 362(defcustom org-cycle-emulate-tab t
758 "Where should `org-cycle' emulate TAB. 363 "Where should `org-cycle' emulate TAB.
759nil Never 364nil Never
760white Only in completely white lines 365white Only in completely white lines
761t Everywhere except in headlines" 366t Everywhere except in headlines"
762 :group 'org-structure 367 :group 'org-cycle
763 :type '(choice (const :tag "Never" nil) 368 :type '(choice (const :tag "Never" nil)
764 (const :tag "Only in completely white lines" white) 369 (const :tag "Only in completely white lines" white)
765 (const :tag "Everywhere except in headlines" t) 370 (const :tag "Everywhere except in headlines" t)
@@ -772,20 +377,58 @@ the new state that was set by the most recent `org-cycle' command. The
772argument is a symbol. After a global state change, it can have the values 377argument is a symbol. After a global state change, it can have the values
773`overview', `content', or `all'. After a local state change, it can have 378`overview', `content', or `all'. After a local state change, it can have
774the values `folded', `children', or `subtree'." 379the values `folded', `children', or `subtree'."
775 :group 'org-structure 380 :group 'org-cycle
776 :type 'hook) 381 :type 'hook)
777 382
383(defgroup org-edit-structure nil
384 "Options concerning structure editing in Org-mode."
385 :tag "Org Edit Structure"
386 :group 'org-structure)
387
388(defcustom org-odd-levels-only nil
389 "Non-nil means, skip even levels and only use odd levels for the outline.
390This has the effect that two stars are being added/taken away in
391promotion/demotion commands. It also influences how levels are
392handled by the exporters.
393Changing it requires restart of `font-lock-mode' to become effective
394for fontification also in regions already fontified."
395 :group 'org-edit-structure
396 :group 'org-font-lock
397 :type 'boolean)
398
399(defcustom org-adapt-indentation t
400 "Non-nil means, adapt indentation when promoting and demoting.
401When this is set and the *entire* text in an entry is indented, the
402indentation is increased by one space in a demotion command, and
403decreased by one in a promotion command. If any line in the entry
404body starts at column 0, indentation is not changed at all."
405 :group 'org-edit-structure
406 :type 'boolean)
407
408(defcustom org-enable-fixed-width-editor t
409 "Non-nil means, lines starting with \":\" are treated as fixed-width.
410This currently only means, they are never auto-wrapped.
411When nil, such lines will be treated like ordinary lines.
412See also the QUOTE keyword."
413 :group 'org-edit-structure
414 :type 'boolean)
415
416(defgroup org-sparse-trees nil
417 "Options concerning sparse trees in Org-mode."
418 :tag "Org Sparse Trees"
419 :group 'org-structure)
420
778(defcustom org-highlight-sparse-tree-matches t 421(defcustom org-highlight-sparse-tree-matches t
779 "Non-nil means, highlight all matches that define a sparse tree. 422 "Non-nil means, highlight all matches that define a sparse tree.
780The highlights will automatically disappear the next time the buffer is 423The highlights will automatically disappear the next time the buffer is
781changed by an edit command." 424changed by an edit command."
782 :group 'org-structure 425 :group 'org-sparse-trees
783 :type 'boolean) 426 :type 'boolean)
784 427
785(defcustom org-show-hierarchy-above t 428(defcustom org-show-hierarchy-above t
786 "Non-nil means, show full hierarchy when showing a spot in the tree. 429 "Non-nil means, show full hierarchy when showing a spot in the tree.
787Turning this off makes sparse trees more compact, but also less clear." 430Turning this off makes sparse trees more compact, but also less clear."
788 :group 'org-structure 431 :group 'org-sparse-trees
789 :type 'boolean) 432 :type 'boolean)
790 433
791(defcustom org-show-following-heading t 434(defcustom org-show-following-heading t
@@ -795,43 +438,39 @@ follows the match, even if they do not match the regexp. This makes it
795easier to edit directly inside the sparse tree. However, if you use 438easier to edit directly inside the sparse tree. However, if you use
796`org-occur' mainly as an overview, the following headlines are 439`org-occur' mainly as an overview, the following headlines are
797unnecessary clutter." 440unnecessary clutter."
798 :group 'org-structure 441 :group 'org-sparse-trees
799 :type 'boolean) 442 :type 'boolean)
800 443
801(defcustom org-occur-hook '(org-first-headline-recenter) 444(defcustom org-occur-hook '(org-first-headline-recenter)
802 "Hook that is run after `org-occur' has constructed a sparse tree. 445 "Hook that is run after `org-occur' has constructed a sparse tree.
803This can be used to recenter the window to show as much of the structure 446This can be used to recenter the window to show as much of the structure
804as possible." 447as possible."
805 :group 'org-structure 448 :group 'org-sparse-trees
806 :type 'hook) 449 :type 'hook)
807 450
808(defcustom org-odd-levels-only nil 451(defgroup org-plain-lists nil
809 "Non-nil means, skip even levels and only use odd levels for the outline. 452 "Options concerning plain lists in Org-mode."
810This has the effect that two stars are being added/taken away in 453 :tag "Org Plain lists"
811promotion/demotion commands. It also influences how levels are 454 :group 'org-structure)
812handled by the exporters.
813Changing it requires restart of `font-lock-mode' to become effective
814for fontification also in regions already fontified."
815 :group 'org-structure
816 :group 'org-font-lock
817 :type 'boolean)
818 455
819(defcustom org-adapt-indentation t 456(defcustom org-cycle-include-plain-lists nil
820 "Non-nil means, adapt indentation when promoting and demoting. 457 "Non-nil means, include plain lists into visibility cycling.
821When this is set and the *entire* text in an entry is indented, the 458This means that during cycling, plain list items will *temporarily* be
822indentation is increased by one space in a demotion command, and 459interpreted as outline headlines with a level given by 1000+i where i is the
823decreased by one in a promotion command. If any line in the entry 460indentation of the bullet. In all other operations, plain list items are
824body starts at column 0, indentation is not changed at all." 461not seen as headlines. For example, you cannot assign a TODO keyword to
825 :group 'org-structure 462such an item."
463 :group 'org-plain-lists
826 :type 'boolean) 464 :type 'boolean)
827 465
466
828(defcustom org-plain-list-ordered-item-terminator t 467(defcustom org-plain-list-ordered-item-terminator t
829 "The character that makes a line with leading number an ordered list item. 468 "The character that makes a line with leading number an ordered list item.
830Valid values are ?. and ?\). To get both terminators, use t. While 469Valid values are ?. and ?\). To get both terminators, use t. While
831?. may look nicer, it creates the danger that a line with leading 470?. may look nicer, it creates the danger that a line with leading
832number may be incorrectly interpreted as an item. ?\) therefore is 471number may be incorrectly interpreted as an item. ?\) therefore is
833the safe choice." 472the safe choice."
834 :group 'org-structure 473 :group 'org-plain-lists
835 :type '(choice (const :tag "dot like in \"2.\"" ?.) 474 :type '(choice (const :tag "dot like in \"2.\"" ?.)
836 (const :tag "paren like in \"2)\"" ?\)) 475 (const :tag "paren like in \"2)\"" ?\))
837 (const :tab "both" t))) 476 (const :tab "both" t)))
@@ -841,16 +480,13 @@ the safe choice."
841Renumbering happens when the sequence have been changed with 480Renumbering happens when the sequence have been changed with
842\\[org-shiftmetaup] or \\[org-shiftmetadown]. After other editing commands, 481\\[org-shiftmetaup] or \\[org-shiftmetadown]. After other editing commands,
843use \\[org-ctrl-c-ctrl-c] to trigger renumbering." 482use \\[org-ctrl-c-ctrl-c] to trigger renumbering."
844 :group 'org-structure 483 :group 'org-plain-lists
845 :type 'boolean) 484 :type 'boolean)
846 485
847(defcustom org-enable-fixed-width-editor t 486(defgroup org-archive nil
848 "Non-nil means, lines starting with \":\" are treated as fixed-width. 487 "Options concerning archiving in Org-mode."
849This currently only means, they are never auto-wrapped. 488 :tag "Org Archive"
850When nil, such lines will be treated like ordinary lines. 489 :group 'org-structure)
851See also the QUOTE keyword."
852 :group 'org-structure
853 :type 'boolean)
854 490
855(defcustom org-archive-location "%s_archive::" 491(defcustom org-archive-location "%s_archive::"
856 "The location where subtrees should be archived. 492 "The location where subtrees should be archived.
@@ -885,12 +521,12 @@ You may set this option on a per-file basis by adding to the buffer a
885line like 521line like
886 522
887#+ARCHIVE: basement::** Finished Tasks" 523#+ARCHIVE: basement::** Finished Tasks"
888 :group 'org-structure 524 :group 'org-archive
889 :type 'string) 525 :type 'string)
890 526
891(defcustom org-archive-mark-done t 527(defcustom org-archive-mark-done t
892 "Non-nil means, mark archived entries as DONE." 528 "Non-nil means, mark archived entries as DONE."
893 :group 'org-structure 529 :group 'org-archive
894 :type 'boolean) 530 :type 'boolean)
895 531
896(defcustom org-archive-stamp-time t 532(defcustom org-archive-stamp-time t
@@ -898,87 +534,250 @@ line like
898The time stamp will be added directly after the TODO state keyword in the 534The time stamp will be added directly after the TODO state keyword in the
899first line, so it is probably best to use this in combinations with 535first line, so it is probably best to use this in combinations with
900`org-archive-mark-done'." 536`org-archive-mark-done'."
901 :group 'org-structure 537 :group 'org-archive
902 :type 'boolean) 538 :type 'boolean)
903 539
904(defgroup org-tags nil 540(defgroup org-table nil
905 "Options concerning startup of Org-mode." 541 "Options concerning tables in Org-mode."
906 :tag "Org Tags" 542 :tag "Org Table"
907 :group 'org) 543 :group 'org)
908 544
909(defcustom org-tags-column 48 545(defcustom org-enable-table-editor 'optimized
910 "The column to which tags should be indented in a headline. 546 "Non-nil means, lines starting with \"|\" are handled by the table editor.
911If this number is positive, it specifies the column. If it is negative, 547When nil, such lines will be treated like ordinary lines.
912it means that the tags should be flushright to that column. For example,
913-79 works well for a normal 80 character screen."
914 :group 'org-tags
915 :type 'integer)
916 548
917(defcustom org-auto-align-tags t 549When equal to the symbol `optimized', the table editor will be optimized to
918 "Non-nil means, realign tags after pro/demotion of TODO state change. 550do the following:
919These operations change the length of a headline and therefore shift 551- Use automatic overwrite mode in front of whitespace in table fields.
920the tags around. With this options turned on, after each such operation 552 This make the structure of the table stay in tact as long as the edited
921the tags are again aligned to `org-tags-column'." 553 field does not exceed the column width.
922 :group 'org-tags 554- Minimize the number of realigns. Normally, the table is aligned each time
555 TAB or RET are pressed to move to another field. With optimization this
556 happens only if changes to a field might have changed the column width.
557Optimization requires replacing the functions `self-insert-command',
558`delete-char', and `backward-delete-char' in Org-mode buffers, with a
559slight (in fact: unnoticeable) speed impact for normal typing. Org-mode is
560very good at guessing when a re-align will be necessary, but you can always
561force one with \\[org-ctrl-c-ctrl-c].
562
563If you would like to use the optimized version in Org-mode, but the
564un-optimized version in OrgTbl-mode, see the variable `orgtbl-optimized'.
565
566This variable can be used to turn on and off the table editor during a session,
567but in order to toggle optimization, a restart is required.
568
569See also the variable `org-table-auto-blank-field'."
570 :group 'org-table
571 :type '(choice
572 (const :tag "off" nil)
573 (const :tag "on" t)
574 (const :tag "on, optimized" optimized)))
575
576(defcustom orgtbl-optimized (eq org-enable-table-editor 'optimized)
577 "Non-nil means, use the optimized table editor version for `orgtbl-mode'.
578In the optimized version, the table editor takes over all simple keys that
579normally just insert a character. In tables, the characters are inserted
580in a way to minimize disturbing the table structure (i.e. in overwrite mode
581for empty fields). Outside tables, the correct binding of the keys is
582restored.
583
584The default for this option is t if the optimized version is also used in
585Org-mode. See the variable `org-enable-table-editor' for details. Changing
586this variable requires a restart of Emacs to become effective."
587 :group 'org-table
923 :type 'boolean) 588 :type 'boolean)
924 589
925(defcustom org-use-tag-inheritance t 590(defgroup org-table-settings nil
926 "Non-nil means, tags in levels apply also for sublevels. 591 "Settings for tables in Org-mode."
927When nil, only the tags directly given in a specific line apply there. 592 :tag "Org Table Settings"
928If you turn off this option, you very likely want to turn on the 593 :group 'org-table)
929companion option `org-tags-match-list-sublevels'." 594
930 :group 'org-tags 595(defcustom org-table-default-size "5x2"
596 "The default size for newly created tables, Columns x Rows."
597 :group 'org-table-settings
598 :type 'string)
599
600(defcustom org-table-number-regexp "^[<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%]*$"
601 "Regular expression for recognizing numbers in table columns.
602If a table column contains mostly numbers, it will be aligned to the
603right. If not, it will be aligned to the left.
604
605The default value of this option is a regular expression which allows
606anything which looks remotely like a number as used in scientific
607context. For example, all of the following will be considered a
608number:
609 12 12.2 2.4e-08 2x10^12 4.034+-0.02 2.7(10) >3.5
610
611Other options offered by the customize interface are more restrictive."
612 :group 'org-table-settings
613 :type '(choice
614 (const :tag "Positive Integers"
615 "^[0-9]+$")
616 (const :tag "Integers"
617 "^[-+]?[0-9]+$")
618 (const :tag "Floating Point Numbers"
619 "^[-+]?\\([0-9]*\\.[0-9]+\\|[0-9]+\\.[0-9]*\\)$")
620 (const :tag "Floating Point Number or Integer"
621 "^[-+]?\\([0-9]*\\.[0-9]+\\|[0-9]+\\.?[0-9]*\\)$")
622 (const :tag "Exponential, Floating point, Integer"
623 "^[-+]?[0-9.]+\\([eEdD][-+0-9]+\\)?$")
624 (const :tag "Very General Number-Like"
625 "^[<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%]*$")
626 (string :tag "Regexp:")))
627
628(defcustom org-table-number-fraction 0.5
629 "Fraction of numbers in a column required to make the column align right.
630In a column all non-white fields are considered. If at least this
631fraction of fields is matched by `org-table-number-fraction',
632alignment to the right border applies."
633 :group 'org-table-settings
634 :type 'number)
635
636(defgroup org-table-editing nil
637 "Bahavior of tables during editing in Org-mode."
638 :tag "Org Table Editing"
639 :group 'org-table)
640
641(defcustom org-table-automatic-realign t
642 "Non-nil means, automatically re-align table when pressing TAB or RETURN.
643When nil, aligning is only done with \\[org-table-align], or after column
644removal/insertion."
645 :group 'org-table-editing
931 :type 'boolean) 646 :type 'boolean)
932 647
933(defcustom org-tags-match-list-sublevels nil 648(defcustom org-table-limit-column-width t ;kw
934 "Non-nil means list also sublevels of headlines matching tag search. 649 "Non-nil means, allow to limit the width of table columns with <N> fields."
935Because of tag inheritance (see variable `org-use-tag-inheritance'), 650 :group 'org-table-editing
936the sublevels of a headline matching a tag search often also match 651 :type 'boolean)
937the same search. Listing all of them can create very long lists.
938Setting this variable to nil causes subtrees to be skipped.
939This option is off by default, because inheritance in on. If you turn
940inheritance off, you very likely want to turn this option on.
941 652
942As a special case, if the tag search is restricted to TODO items, the 653(defcustom org-table-auto-blank-field t
943value of this variable is ignored and sublevels are always checked, to 654 "Non-nil means, automatically blank table field when starting to type into it.
944make sure all corresponding TODO items find their way into the list." 655This only happens when typing immediately after a field motion
945 :group 'org-tags 656command (TAB, S-TAB or RET).
657Only relevant when `org-enable-table-editor' is equal to `optimized'."
658 :group 'org-table-editing
946 :type 'boolean) 659 :type 'boolean)
947 660
948(defvar org-tags-history nil 661(defcustom org-table-tab-jumps-over-hlines t
949 "History of minibuffer reads for tags.") 662 "Non-nil means, tab in the last column of a table with jump over a hline.
950(defvar org-last-tags-completion-table nil 663If a horizontal separator line is following the current line,
951 "The last used completion table for tags.") 664`org-table-next-field' can either create a new row before that line, or jump
665over the line. When this option is nil, a new line will be created before
666this line."
667 :group 'org-table-editing
668 :type 'boolean)
669
670(defcustom org-table-tab-recognizes-table.el t
671 "Non-nil means, TAB will automatically notice a table.el table.
672When it sees such a table, it moves point into it and - if necessary -
673calls `table-recognize-table'."
674 :group 'org-table-editing
675 :type 'boolean)
676
677(defgroup org-table-calculation nil
678 "Options concerning tables in Org-mode."
679 :tag "Org Table Calculation"
680 :group 'org-table)
681
682(defcustom org-table-copy-increment t
683 "Non-nil means, increment when copying current field with \\[org-table-copy-down]."
684 :group 'org-table-calculation
685 :type 'boolean)
686
687(defcustom org-calc-default-modes
688 '(calc-internal-prec 12
689 calc-float-format (float 5)
690 calc-angle-mode deg
691 calc-prefer-frac nil
692 calc-symbolic-mode nil
693 calc-date-format (YYYY "-" MM "-" DD " " Www (" " HH ":" mm))
694 calc-display-working-message t
695 )
696 "List with Calc mode settings for use in calc-eval for table formulas.
697The list must contain alternating symbols (Calc modes variables and values).
698Don't remove any of the default settings, just change the values. Org-mode
699relies on the variables to be present in the list."
700 :group 'org-table-calculation
701 :type 'plist)
702
703(defcustom org-table-formula-evaluate-inline t
704 "Non-nil means, TAB and RET evaluate a formula in current table field.
705If the current field starts with an equal sign, it is assumed to be a formula
706which should be evaluated as described in the manual and in the documentation
707string of the command `org-table-eval-formula'. This feature requires the
708Emacs calc package.
709When this variable is nil, formula calculation is only available through
710the command \\[org-table-eval-formula]."
711 :group 'org-table-calculation
712 :type 'boolean)
713
714
715(defcustom org-table-formula-use-constants t
716 "Non-nil means, interpret constants in formulas in tables.
717A constant looks like `$c' or `$Grav' and will be replaced before evaluation
718by the value given in `org-table-formula-constants', or by a value obtained
719from the `constants.el' package."
720 :group 'org-table-calculation
721 :type 'boolean)
722
723(defcustom org-table-formula-constants nil
724 "Alist with constant names and values, for use in table formulas.
725The car of each element is a name of a constant, without the `$' before it.
726The cdr is the value as a string. For example, if you'd like to use the
727speed of light in a formula, you would configure
728
729 (setq org-table-formula-constants '((\"c\" . \"299792458.\")))
730
731and then use it in an equation like `$1*$c'."
732 :group 'org-table-calculation
733 :type '(repeat
734 (cons (string :tag "name")
735 (string :tag "value"))))
736
737(defcustom org-table-formula-numbers-only nil
738 "Non-nil means, calculate only with numbers in table formulas.
739Then all input fields will be converted to a number, and the result
740must also be a number. When nil, calc's full potential is available
741in table calculations, including symbolics etc."
742 :group 'org-table-calculation
743 :type 'boolean)
744
745(defcustom org-table-allow-automatic-line-recalculation t
746 "Non-nil means, lines marked with |#| or |*| will be recomputed automatically.
747Automatically means, when TAB or RET or C-c C-c are pressed in the line."
748 :group 'org-table-calculation
749 :type 'boolean)
952 750
953(defgroup org-link nil 751(defgroup org-link nil
954 "Options concerning links in Org-mode." 752 "Options concerning links in Org-mode."
955 :tag "Org Link" 753 :tag "Org Link"
956 :group 'org) 754 :group 'org)
957 755
958(defcustom org-tab-follows-link nil 756(defcustom org-descriptive-links t
959 "Non-nil means, on links TAB will follow the link. 757 "Non-nil means, hide link part and only show description of bracket links.
960Needs to be set before org.el is loaded." 758Bracket links are like [[link][descritpion]]. This variable sets the initial
759state in new org-mode buffers. The setting can then be toggled on a
760per-buffer basis from the Org->Hyperlinks menu."
961 :group 'org-link 761 :group 'org-link
962 :type 'boolean) 762 :type 'boolean)
963 763
964(defcustom org-return-follows-link nil 764(defcustom org-link-style 'bracket
965 "Non-nil means, on links RET will follow the link. 765 "The style of links to be inserted with \\[org-insert-link].
966Needs to be set before org.el is loaded." 766Possible values are:
767bracket [[link][description]]. This is recommended
768plain Description \\n link. The old way, no longer recommended."
967 :group 'org-link 769 :group 'org-link
968 :type 'boolean) 770 :type '(choice
969 771 (const :tag "Bracket (recommended)" bracket)
970(defcustom org-mark-ring-length 4 772 (const :tag "Plain (no longer recommended)" plain)))
971 "Number of different positions to be recorded in the ring
972Changing this requires a restart of Emacs to work correctly."
973 :group 'org-link
974 :type 'interger)
975 773
976(defcustom org-link-format "<%s>" 774(defcustom org-link-format "%s"
977 "Default format for linkes in the buffer. 775 "Default format for external, URL-like linkes in the buffer.
978This is a format string for printf, %s will be replaced by the link text. 776This is a format string for printf, %s will be replaced by the link text.
979If you want to make sure that your link is always properly terminated, 777The recommended value is just \"%s\", since links will be protected by
980include angle brackets into this format, like \"<%s>\". Some people also 778enclosing them in double brackets. If you prefer plain links (see variable
981recommend an additional URL: prefix, so the format would be \"<URL:%s>\"." 779`org-link-style'), \"<%s>\" is useful. Some people also recommend an
780additional URL: prefix, so the format would be \"<URL:%s>\"."
982 :group 'org-link 781 :group 'org-link
983 :type '(choice 782 :type '(choice
984 (const :tag "\"%s\" (e.g. http://www.there.com)" "%s") 783 (const :tag "\"%s\" (e.g. http://www.there.com)" "%s")
@@ -986,28 +785,35 @@ recommend an additional URL: prefix, so the format would be \"<URL:%s>\"."
986 (const :tag "\"<URL:%s>\" (e.g. <URL:http://www.there.com>)" "<URL:%s>") 785 (const :tag "\"<URL:%s>\" (e.g. <URL:http://www.there.com>)" "<URL:%s>")
987 (string :tag "Other" :value "<%s>"))) 786 (string :tag "Other" :value "<%s>")))
988 787
989(defcustom org-allow-space-in-links t 788(defcustom org-activate-links '(bracket angle plain radio tag date)
990 "Non-nil means, file names in links may contain space characters. 789 "Types of links that should be activated in Org-mode files.
991When nil, it becomes possible to put several links into a line. 790This is a list of symbols, each leading to the activation of a certain link
992Note that in tables, a link never extends accross fields, so in a table 791type. In principle, it does not hurt to turn on most link types - there may
993it is always possible to put several links into a line. 792be a small gain when turning off unused link types. The types are:
994Changing this variable requires a restart of Emacs of become effective." 793
995 :group 'org-link 794bracket The recommended [[link][description]] or [[link]] links with hiding.
996 :type 'boolean) 795angular Links in angular brackes that may contain whitespace like
997 796 <bbdb:Carsten Dominik>.
998(defcustom org-radio-targets t 797plain Plain links in normal text, no whitespace, like http://google.com.
999 "Non-nil means activate text matching a link target. 798radio Text that is matched by a radio target, see manual for details.
1000Radio targets are strings in triple angular brackets, like <<<My Target>>>. 799tag Tag settings in a headline (link to tag search).
1001When this option is set, any occurrence of \"my target\" in normal text 800date Time stamps (link to calendar).
1002becomes a link." 801camel CamelCase words defining text searches.
1003 :group 'org-link 802
1004 :type 'boolean) 803Changing this variable requires a restart of Emacs to become effective."
1005
1006(defcustom org-activate-camels nil
1007 "Non-nil means, treat words in CamelCase as in-file links.
1008Changing this requires restart of Emacs to become effective."
1009 :group 'org-link 804 :group 'org-link
1010 :type 'boolean) 805 :type '(set (const :tag "Double bracket links (new style)" bracket)
806 (const :tag "Angular bracket links (old style)" angular)
807 (const :tag "plain text links" plain)
808 (const :tag "Radio target matches" radio)
809 (const :tag "Tags" tag)
810 (const :tag "Timestamps" date)
811 (const :tag "CamelCase words" camel)))
812
813(defgroup org-link-store nil
814 "Options concerning storing links in Org-mode"
815 :tag "Org Store Link"
816 :group 'org-link)
1011 817
1012(defcustom org-context-in-file-links t 818(defcustom org-context-in-file-links t
1013 "Non-nil means, file links from `org-store-link' contain context. 819 "Non-nil means, file links from `org-store-link' contain context.
@@ -1016,13 +822,14 @@ used to find the context when the link is activated by the command
1016`org-open-at-point'. 822`org-open-at-point'.
1017Using a prefix arg to the command \\[org-store-link] (`org-store-link') 823Using a prefix arg to the command \\[org-store-link] (`org-store-link')
1018negates this setting for the duration of the command." 824negates this setting for the duration of the command."
1019 :group 'org-link 825 :group 'org-link-store
1020 :type 'boolean) 826 :type 'boolean)
1021 827
1022(defcustom org-file-link-context-use-camel-case nil 828(defcustom org-file-link-context-use-camel-case nil
1023 "Non-nil means, use CamelCase to store a search context in a file link. 829 "Non-nil means, use CamelCase to store a search context in a file link.
1024When nil, the search string simply consists of the words of the string." 830When nil, the search string simply consists of the words of the string.
1025 :group 'org-link 831CamelCase is deprecated, and support for it may be dropped in the future."
832 :group 'org-link-store
1026 :type 'boolean) 833 :type 'boolean)
1027 834
1028(defcustom org-keep-stored-link-after-insertion nil 835(defcustom org-keep-stored-link-after-insertion nil
@@ -1035,9 +842,40 @@ Org-mode file (offering completion for all stored links). When this
1035option is nil, every link which has been inserted once using \\[org-insert-link] 842option is nil, every link which has been inserted once using \\[org-insert-link]
1036will be removed from the list, to make completing the unused links 843will be removed from the list, to make completing the unused links
1037more efficient." 844more efficient."
1038 :group 'org-link 845 :group 'org-link-store
846 :type 'boolean)
847
848(defcustom org-usenet-links-prefer-google nil
849 "Non-nil means, `org-store-link' will create web links to Google groups.
850When nil, Gnus will be used for such links.
851Using a prefix arg to the command \\[org-store-link] (`org-store-link')
852negates this setting for the duration of the command."
853 :group 'org-link-store
1039 :type 'boolean) 854 :type 'boolean)
1040 855
856(defgroup org-link-follow nil
857 "Options concerning following links in Org-mode"
858 :tag "Org Follow Link"
859 :group 'org-link)
860
861(defcustom org-tab-follows-link nil
862 "Non-nil means, on links TAB will follow the link.
863Needs to be set before org.el is loaded."
864 :group 'org-link-follow
865 :type 'boolean)
866
867(defcustom org-return-follows-link nil
868 "Non-nil means, on links RET will follow the link.
869Needs to be set before org.el is loaded."
870 :group 'org-link-follow
871 :type 'boolean)
872
873(defcustom org-mark-ring-length 4
874 "Number of different positions to be recorded in the ring
875Changing this requires a restart of Emacs to work correctly."
876 :group 'org-link-follow
877 :type 'interger)
878
1041(defcustom org-link-frame-setup 879(defcustom org-link-frame-setup
1042 '((vm . vm-visit-folder-other-frame) 880 '((vm . vm-visit-folder-other-frame)
1043 (gnus . gnus-other-frame) 881 (gnus . gnus-other-frame)
@@ -1059,7 +897,7 @@ For FILE, use any of
1059For the calendar, use the variable `calendar-setup'. 897For the calendar, use the variable `calendar-setup'.
1060For BBDB, it is currently only possible to display the matches in 898For BBDB, it is currently only possible to display the matches in
1061another window." 899another window."
1062 :group 'org-link 900 :group 'org-link-follow
1063 :type '(list 901 :type '(list
1064 (cons (const vm) 902 (cons (const vm)
1065 (choice 903 (choice
@@ -1076,25 +914,28 @@ another window."
1076 (const find-file-other-window) 914 (const find-file-other-window)
1077 (const find-file-other-frame))))) 915 (const find-file-other-frame)))))
1078 916
1079(defcustom org-usenet-links-prefer-google nil
1080 "Non-nil means, `org-store-link' will create web links to Google groups.
1081When nil, Gnus will be used for such links.
1082Using a prefix arg to the command \\[org-store-link] (`org-store-link')
1083negates this setting for the duration of the command."
1084 :group 'org-link
1085 :type 'boolean)
1086
1087(defcustom org-open-non-existing-files nil 917(defcustom org-open-non-existing-files nil
1088 "Non-nil means, `org-open-file' will open non-existing file. 918 "Non-nil means, `org-open-file' will open non-existing file.
1089When nil, an error will be generated." 919When nil, an error will be generated."
1090 :group 'org-link 920 :group 'org-link-follow
1091 :type 'boolean) 921 :type 'boolean)
1092 922
1093(defcustom org-confirm-shell-links t 923(defcustom org-confirm-shell-links 'yes-or-no-p
1094 "Non-nil means, ask for confirmation before executing shell links. 924 "Non-nil means, ask for confirmation before executing shell links.
1095The default is true, to keep new users from shooting into their own foot." 925Shell links can be dangerous, just thing about a link
1096 :group 'org-link 926
1097 :type 'boolean) 927 [[shell:rm -rf ~/*][Google Search]]
928
929This link would show up in your Org-mode document as \"Google Search\"
930but really it would remove your entire home directory. Dangerous indeed.
931Therefore I *definitely* advise agains setting this varaiable to nil.
932Just change it to `y-or-n-p' of you want to confirm with a single key press
933rather than having to type \"yes\"."
934 :group 'org-link-follow
935 :type '(choice
936 (const :tag "with yes-or-no (safer)" yes-or-no-p)
937 (const :tag "with y-or-n (faster)" y-or-n-p)
938 (const :tag "no confirmation (dangerous)" nil)))
1098 939
1099(defconst org-file-apps-defaults-gnu 940(defconst org-file-apps-defaults-gnu
1100 '((t . mailcap)) 941 '((t . mailcap))
@@ -1143,7 +984,7 @@ For more examples, see the system specific constants
1143`org-file-apps-defaults-macosx' 984`org-file-apps-defaults-macosx'
1144`org-file-apps-defaults-windowsnt' 985`org-file-apps-defaults-windowsnt'
1145`org-file-apps-defaults-gnu'." 986`org-file-apps-defaults-gnu'."
1146 :group 'org-link 987 :group 'org-link-follow
1147 :type '(repeat 988 :type '(repeat
1148 (cons (choice :value "" 989 (cons (choice :value ""
1149 (string :tag "Extension") 990 (string :tag "Extension")
@@ -1156,11 +997,11 @@ For more examples, see the system specific constants
1156 (sexp :tag "Lisp form"))))) 997 (sexp :tag "Lisp form")))))
1157 998
1158(defcustom org-mhe-search-all-folders nil 999(defcustom org-mhe-search-all-folders nil
1159 "Non-nil means, that the search for the mh-message will be extended to 1000 "Non-nil means, that the search for the mh-message will be extended to
1160all folders if the message cannot be found in the folder given in the link. 1001all folders if the message cannot be found in the folder given in the link.
1161Searching all folders is very effective with one of the search engines 1002Searching all folders is very effective with one of the search engines
1162supported by MH-E, but will be slow with pick." 1003supported by MH-E, but will be slow with pick."
1163 :group 'org-link 1004 :group 'org-link-follow
1164 :type 'boolean) 1005 :type 'boolean)
1165 1006
1166(defgroup org-remember nil 1007(defgroup org-remember nil
@@ -1184,6 +1025,34 @@ the value of `remember-data-file'."
1184 (const :tag "Default from remember-data-file" nil) 1025 (const :tag "Default from remember-data-file" nil)
1185 file)) 1026 file))
1186 1027
1028(defcustom org-remember-templates nil
1029 "Templates for the creation of remember buffers.
1030When nil, just let remember make the buffer.
1031When not nil, this is a list of 3-element lists. In each entry, the first
1032element is a character, a unique key to select this template.
1033The second element is the template. The third element is optional and can
1034specify a destination file for remember items created with this template.
1035The default file is given by `org-default-notes-file'.
1036
1037The template specifies the structure of the remember buffer. It should have
1038a first line starting with a star, to act as the org-mode headline.
1039Furthermore, the following %-escapes will be replaced with content:
1040 %t time stamp, date only
1041 %T time stamp with date and time
1042 %u inactive time stamp, date only
1043 %U inactive time stamp with date and time
1044 %n user name
1045 %a annotation, normally the link created with org-store-link
1046 %i initial content, the region when remember is called with C-u.
1047 If %i is indented, the entire inserted text will be indented as well.
1048 %? This will be removed, and the cursor placed at this position."
1049 :group 'org-remember
1050 :type '(repeat :tag "enabled"
1051 (list :value (?a "\n" nil)
1052 (character :tag "Selection Key")
1053 (string :tag "Template")
1054 (file :tag "Destination file (optional)"))))
1055
1187(defcustom org-reverse-note-order nil 1056(defcustom org-reverse-note-order nil
1188 "Non-nil means, store new notes at the beginning of a file or entry. 1057 "Non-nil means, store new notes at the beginning of a file or entry.
1189When nil, new notes will be filed to the end of a file or entry." 1058When nil, new notes will be filed to the end of a file or entry."
@@ -1194,215 +1063,478 @@ When nil, new notes will be filed to the end of a file or entry."
1194 (repeat :tag "By file name regexp" 1063 (repeat :tag "By file name regexp"
1195 (cons regexp boolean)))) 1064 (cons regexp boolean))))
1196 1065
1197(defgroup org-table nil 1066(defgroup org-todo nil
1198 "Options concerning tables in Org-mode." 1067 "Options concerning TODO items in Org-mode."
1199 :tag "Org Table" 1068 :tag "Org TODO"
1200 :group 'org) 1069 :group 'org)
1201 1070
1202(defcustom org-enable-table-editor 'optimized 1071(defcustom org-todo-keywords '("TODO" "DONE")
1203 "Non-nil means, lines starting with \"|\" are handled by the table editor. 1072 "List of TODO entry keywords.
1204When nil, such lines will be treated like ordinary lines. 1073\\<org-mode-map>By default, this is '(\"TODO\" \"DONE\"). The last entry in the list is
1074considered to mean that the entry is \"done\". All the other mean that
1075action is required, and will make the entry show up in todo lists, diaries
1076etc.
1077The command \\[org-todo] cycles an entry through these states, and an
1078additional state where no keyword is present. For details about this
1079cycling, see also the variable `org-todo-interpretation'
1080Changes become only effective after restarting Emacs."
1081 :group 'org-todo
1082 :group 'org-keywords
1083 :type '(repeat (string :tag "Keyword")))
1205 1084
1206When equal to the symbol `optimized', the table editor will be optimized to 1085(defcustom org-todo-interpretation 'sequence
1207do the following: 1086 "Controls how TODO keywords are interpreted.
1208- Use automatic overwrite mode in front of whitespace in table fields. 1087This variable is only relevant if `org-todo-keywords' contains more than two
1209 This make the structure of the table stay in tact as long as the edited 1088states. \\<org-mode-map>Possible values are `sequence' and `type'.
1210 field does not exceed the column width. 1089
1211- Minimize the number of realigns. Normally, the table is aligned each time 1090When `sequence', \\[org-todo] will always switch to the next state in the
1212 TAB or RET are pressed to move to another field. With optimization this 1091`org-todo-keywords' list. When `type', \\[org-todo] only cycles from state
1213 happens only if changes to a field might have changed the column width. 1092to state when executed several times in direct succession. Otherwise, it
1214Optimization requires replacing the functions `self-insert-command', 1093switches directly to DONE from any state.
1215`delete-char', and `backward-delete-char' in Org-mode buffers, with a 1094See the manual for more information."
1216slight (in fact: unnoticeable) speed impact for normal typing. Org-mode is 1095 :group 'org-todo
1217very good at guessing when a re-align will be necessary, but you can always 1096 :group 'org-keywords
1218force one with \\[org-ctrl-c-ctrl-c]. 1097 :type '(choice (const sequence)
1098 (const type)))
1219 1099
1220If you would like to use the optimized version in Org-mode, but the 1100(defcustom org-after-todo-state-change-hook nil
1221un-optimized version in OrgTbl-mode, see the variable `orgtbl-optimized'. 1101 "Hook which is run after the state of a TODO item was changed.
1102The new state (a string with a TODO keyword, or nil) is available in the
1103Lisp variable `state'."
1104 :group 'org-todo
1105 :type 'hook)
1222 1106
1223This variable can be used to turn on and off the table editor during a session, 1107(defcustom org-log-done nil
1224but in order to toggle optimization, a restart is required. 1108 "When set, insert a (non-active) time stamp when TODO entry is marked DONE.
1109When the state of an entry is changed from nothing to TODO, remove a previous
1110closing date."
1111 :group 'org-todo
1112 :type 'boolean)
1225 1113
1226See also the variable `org-table-auto-blank-field'." 1114(defgroup org-priorities nil
1227 :group 'org-table 1115 "Keywords in Org-mode."
1228 :type '(choice 1116 :tag "Org Priorities"
1229 (const :tag "off" nil) 1117 :group 'org-todo)
1230 (const :tag "on" t)
1231 (const :tag "on, optimized" optimized)))
1232 1118
1233;; FIXME: We could have a third option which makes it jump only over the first 1119(defcustom org-default-priority ?B
1234;; hline in a table. 1120 "The default priority of TODO items.
1235(defcustom org-table-tab-jumps-over-hlines t 1121This is the priority an item get if no explicit priority is given."
1236 "Non-nil means, tab in the last column of a table with jump over a hline. 1122 :group 'org-priorities
1237If a horizontal separator line is following the current line, 1123 :type 'character)
1238`org-table-next-field' can either create a new row before that line, or jump 1124
1239over the line. When this option is nil, a new line will be created before 1125(defcustom org-lowest-priority ?C
1240this line." 1126 "The lowest priority of TODO items. A character like ?A, ?B etc."
1241 :group 'org-table 1127 :group 'org-priorities
1128 :type 'character)
1129
1130(defgroup org-time nil
1131 "Options concerning time stamps and deadlines in Org-mode."
1132 :tag "Org Time"
1133 :group 'org)
1134
1135(defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>")
1136 "Formats for `format-time-string' which are used for time stamps.
1137It is not recommended to change this constant.")
1138
1139(defcustom org-time-stamp-rounding-minutes 0
1140 "Number of minutes to round time stamps to upon insertion.
1141When zero, insert the time unmodified. Useful rounding numbers
1142should be factors of 60, so for example 5, 10, 15.
1143When this is not zero, you can still force an exact time-stamp by using
1144a double prefix argument to a time-stamp command like `C-c .' or `C-c !'."
1145 :group 'org-time
1146 :type 'integer)
1147
1148(defcustom org-deadline-warning-days 30
1149 "No. of days before expiration during which a deadline becomes active.
1150This variable governs the display in the org file."
1151 :group 'org-time
1152 :type 'number)
1153
1154(defcustom org-popup-calendar-for-date-prompt t
1155 "Non-nil means, pop up a calendar when prompting for a date.
1156In the calendar, the date can be selected with mouse-1. However, the
1157minibuffer will also be active, and you can simply enter the date as well.
1158When nil, only the minibuffer will be available."
1159 :group 'org-time
1242 :type 'boolean) 1160 :type 'boolean)
1243 1161
1244(defcustom org-table-auto-blank-field t 1162(defcustom org-calendar-follow-timestamp-change t
1245 "Non-nil means, automatically blank table field when starting to type into it. 1163 "Non-nil means, make the calendar window follow timestamp changes.
1246This only happens when typing immediately after a field motion 1164When a timestamp is modified and the calendar window is visible, it will be
1247command (TAB, S-TAB or RET). 1165moved to the new date."
1248Only relevant when `org-enable-table-editor' is equal to `optimized'." 1166 :group 'org-time
1249 :group 'org-table
1250 :type 'boolean) 1167 :type 'boolean)
1251 1168
1252(defcustom org-table-default-size "5x2" 1169(defgroup org-tags nil
1253 "The default size for newly created tables, Columns x Rows." 1170 "Options concerning startup of Org-mode."
1254 :group 'org-table 1171 :tag "Org Tags"
1255 :type 'string) 1172 :group 'org)
1256 1173
1257(defcustom org-table-automatic-realign t 1174(defcustom org-tags-column 48
1258 "Non-nil means, automatically re-align table when pressing TAB or RETURN. 1175 "The column to which tags should be indented in a headline.
1259When nil, aligning is only done with \\[org-table-align], or after column 1176If this number is positive, it specifies the column. If it is negative,
1260removal/insertion." 1177it means that the tags should be flushright to that column. For example,
1261 :group 'org-table 1178-79 works well for a normal 80 character screen."
1179 :group 'org-tags
1180 :type 'integer)
1181
1182(defcustom org-auto-align-tags t
1183 "Non-nil means, realign tags after pro/demotion of TODO state change.
1184These operations change the length of a headline and therefore shift
1185the tags around. With this options turned on, after each such operation
1186the tags are again aligned to `org-tags-column'."
1187 :group 'org-tags
1262 :type 'boolean) 1188 :type 'boolean)
1263 1189
1264(defcustom org-table-spaces-around-separators '(1 . 1) 1190(defcustom org-use-tag-inheritance t
1265 "The number of spaces to be placed before and after separators." 1191 "Non-nil means, tags in levels apply also for sublevels.
1266 :group 'org-table 1192When nil, only the tags directly given in a specific line apply there.
1267 :type '(cons (number :tag "Before \"|\"") (number :tag " After \"|\""))) 1193If you turn off this option, you very likely want to turn on the
1194companion option `org-tags-match-list-sublevels'."
1195 :group 'org-tags
1196 :type 'boolean)
1268 1197
1269(defcustom org-table-spaces-around-invisible-separators '(1 . 2) 1198(defcustom org-tags-match-list-sublevels nil
1270 "The number of spaces to be placed before and after separators. 1199 "Non-nil means list also sublevels of headlines matching tag search.
1271This option applies when the column separators have been made invisible." 1200Because of tag inheritance (see variable `org-use-tag-inheritance'),
1272 :group 'org-table 1201the sublevels of a headline matching a tag search often also match
1273 :type '(cons (number :tag "Before \"|\"") (number :tag " After \"|\""))) 1202the same search. Listing all of them can create very long lists.
1203Setting this variable to nil causes subtrees of a match to be skipped.
1204This option is off by default, because inheritance in on. If you turn
1205inheritance off, you very likely want to turn this option on.
1274 1206
1275(defcustom org-table-number-regexp "^[<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%]*$" 1207As a special case, if the tag search is restricted to TODO items, the
1276 "Regular expression for recognizing numbers in table columns. 1208value of this variable is ignored and sublevels are always checked, to
1277If a table column contains mostly numbers, it will be aligned to the 1209make sure all corresponding TODO items find their way into the list."
1278right. If not, it will be aligned to the left. 1210 :group 'org-tags
1211 :type 'boolean)
1279 1212
1280The default value of this option is a regular expression which allows 1213(defvar org-tags-history nil
1281anything which looks remotely like a number as used in scientific 1214 "History of minibuffer reads for tags.")
1282context. For example, all of the following will be considered a 1215(defvar org-last-tags-completion-table nil
1283number: 1216 "The last used completion table for tags.")
1284 12 12.2 2.4e-08 2x10^12 4.034+-0.02 2.7(10) >3.5
1285 1217
1286Other options offered by the customize interface are more restrictive." 1218(defgroup org-agenda nil
1287 :group 'org-table 1219 "Options concerning agenda display Org-mode."
1220 :tag "Org Agenda"
1221 :group 'org)
1222
1223(defvar org-category nil
1224 "Variable used by org files to set a category for agenda display.
1225Such files should use a file variable to set it, for example
1226
1227 -*- mode: org; org-category: \"ELisp\"
1228
1229or contain a special line
1230
1231#+CATEGORY: ELisp
1232
1233If the file does not specify a category, then file's base name
1234is used instead.")
1235(make-variable-buffer-local 'org-category)
1236
1237(defcustom org-agenda-files nil
1238 "The files to be used for agenda display.
1239Entries may be added to this list with \\[org-agenda-file-to-front] and removed with
1240\\[org-remove-file]. You can also use customize to edit the list.
1241
1242If the value of the variable is not a list but a single file name, then
1243the list of agenda files is actually stored and maintained in that file, one
1244agenda file per line."
1245 :group 'org-agenda
1288 :type '(choice 1246 :type '(choice
1289 (const :tag "Positive Integers" 1247 (repeat :tag "List of files" file)
1290 "^[0-9]+$") 1248 (file :tag "Store list in a file\n" :value "~/.agenda_files")))
1291 (const :tag "Integers"
1292 "^[-+]?[0-9]+$")
1293 (const :tag "Floating Point Numbers"
1294 "^[-+]?\\([0-9]*\\.[0-9]+\\|[0-9]+\\.[0-9]*\\)$")
1295 (const :tag "Floating Point Number or Integer"
1296 "^[-+]?\\([0-9]*\\.[0-9]+\\|[0-9]+\\.?[0-9]*\\)$")
1297 (const :tag "Exponential, Floating point, Integer"
1298 "^[-+]?[0-9.]+\\([eEdD][-+0-9]+\\)?$")
1299 (const :tag "Very General Number-Like"
1300 "^[<>]?[-+^.0-9]*[0-9][-+^.0-9eEdDx()%]*$")
1301 (string :tag "Regexp:")))
1302 1249
1303(defcustom org-table-number-fraction 0.5 1250(defcustom org-agenda-custom-commands '(("w" todo "WAITING"))
1304 "Fraction of numbers in a column required to make the column align right. 1251 "Custom commands for the agenda.
1305In a column all non-white fields are considered. If at least this 1252These commands will be offered on the splash screen displayed by the
1306fraction of fields is matched by `org-table-number-fraction', 1253agenda dispatcher \\[org-agenda]. Each entry is a list of 3 items:
1307alignment to the right border applies."
1308 :group 'org-table
1309 :type 'number)
1310 1254
1311(defcustom org-export-highlight-first-table-line t 1255key The key (a single char as a string) to be associated with the command.
1312 "Non-nil means, highlight the first table line. 1256type The command type, any of the following symbols:
1313In HTML export, this means use <th> instead of <td>. 1257 todo Entries with a specific TODO keyword, in all agenda files.
1314In tables created with table.el, this applies to the first table line. 1258 tags Tags match in all agenda files.
1315In Org-mode tables, all lines before the first horizontal separator 1259 todo-tree Sparse tree of specific TODO keyword in *current* file.
1316line will be formatted with <th> tags." 1260 tags-tree Sparse tree with all tags matches in *current* file.
1317 :group 'org-table 1261 occur-tree Occur sparse tree for current file.
1262match What to search for:
1263 - a single keyword for TODO keyword searches
1264 - a tags match expression for tags searches
1265 - a regular expression for occur searches"
1266 :group 'org-agenda
1267 :type '(repeat
1268 (list (string :tag "Key")
1269 (choice :tag "Type"
1270 (const :tag "Tags search in all agenda files" tags)
1271 (const :tag "TODO keyword search in all agenda files" todo)
1272 (const :tag "Tags sparse tree in current buffer" tags-tree)
1273 (const :tag "TODO keyword tree in current buffer" todo-tree)
1274 (const :tag "Occur tree in current buffer" occur-tree))
1275 (string :tag "Match"))))
1276
1277(defcustom org-agenda-include-all-todo t
1278 "Non-nil means, the agenda will always contain all TODO entries.
1279When nil, date-less entries will only be shown if `org-agenda' is called
1280with a prefix argument.
1281When non-nil, the TODO entries will be listed at the top of the agenda, before
1282the entries for specific days."
1283 :group 'org-agenda
1318 :type 'boolean) 1284 :type 'boolean)
1319 1285
1320(defcustom org-table-tab-recognizes-table.el t 1286(defcustom org-agenda-include-diary nil
1321 "Non-nil means, TAB will automatically notice a table.el table. 1287 "If non-nil, include in the agenda entries from the Emacs Calendar's diary."
1322When it sees such a table, it moves point into it and - if necessary - 1288 :group 'org-agenda
1323calls `table-recognize-table'."
1324 :group 'org-table
1325 :type 'boolean) 1289 :type 'boolean)
1326 1290
1327(defgroup org-table-calculation nil 1291(defcustom org-calendar-to-agenda-key [?c]
1328 "Options concerning tables in Org-mode." 1292 "The key to be installed in `calendar-mode-map' for switching to the agenda.
1329 :tag "Org Table Calculation" 1293The command `org-calendar-goto-agenda' will be bound to this key. The
1330 :group 'org) 1294default is the character `c' because then `c' can be used to switch back and
1295forth between agenda and calendar."
1296 :group 'org-agenda
1297 :type 'sexp)
1331 1298
1332(defcustom org-table-copy-increment t 1299(defgroup org-agenda-window-setup nil
1333 "Non-nil means, increment when copying current field with \\[org-table-copy-down]." 1300 "Options concerning setting up the Agenda window in Org Mode."
1334 :group 'org-table-calculation 1301 :tag "Org Agenda Window Setup"
1302 :group 'org-agenda)
1303
1304(defcustom org-select-timeline-window t
1305 "Non-nil means, after creating a timeline, move cursor into Timeline window.
1306When nil, cursor will remain in the current window."
1307 :group 'org-agenda-window-setup
1335 :type 'boolean) 1308 :type 'boolean)
1336 1309
1337(defcustom org-calc-default-modes 1310(defcustom org-select-agenda-window t
1338 '(calc-internal-prec 12 1311 "Non-nil means, after creating an agenda, move cursor into Agenda window.
1339 calc-float-format (float 5) 1312When nil, cursor will remain in the current window."
1340 calc-angle-mode deg 1313 :group 'org-agenda-window-setup
1341 calc-prefer-frac nil 1314 :type 'boolean)
1342 calc-symbolic-mode nil
1343 calc-date-format (YYYY "-" MM "-" DD " " Www (" " HH ":" mm))
1344 calc-display-working-message t
1345 )
1346 "List with Calc mode settings for use in calc-eval for table formulas.
1347The list must contain alternating symbols (Calc modes variables and values).
1348Don't remove any of the default settings, just change the values. Org-mode
1349relies on the variables to be present in the list."
1350 :group 'org-table-calculation
1351 :type 'plist)
1352 1315
1353(defcustom org-table-formula-evaluate-inline t 1316(defcustom org-fit-agenda-window t
1354 "Non-nil means, TAB and RET evaluate a formula in current table field. 1317 "Non-nil means, change window size of agenda to fit content."
1355If the current field starts with an equal sign, it is assumed to be a formula 1318 :group 'org-agenda-window-setup
1356which should be evaluated as described in the manual and in the documentation
1357string of the command `org-table-eval-formula'. This feature requires the
1358Emacs calc package.
1359When this variable is nil, formula calculation is only available through
1360the command \\[org-table-eval-formula]."
1361 :group 'org-table-calculation
1362 :type 'boolean) 1319 :type 'boolean)
1363 1320
1321(defgroup org-agenda-display nil
1322 "Options concerning what to display initially in Agenda."
1323 :tag "Org Agenda Display"
1324 :group 'org-agenda)
1364 1325
1365(defcustom org-table-formula-use-constants t 1326(defcustom org-agenda-show-all-dates t
1366 "Non-nil means, interpret constants in formulas in tables. 1327 "Non-nil means, `org-agenda' shows every day in the selected range.
1367A constant looks like `$c' or `$Grav' and will be replaced before evaluation 1328When nil, only the days which actually have entries are shown."
1368by the value given in `org-table-formula-constants', or by a value obtained 1329 :group 'org-agenda-display
1369from the `constants.el' package."
1370 :group 'org-table-calculation
1371 :type 'boolean) 1330 :type 'boolean)
1372 1331
1373(defcustom org-table-formula-constants nil 1332(defcustom org-agenda-start-on-weekday 1
1374 "Alist with constant names and values, for use in table formulas. 1333 "Non-nil means, start the overview always on the specified weekday.
1375The car of each element is a name of a constant, without the `$' before it. 13340 denotes Sunday, 1 denotes Monday etc.
1376The cdr is the value as a string. For example, if you'd like to use the 1335When nil, always start on the current day."
1377speed of light in a formula, you would configure 1336 :group 'org-agenda-display
1337 :type '(choice (const :tag "Today" nil)
1338 (number :tag "Weekday No.")))
1378 1339
1379 (setq org-table-formula-constants '((\"c\" . \"299792458.\"))) 1340(defcustom org-agenda-ndays 7
1341 "Number of days to include in overview display.
1342Should be 1 or 7."
1343 :group 'org-agenda-display
1344 :type 'number)
1380 1345
1381and then use it in an equation like `$1*$c'." 1346(defcustom org-agenda-use-time-grid t
1382 :group 'org-table-calculation 1347 "Non-nil means, show a time grid in the agenda schedule.
1348A time grid is a set of lines for specific times (like every two hours between
13498:00 and 20:00). The items scheduled for a day at specific times are
1350sorted in between these lines.
1351For details about when the grid will be shown, and what it will look like, see
1352the variable `org-agenda-time-grid'."
1353 :group 'org-agenda-display
1354 :type 'boolean)
1355
1356(defcustom org-agenda-time-grid
1357 '((daily today require-timed)
1358 "----------------"
1359 (800 1000 1200 1400 1600 1800 2000))
1360
1361 "The settings for time grid for agenda display.
1362This is a list of three items. The first item is again a list. It contains
1363symbols specifying conditions when the grid should be displayed:
1364
1365 daily if the agenda shows a single day
1366 weekly if the agenda shows an entire week
1367 today show grid on current date, independent of daily/weekly display
1368 require-timed show grid only if at least on item has a time specification
1369
1370The second item is a string which will be places behing the grid time.
1371
1372The third item is a list of integers, indicating the times that should have
1373a grid line."
1374 :group 'org-agenda-display
1375 :type
1376 '(list
1377 (set :greedy t :tag "Grid Display Options"
1378 (const :tag "Show grid in single day agenda display" daily)
1379 (const :tag "Show grid in weekly agenda display" weekly)
1380 (const :tag "Always show grid for today" today)
1381 (const :tag "Show grid only if any timed entries are present"
1382 require-timed)
1383 (const :tag "Skip grid times already present in an entry"
1384 remove-match))
1385 (string :tag "Grid String")
1386 (repeat :tag "Grid Times" (integer :tag "Time"))))
1387
1388(defcustom org-agenda-sorting-strategy '(time-up category-keep priority-down)
1389 "Sorting structure for the agenda items of a single day.
1390This is a list of symbols which will be used in sequence to determine
1391if an entry should be listed before another entry. The following
1392symbols are recognized:
1393
1394time-up Put entries with time-of-day indications first, early first
1395time-down Put entries with time-of-day indications first, late first
1396category-keep Keep the default order of categories, corresponding to the
1397 sequence in `org-agenda-files'.
1398category-up Sort alphabetically by category, A-Z.
1399category-down Sort alphabetically by category, Z-A.
1400priority-up Sort numerically by priority, high priority last.
1401priority-down Sort numerically by priority, high priority first.
1402
1403The different possibilities will be tried in sequence, and testing stops
1404if one comparison returns a \"not-equal\". For example, the default
1405 '(time-up category-keep priority-down)
1406means: Pull out all entries having a specified time of day and sort them,
1407in order to make a time schedule for the current day the first thing in the
1408agenda listing for the day. Of the entries without a time indication, keep
1409the grouped in categories, don't sort the categories, but keep them in
1410the sequence given in `org-agenda-files'. Within each category sort by
1411priority.
1412
1413Leaving out `category-keep' would mean that items will be sorted across
1414categories by priority."
1415 :group 'org-agenda-display
1383 :type '(repeat 1416 :type '(repeat
1384 (cons (string :tag "name") 1417 (choice
1385 (string :tag "value")))) 1418 (const time-up)
1419 (const time-down)
1420 (const category-keep)
1421 (const category-up)
1422 (const category-down)
1423 (const priority-up)
1424 (const priority-down))))
1386 1425
1387(defcustom org-table-formula-numbers-only nil 1426(defcustom org-sort-agenda-notime-is-late t
1388 "Non-nil means, calculate only with numbers in table formulas. 1427 "Non-nil means, items without time are considered late.
1389Then all input fields will be converted to a number, and the result 1428This is only relevant for sorting. When t, items which have no explicit
1390must also be a number. When nil, calc's full potential is available 1429time like 15:30 will be considered as 24:01, i.e. later than any items which
1391in table calculations, including symbolics etc." 1430do have a time. When nil, the default time is before 0:00. You can use this
1392 :group 'org-table-calculation 1431option to decide if the schedule for today should come before or after timeless
1432agenda entries."
1433 :group 'org-agenda-display
1393 :type 'boolean) 1434 :type 'boolean)
1394 1435
1395(defcustom org-table-allow-automatic-line-recalculation t 1436
1396 "Non-nil means, lines marked with |#| or |*| will be recomputed automatically. 1437(defgroup org-agenda-prefix nil
1397Automatically means, when TAB or RET or C-c C-c are pressed in the line." 1438 "Options concerning the entry prefix in the Org-mode agenda display."
1398 :group 'org-table-calculation 1439 :tag "Org Agenda Prefix"
1399 :type 'boolean) 1440 :group 'org-agenda)
1441
1442(defcustom org-agenda-prefix-format " %-12:c%?-12t% s"
1443 "Format specification for the prefix of items in the agenda buffer.
1444This format works similar to a printf format, with the following meaning:
1445
1446 %c the category of the item, \"Diary\" for entries from the diary, or
1447 as given by the CATEGORY keyword or derived from the file name.
1448 %T the first tag of the item.
1449 %t the time-of-day specification if one applies to the entry, in the
1450 format HH:MM
1451 %s Scheduling/Deadline information, a short string
1452
1453All specifiers work basically like the standard `%s' of printf, but may
1454contain two additional characters: A question mark just after the `%' and
1455a whitespace/punctuation character just before the final letter.
1456
1457If the first character after `%' is a question mark, the entire field
1458will only be included if the corresponding value applies to the
1459current entry. This is useful for fields which should have fixed
1460width when present, but zero width when absent. For example,
1461\"%?-12t\" will result in a 12 character time field if a time of the
1462day is specified, but will completely disappear in entries which do
1463not contain a time.
1464
1465If there is punctuation or whitespace character just before the final
1466format letter, this character will be appended to the field value if
1467the value is not empty. For example, the format \"%-12:c\" leads to
1468\"Diary: \" if the category is \"Diary\". If the category were be
1469empty, no additional colon would be interted.
1470
1471The default value of this option is \" %-12:c%?-12t% s\", meaning:
1472- Indent the line with two space characters
1473- Give the category in a 12 chars wide field, padded with whitespace on
1474 the right (because of `-'). Append a colon if there is a category
1475 (because of `:').
1476- If there is a time-of-day, put it into a 12 chars wide field. If no
1477 time, don't put in an empty field, just skip it (because of '?').
1478- Finally, put the scheduling information and append a whitespace.
1479
1480As another example, if you don't want the time-of-day of entries in
1481the prefix, you could use:
1482
1483 (setq org-agenda-prefix-format \" %-11:c% s\")
1484
1485See also the variables `org-agenda-remove-times-when-in-prefix' and
1486`org-agenda-remove-tags-when-in-prefix'."
1487 :type 'string
1488 :group 'org-agenda-prefix)
1489
1490(defcustom org-timeline-prefix-format " % s"
1491 "Like `org-agenda-prefix-format', but for the timeline of a single file."
1492 :type 'string
1493 :group 'org-agenda-prefix)
1494
1495(defvar org-prefix-format-compiled nil
1496 "The compiled version of the most recently used prefix format.
1497Depending on which command was used last, this may be the compiled version
1498of `org-agenda-prefix-format' or `org-timeline-prefix-format'.")
1499
1500;; FIXME: There seem to be situations where this does no work.
1501(defcustom org-agenda-remove-times-when-in-prefix t
1502 "Non-nil means, remove duplicate time specifications in agenda items.
1503When the format `org-agenda-prefix-format' contains a `%t' specifier, a
1504time-of-day specification in a headline or diary entry is extracted and
1505placed into the prefix. If this option is non-nil, the original specification
1506\(a timestamp or -range, or just a plain time(range) specification like
150711:30-4pm) will be removed for agenda display. This makes the agenda less
1508cluttered.
1509The option can be t or nil. It may also be the symbol `beg', indicating
1510that the time should only be removed what it is located at the beginning of
1511the headline/diary entry."
1512 :group 'org-agenda-prefix
1513 :type '(choice
1514 (const :tag "Always" t)
1515 (const :tag "Never" nil)
1516 (const :tag "When at beginning of entry" beg)))
1517
1518(defcustom org-agenda-remove-tags-when-in-prefix nil
1519 "Non-nil means, remove the tags from the headline copy in the agenda.
1520When this is the symbol `prefix', only remove tags when
1521`org-agenda-prefix-format' contains a `%T' specifier."
1522 :group 'org-agenda-prefix
1523 :type '(choice
1524 (const :tag "Always" t)
1525 (const :tag "Never" nil)
1526 (const :tag "When prefix format contains %T" prefix)))
1400 1527
1401(defgroup org-export nil 1528(defgroup org-export nil
1402 "Options for exporting org-listings." 1529 "Options for exporting org-listings."
1403 :tag "Org Export" 1530 :tag "Org Export"
1404 :group 'org) 1531 :group 'org)
1405 1532
1533(defgroup org-export-general nil
1534 "General options for exporting Org-mode files."
1535 :tag "Org Export General"
1536 :group 'org-export)
1537
1406(defcustom org-export-language-setup 1538(defcustom org-export-language-setup
1407 '(("en" "Author" "Date" "Table of Contents") 1539 '(("en" "Author" "Date" "Table of Contents")
1408 ("da" "Ophavsmand" "Dato" "Indhold") 1540 ("da" "Ophavsmand" "Dato" "Indhold")
@@ -1416,7 +1548,7 @@ Automatically means, when TAB or RET or C-c C-c are pressed in the line."
1416 "Terms used in export text, translated to different languages. 1548 "Terms used in export text, translated to different languages.
1417Use the variable `org-export-default-language' to set the language, 1549Use the variable `org-export-default-language' to set the language,
1418or use the +OPTION lines for a per-file setting." 1550or use the +OPTION lines for a per-file setting."
1419 :group 'org-export 1551 :group 'org-export-general
1420 :type '(repeat 1552 :type '(repeat
1421 (list 1553 (list
1422 (string :tag "HTML language tag") 1554 (string :tag "HTML language tag")
@@ -1427,53 +1559,7 @@ or use the +OPTION lines for a per-file setting."
1427(defcustom org-export-default-language "en" 1559(defcustom org-export-default-language "en"
1428 "The default language of HTML export, as a string. 1560 "The default language of HTML export, as a string.
1429This should have an association in `org-export-language-setup'." 1561This should have an association in `org-export-language-setup'."
1430 :group 'org-export 1562 :group 'org-export-general
1431 :type 'string)
1432
1433(defcustom org-export-html-style
1434"<style type=\"text/css\">
1435 html {
1436 font-family: Times, serif;
1437 font-size: 12pt;
1438 }
1439 .title { text-align: center; }
1440 .todo, .deadline { color: red; }
1441 .done { color: green; }
1442 .target { background-color: lavender; }
1443 pre {
1444 border: 1pt solid #AEBDCC;
1445 background-color: #F3F5F7;
1446 padding: 5pt;
1447 font-family: courier, monospace;
1448 }
1449 table { border-collapse: collapse; }
1450 td, th {
1451 vertical-align: top;
1452 border: 1pt solid #ADB9CC;
1453 }
1454</style>"
1455 "The default style specification for exported HTML files.
1456Since there are different ways of setting style information, this variable
1457needs to contain the full HTML structure to provide a style, including the
1458surrounding HTML tags. The style specifications should include definitions
1459for new classes todo, done, title, and deadline. For example, legal values
1460would be:
1461
1462 <style type=\"text/css\">
1463 p { font-weight: normal; color: gray; }
1464 h1 { color: black; }
1465 .title { text-align: center; }
1466 .todo, .deadline { color: red; }
1467 .done { color: green; }
1468 </style>
1469
1470or, if you want to keep the style in a file,
1471
1472 <link rel=\"stylesheet\" type=\"text/css\" href=\"mystyles.css\">
1473
1474As the value of this option simply gets inserted into the HTML <head> header,
1475you can \"misuse\" it to add arbitrary text to the header."
1476 :group 'org-export
1477 :type 'string) 1563 :type 'string)
1478 1564
1479(defcustom org-export-headline-levels 3 1565(defcustom org-export-headline-levels 3
@@ -1483,14 +1569,14 @@ Note that a numeric prefix argument to an exporter function overrides
1483this setting. 1569this setting.
1484 1570
1485This option can also be set with the +OPTIONS line, e.g. \"H:2\"." 1571This option can also be set with the +OPTIONS line, e.g. \"H:2\"."
1486 :group 'org-export 1572 :group 'org-export-general
1487 :type 'number) 1573 :type 'number)
1488 1574
1489(defcustom org-export-with-section-numbers t 1575(defcustom org-export-with-section-numbers t
1490 "Non-nil means, add section numbers to headlines when exporting. 1576 "Non-nil means, add section numbers to headlines when exporting.
1491 1577
1492This option can also be set with the +OPTIONS line, e.g. \"num:t\"." 1578This option can also be set with the +OPTIONS line, e.g. \"num:t\"."
1493 :group 'org-export 1579 :group 'org-export-general
1494 :type 'boolean) 1580 :type 'boolean)
1495 1581
1496(defcustom org-export-with-toc t 1582(defcustom org-export-with-toc t
@@ -1503,30 +1589,13 @@ ASCII export, and with red color in HTML output.
1503In HTML output, the TOC will be clickable. 1589In HTML output, the TOC will be clickable.
1504 1590
1505This option can also be set with the +OPTIONS line, e.g. \"toc:nil\"." 1591This option can also be set with the +OPTIONS line, e.g. \"toc:nil\"."
1506 :group 'org-export 1592 :group 'org-export-general
1507 :type 'boolean) 1593 :type 'boolean)
1508 1594
1509(defcustom org-export-plain-list-max-depth 20 1595(defcustom org-export-mark-todo-in-toc nil
1510 "Maximum depth of hand-formatted lists in HTML export. 1596 "Non-nil means, mark TOC lines that contain any open TODO items."
1511 1597 :group 'org-export-general
1512Org-mode parses hand-formatted enumeration and bullet lists and 1598 :type 'boolean)
1513transforms them to HTML open export. Different indentation of the
1514bullet or number indicates different list nesting levels. To avoid
1515confusion, only a single level is allowed by default. When this is
1516larger than 1, deeper indentation leads to deeper list nesting. For
1517example, the default value of 3 allows the following list to be
1518formatted correctly in HTML:
1519
1520 * Fruit
1521 - Apple
1522 - Banana
1523 1. from Africa
1524 2. from South America
1525 - Pineapple
1526 * Bread
1527 * Dairy products"
1528 :group 'org-export
1529 :type 'integer)
1530 1599
1531(defcustom org-export-preserve-breaks nil 1600(defcustom org-export-preserve-breaks nil
1532 "Non-nil means, preserve all line breaks when exporting. 1601 "Non-nil means, preserve all line breaks when exporting.
@@ -1534,24 +1603,57 @@ Normally, in HTML output paragraphs will be reformatted. In ASCII
1534export, line breaks will always be preserved, regardless of this variable. 1603export, line breaks will always be preserved, regardless of this variable.
1535 1604
1536This option can also be set with the +OPTIONS line, e.g. \"\\n:t\"." 1605This option can also be set with the +OPTIONS line, e.g. \"\\n:t\"."
1537 :group 'org-export 1606 :group 'org-export-general
1538 :type 'boolean) 1607 :type 'boolean)
1539 1608
1540(defcustom org-export-html-inline-images t 1609(defgroup org-export-translation nil
1541 "Non-nil means, inline images into exported HTML pages. 1610 "Options for translating special ascii sequences for the export backends."
1542The link will still be to the original location of the image file. 1611 :tag "Org Export Translation"
1543So if you are moving the page, lets say to your public HTML site, 1612 :group 'org-export)
1544you will have to move the image and maybe change the link." 1613
1545 :group 'org-export 1614(defcustom org-export-with-emphasize t
1615 "Non-nil means, interpret *word*, /word/, and _word_ as emphasized text.
1616If the export target supports emphasizing text, the word will be
1617typeset in bold, italic, or underlined, respectively. Works only for
1618single words, but you can say: I *really* *mean* *this*.
1619Not all export backends support this.
1620
1621This option can also be set with the +OPTIONS line, e.g. \"*:nil\"."
1622 :group 'org-export-translation
1546 :type 'boolean) 1623 :type 'boolean)
1547 1624
1548(defcustom org-export-html-expand t 1625(defcustom org-export-with-sub-superscripts t
1549 "Non-nil means, for HTML export, treat @<...> as HTML tag. 1626 "Non-nil means, interpret \"_\" and \"^\" for export.
1550When nil, these tags will be exported as plain text and therefore 1627When this option is turned on, you can use TeX-like syntax for sub- and
1551not be interpreted by a browser. 1628superscripts. Several characters after \"_\" or \"^\" will be
1629considered as a single item - so grouping with {} is normally not
1630needed. For example, the following things will be parsed as single
1631sub- or superscripts.
1552 1632
1553This option can also be set with the +OPTIONS line, e.g. \"@:nil\"." 1633 10^24 or 10^tau several digits will be considered 1 item.
1554 :group 'org-export 1634 10^-12 or 10^-tau a leading sign with digits or a word
1635 x^2-y^3 will be read as x^2 - y^3, because items are
1636 terminated by almost any nonword/nondigit char.
1637 x_{i^2} or x^(2-i) braces or parenthesis do grouping.
1638
1639Still, ambiguity is possible - so when in doubt use {} to enclose the
1640sub/superscript.
1641Not all export backends support this, but HTML does.
1642
1643This option can also be set with the +OPTIONS line, e.g. \"^:nil\"."
1644 :group 'org-export-translation
1645 :type 'boolean)
1646
1647(defcustom org-export-with-TeX-macros t
1648 "Non-nil means, interpret simple TeX-like macros when exporting.
1649For example, HTML export converts \\alpha to &alpha; and \\AA to &Aring;.
1650No only real TeX macros will work here, but the standard HTML entities
1651for math can be used as macro names as well. For a list of supported
1652names in HTML export, see the constant `org-html-entities'.
1653Not all export backends support this.
1654
1655This option can also be set with the +OPTIONS line, e.g. \"TeX:nil\"."
1656 :group 'org-export-translation
1555 :type 'boolean) 1657 :type 'boolean)
1556 1658
1557(defcustom org-export-with-fixed-width t 1659(defcustom org-export-with-fixed-width t
@@ -1561,13 +1663,24 @@ example:
1561 : ;; Some Lisp examples 1663 : ;; Some Lisp examples
1562 : (while (defc cnt) 1664 : (while (defc cnt)
1563 : (ding)) 1665 : (ding))
1564will be looking just like this in also HTML. In ASCII export, this option 1666will be looking just like this in also HTML. See also the QUOTE keyword.
1565has no effect. 1667Not all export backends support this.
1566 1668
1567This option can also be set with the +OPTIONS line, e.g. \"::nil\"." 1669This option can also be set with the +OPTIONS line, e.g. \"::nil\"."
1568 :group 'org-export 1670 :group 'org-export-translation
1569 :type 'boolean) 1671 :type 'boolean)
1570 1672
1673(defcustom org-match-sexp-depth 3
1674 "Number of stacked braces for sub/superscript matching.
1675This has to be set before loading org.el to be effective."
1676 :group 'org-export-translation
1677 :type 'integer)
1678
1679(defgroup org-export-tables nil
1680 "Options for exporting tables in Org-mode."
1681 :tag "Org Export Tables"
1682 :group 'org-export)
1683
1571(defcustom org-export-with-tables t 1684(defcustom org-export-with-tables t
1572 "If non-nil, lines starting with \"|\" define a table. 1685 "If non-nil, lines starting with \"|\" define a table.
1573For example: 1686For example:
@@ -1576,10 +1689,19 @@ For example:
1576 |-------------+----------+-----------| 1689 |-------------+----------+-----------|
1577 | Arthur Dent | England | 29.2.2100 | 1690 | Arthur Dent | England | 29.2.2100 |
1578 1691
1579In ASCII export, this option has no effect. 1692Not all export backends support this.
1580 1693
1581This option can also be set with the +OPTIONS line, e.g. \"|:nil\"." 1694This option can also be set with the +OPTIONS line, e.g. \"|:nil\"."
1582 :group 'org-export 1695 :group 'org-export-tables
1696 :type 'boolean)
1697
1698(defcustom org-export-highlight-first-table-line t
1699 "Non-nil means, highlight the first table line.
1700In HTML export, this means use <th> instead of <td>.
1701In tables created with table.el, this applies to the first table line.
1702In Org-mode tables, all lines before the first horizontal separator
1703line will be formatted with <th> tags."
1704 :group 'org-export-tables
1583 :type 'boolean) 1705 :type 'boolean)
1584 1706
1585(defcustom org-export-table-remove-special-lines t 1707(defcustom org-export-table-remove-special-lines t
@@ -1588,7 +1710,7 @@ This removes the special marking character column from tables that are set
1588up for spreadsheet calculations. It also removes the entire lines 1710up for spreadsheet calculations. It also removes the entire lines
1589marked with `!', `_', or `^'. The lines with `$' are kept, because 1711marked with `!', `_', or `^'. The lines with `$' are kept, because
1590the values of constants may be useful to have." 1712the values of constants may be useful to have."
1591 :group 'org-export 1713 :group 'org-export-tables
1592 :type 'boolean) 1714 :type 'boolean)
1593 1715
1594(defcustom org-export-prefer-native-exporter-for-tables nil 1716(defcustom org-export-prefer-native-exporter-for-tables nil
@@ -1599,112 +1721,151 @@ the table does not use row- or column-spanning). This has the
1599advantage, that the automatic HTML conversions for math symbols and 1721advantage, that the automatic HTML conversions for math symbols and
1600sub/superscripts can be applied. Org-mode's HTML generator is also 1722sub/superscripts can be applied. Org-mode's HTML generator is also
1601much faster." 1723much faster."
1602 :group 'org-export 1724 :group 'org-export-tables
1603 :type 'boolean) 1725 :type 'boolean)
1604 1726
1605(defcustom org-export-html-table-tag 1727(defgroup org-export-ascii nil
1606 "<table border=1 cellspacing=0 cellpadding=6>" 1728 "Options specific for ASCII export of Org-mode files."
1607 "The HTML tag used to start a table. 1729 :tag "Org Export ASCII"
1608This must be a <table> tag, but you may change the options like 1730 :group 'org-export)
1609borders and spacing."
1610 :group 'org-export
1611 :type 'string)
1612 1731
1613(defcustom org-export-with-emphasize t 1732(defcustom org-export-ascii-show-new-buffer t
1614 "Non-nil means, interpret *word*, /word/, and _word_ as emphasized text. 1733 "Non-nil means, popup buffer containing the exported ASCII text.
1615If the export target supports emphasizing text, the word will be 1734Otherwise the buffer will just be saved to a file and stay hidden."
1616typeset in bold, italic, or underlined, respectively. Works only for 1735 :group 'org-export-ascii
1617single words, but you can say: I *really* *mean* *this*.
1618In ASCII export, this option has no effect.
1619
1620This option can also be set with the +OPTIONS line, e.g. \"*:nil\"."
1621 :group 'org-export
1622 :type 'boolean) 1736 :type 'boolean)
1623 1737
1624(defcustom org-match-sexp-depth 3 1738(defgroup org-export-xml nil
1625 "Number of stacked braces for sub/superscript matching. 1739 "Options specific for XML export of Org-mode files."
1626This has to be set before loading org.el to be effective." 1740 :tag "Org Export XML"
1627 :group 'org-export 1741 :group 'org-export)
1628 :type 'integer)
1629 1742
1630;; FIXME: Should () parens be removed as well in sub/superscripts? 1743(defcustom org-export-xml-type 'xoxo ;kw, if we have only one.
1631(defcustom org-export-with-sub-superscripts t 1744 "The kind of XML to be produced by the XML exporter.
1632 "Non-nil means, interpret \"_\" and \"^\" for export. 1745Allowed values are:
1633When this option is turned on, you can use TeX-like syntax for sub- and 1746xoxo The XOXO exporter."
1634superscripts. Several characters after \"_\" or \"^\" will be 1747 :group 'org-export-xml
1635considered as a single item - so grouping with {} is normally not 1748 :type '(choice
1636needed. For example, the following things will be parsed as single 1749 (const :tag "XOXO" xoxo)))
1637sub- or superscripts.
1638 1750
1639 10^24 or 10^tau several digits will be considered 1 item. 1751(defgroup org-export-html nil
1640 10^-12 or 10^-tau a leading sign with digits or a word 1752 "Options specific for HTML export of Org-mode files."
1641 x^2-y^3 will be read as x^2 - y^3, because items are 1753 :tag "Org Export HTML"
1642 terminated by almost any nonword/nondigit char. 1754 :group 'org-export)
1643 x_{i^2} or x^(2-i) braces or parenthesis do grouping.
1644 1755
1645Still, ambiguity is possible - so when in doubt use {} to enclose the 1756(defcustom org-export-html-style
1646sub/superscript. 1757"<style type=\"text/css\">
1647In ASCII export, this option has no effect. 1758 html {
1759 font-family: Times, serif;
1760 font-size: 12pt;
1761 }
1762 .title { text-align: center; }
1763 .todo, .deadline { color: red; }
1764 .done { color: green; }
1765 .target { background-color: lavender; }
1766 pre {
1767 border: 1pt solid #AEBDCC;
1768 background-color: #F3F5F7;
1769 padding: 5pt;
1770 font-family: courier, monospace;
1771 }
1772 table { border-collapse: collapse; }
1773 td, th {
1774 vertical-align: top;
1775 border: 1pt solid #ADB9CC;
1776 }
1777</style>"
1778 "The default style specification for exported HTML files.
1779Since there are different ways of setting style information, this variable
1780needs to contain the full HTML structure to provide a style, including the
1781surrounding HTML tags. The style specifications should include definitions
1782for new classes todo, done, title, and deadline. For example, legal values
1783would be:
1648 1784
1649This option can also be set with the +OPTIONS line, e.g. \"^:nil\"." 1785 <style type=\"text/css\">
1650 :group 'org-export 1786 p { font-weight: normal; color: gray; }
1787 h1 { color: black; }
1788 .title { text-align: center; }
1789 .todo, .deadline { color: red; }
1790 .done { color: green; }
1791 </style>
1792
1793or, if you want to keep the style in a file,
1794
1795 <link rel=\"stylesheet\" type=\"text/css\" href=\"mystyles.css\">
1796
1797As the value of this option simply gets inserted into the HTML <head> header,
1798you can \"misuse\" it to add arbitrary text to the header."
1799 :group 'org-export-html
1800 :type 'string)
1801
1802(defcustom org-export-html-inline-images t
1803 "Non-nil means, inline images into exported HTML pages.
1804The link will still be to the original location of the image file.
1805So if you are moving the page, lets say to your public HTML site,
1806you will have to move the image and maybe change the link."
1807 :group 'org-export-html
1651 :type 'boolean) 1808 :type 'boolean)
1652 1809
1653(defcustom org-export-with-TeX-macros t 1810(defcustom org-export-html-expand t
1654 "Non-nil means, interpret simple TeX-like macros when exporting. 1811 "Non-nil means, for HTML export, treat @<...> as HTML tag.
1655For example, HTML export converts \\alpha to &alpha; and \\AA to &Aring;. 1812When nil, these tags will be exported as plain text and therefore
1656No only real TeX macros will work here, but the standard HTML entities 1813not be interpreted by a browser.
1657for math can be used as macro names as well. For a list of supported
1658names in HTML export, see the constant `org-html-entities'.
1659In ASCII export, this option has no effect.
1660 1814
1661This option can also be set with the +OPTIONS line, e.g. \"TeX:nil\"." 1815This option can also be set with the +OPTIONS line, e.g. \"@:nil\"."
1662 :group 'org-export 1816 :group 'org-export-html
1663 :type 'boolean) 1817 :type 'boolean)
1664 1818
1819(defcustom org-export-html-table-tag
1820 "<table border=1 cellspacing=0 cellpadding=6>"
1821 "The HTML tag used to start a table.
1822This must be a <table> tag, but you may change the options like
1823borders and spacing."
1824 :group 'org-export-html
1825 :type 'string)
1826
1665(defcustom org-export-html-with-timestamp nil 1827(defcustom org-export-html-with-timestamp nil
1666 "If non-nil, write `org-export-html-html-helper-timestamp' 1828 "If non-nil, write `org-export-html-html-helper-timestamp'
1667into the exported HTML text. Otherwise, the buffer will just be saved 1829into the exported HTML text. Otherwise, the buffer will just be saved
1668to a file." 1830to a file."
1669 :group 'org-export 1831 :group 'org-export-html
1670 :type 'boolean) 1832 :type 'boolean)
1671 1833
1672(defcustom org-export-html-html-helper-timestamp 1834(defcustom org-export-html-html-helper-timestamp
1673 "<br><br><hr><p><!-- hhmts start --> <!-- hhmts end -->\n" 1835 "<br><br><hr><p><!-- hhmts start --> <!-- hhmts end -->\n"
1674 "The HTML tag used as timestamp delimiter for HTML-helper-mode." 1836 "The HTML tag used as timestamp delimiter for HTML-helper-mode."
1675 :group 'org-export 1837 :group 'org-export-html
1676 :type 'string) 1838 :type 'string)
1677 1839
1678(defcustom org-export-ascii-show-new-buffer t
1679 "Non-nil means, popup buffer containing the exported ASCII text.
1680Otherwise the buffer will just be saved to a file and stay hidden."
1681 :group 'org-export
1682 :type 'boolean)
1683
1684(defcustom org-export-html-show-new-buffer nil 1840(defcustom org-export-html-show-new-buffer nil
1685 "Non-nil means, popup buffer containing the exported html text. 1841 "Non-nil means, popup buffer containing the exported html text.
1686Otherwise, the buffer will just be saved to a file and stay hidden." 1842Otherwise, the buffer will just be saved to a file and stay hidden."
1687 :group 'org-export 1843 :group 'org-export-html
1688 :type 'boolean) 1844 :type 'boolean)
1689 1845
1846(defgroup org-export-icalendar nil
1847 "Options specific for iCalendar export of Org-mode files."
1848 :tag "Org Export iCalendar"
1849 :group 'org-export)
1850
1690(defcustom org-combined-agenda-icalendar-file "~/org.ics" 1851(defcustom org-combined-agenda-icalendar-file "~/org.ics"
1691 "The file name for the iCalendar file covering all agenda files. 1852 "The file name for the iCalendar file covering all agenda files.
1692This file is created with the command \\[org-export-icalendar-all-agenda-files]." 1853This file is created with the command \\[org-export-icalendar-all-agenda-files]."
1693 :group 'org-export 1854 :group 'org-export-icalendar
1694 :type 'file) 1855 :type 'file)
1695 1856
1696(defcustom org-icalendar-include-todo nil 1857(defcustom org-icalendar-include-todo nil
1697 "Non-nil means, export to iCalendar files should also cover TODO items." 1858 "Non-nil means, export to iCalendar files should also cover TODO items."
1698 :group 'org-export 1859 :group 'org-export-icalendar
1699 :type 'boolean) 1860 :type 'boolean)
1700 1861
1701(defcustom org-icalendar-combined-name "OrgMode" 1862(defcustom org-icalendar-combined-name "OrgMode"
1702 "Calendar name for the combined iCalendar representing all agenda files." 1863 "Calendar name for the combined iCalendar representing all agenda files."
1703 :group 'org-export 1864 :group 'org-export-icalendar
1704 :type 'string) 1865 :type 'string)
1705 1866
1706(defgroup org-font-lock nil 1867(defgroup org-font-lock nil
1707 "Faces and settings for highlighting in Org-mode." 1868 "Font-lock settings for highlighting in Org-mode."
1708 :tag "Org Font Lock" 1869 :tag "Org Font Lock"
1709 :group 'org) 1870 :group 'org)
1710 1871
@@ -1741,16 +1902,19 @@ Changing this variable requires a restart of Emacs to take effect."
1741 :group 'org-font-lock 1902 :group 'org-font-lock
1742 :type 'boolean) 1903 :type 'boolean)
1743 1904
1905(defgroup org-faces nil
1906 "Faces in Org-mode."
1907 :tag "Org Faces"
1908 :group 'org-font-lock)
1909
1744(defface org-hide 1910(defface org-hide
1745 '( 1911 '(
1746 (((type tty) (class color)) (:foreground "white")) 1912 (((type tty) (class color)) (:foreground "white"))
1747 (((class color) (background light)) (:foreground "white")) 1913 (((class color) (background light)) (:foreground "white"))
1748 (((class color) (background dark)) (:foreground "black")) 1914 (((class color) (background dark)) (:foreground "black"))
1749; (((class color) (background light)) (:foreground "grey90"))
1750; (((class color) (background dark)) (:foreground "grey10"))
1751 (t (:inverse-video nil))) 1915 (t (:inverse-video nil)))
1752 "Face used for level 1 headlines." 1916 "Face used for level 1 headlines."
1753 :group 'org-font-lock) 1917 :group 'org-faces)
1754 1918
1755(defface org-level-1 ;; font-lock-function-name-face 1919(defface org-level-1 ;; font-lock-function-name-face
1756 '((((type tty) (class color)) (:foreground "blue" :weight bold)) 1920 '((((type tty) (class color)) (:foreground "blue" :weight bold))
@@ -1758,7 +1922,7 @@ Changing this variable requires a restart of Emacs to take effect."
1758 (((class color) (background dark)) (:foreground "LightSkyBlue")) 1922 (((class color) (background dark)) (:foreground "LightSkyBlue"))
1759 (t (:inverse-video t :bold t))) 1923 (t (:inverse-video t :bold t)))
1760 "Face used for level 1 headlines." 1924 "Face used for level 1 headlines."
1761 :group 'org-font-lock) 1925 :group 'org-faces)
1762 1926
1763(defface org-level-2 ;; font-lock-variable-name-face 1927(defface org-level-2 ;; font-lock-variable-name-face
1764 '((((type tty) (class color)) (:foreground "yellow" :weight light)) 1928 '((((type tty) (class color)) (:foreground "yellow" :weight light))
@@ -1766,7 +1930,7 @@ Changing this variable requires a restart of Emacs to take effect."
1766 (((class color) (background dark)) (:foreground "LightGoldenrod")) 1930 (((class color) (background dark)) (:foreground "LightGoldenrod"))
1767 (t (:bold t :italic t))) 1931 (t (:bold t :italic t)))
1768 "Face used for level 2 headlines." 1932 "Face used for level 2 headlines."
1769 :group 'org-font-lock) 1933 :group 'org-faces)
1770 1934
1771(defface org-level-3 ;; font-lock-keyword-face 1935(defface org-level-3 ;; font-lock-keyword-face
1772 '((((type tty) (class color)) (:foreground "cyan" :weight bold)) 1936 '((((type tty) (class color)) (:foreground "cyan" :weight bold))
@@ -1774,7 +1938,7 @@ Changing this variable requires a restart of Emacs to take effect."
1774 (((class color) (background dark)) (:foreground "Cyan")) 1938 (((class color) (background dark)) (:foreground "Cyan"))
1775 (t (:bold t))) 1939 (t (:bold t)))
1776 "Face used for level 3 headlines." 1940 "Face used for level 3 headlines."
1777 :group 'org-font-lock) 1941 :group 'org-faces)
1778 1942
1779(defface org-level-4 ;; font-lock-comment-face 1943(defface org-level-4 ;; font-lock-comment-face
1780 '((((type tty pc) (class color) (background light)) (:foreground "red")) 1944 '((((type tty pc) (class color) (background light)) (:foreground "red"))
@@ -1783,7 +1947,7 @@ Changing this variable requires a restart of Emacs to take effect."
1783 (((class color) (background dark)) (:foreground "chocolate1")) 1947 (((class color) (background dark)) (:foreground "chocolate1"))
1784 (t (:bold t :italic t))) 1948 (t (:bold t :italic t)))
1785 "Face used for level 4 headlines." 1949 "Face used for level 4 headlines."
1786 :group 'org-font-lock) 1950 :group 'org-faces)
1787 1951
1788(defface org-level-5 ;; font-lock-type-face 1952(defface org-level-5 ;; font-lock-type-face
1789 '((((type tty) (class color)) (:foreground "green")) 1953 '((((type tty) (class color)) (:foreground "green"))
@@ -1791,7 +1955,7 @@ Changing this variable requires a restart of Emacs to take effect."
1791 (((class color) (background dark)) (:foreground "PaleGreen")) 1955 (((class color) (background dark)) (:foreground "PaleGreen"))
1792 (t (:bold t :underline t))) 1956 (t (:bold t :underline t)))
1793 "Face used for level 5 headlines." 1957 "Face used for level 5 headlines."
1794 :group 'org-font-lock) 1958 :group 'org-faces)
1795 1959
1796(defface org-level-6 ;; font-lock-constant-face 1960(defface org-level-6 ;; font-lock-constant-face
1797 '((((type tty) (class color)) (:foreground "magenta")) 1961 '((((type tty) (class color)) (:foreground "magenta"))
@@ -1799,7 +1963,7 @@ Changing this variable requires a restart of Emacs to take effect."
1799 (((class color) (background dark)) (:foreground "Aquamarine")) 1963 (((class color) (background dark)) (:foreground "Aquamarine"))
1800 (t (:bold t :underline t))) 1964 (t (:bold t :underline t)))
1801 "Face used for level 6 headlines." 1965 "Face used for level 6 headlines."
1802 :group 'org-font-lock) 1966 :group 'org-faces)
1803 1967
1804(defface org-level-7 ;; font-lock-builtin-face 1968(defface org-level-7 ;; font-lock-builtin-face
1805 '((((type tty) (class color)) (:foreground "blue" :weight light)) 1969 '((((type tty) (class color)) (:foreground "blue" :weight light))
@@ -1807,7 +1971,7 @@ Changing this variable requires a restart of Emacs to take effect."
1807 (((class color) (background dark)) (:foreground "LightSteelBlue")) 1971 (((class color) (background dark)) (:foreground "LightSteelBlue"))
1808 (t (:bold t))) 1972 (t (:bold t)))
1809 "Face used for level 7 headlines." 1973 "Face used for level 7 headlines."
1810 :group 'org-font-lock) 1974 :group 'org-faces)
1811 1975
1812(defface org-level-8 ;; font-lock-string-face 1976(defface org-level-8 ;; font-lock-string-face
1813 '((((type tty) (class color)) (:foreground "green")) 1977 '((((type tty) (class color)) (:foreground "green"))
@@ -1815,7 +1979,7 @@ Changing this variable requires a restart of Emacs to take effect."
1815 (((class color) (background dark)) (:foreground "LightSalmon")) 1979 (((class color) (background dark)) (:foreground "LightSalmon"))
1816 (t (:italic t))) 1980 (t (:italic t)))
1817 "Face used for level 8 headlines." 1981 "Face used for level 8 headlines."
1818 :group 'org-font-lock) 1982 :group 'org-faces)
1819 1983
1820(defface org-special-keyword ;; font-lock-string-face 1984(defface org-special-keyword ;; font-lock-string-face
1821 '((((type tty) (class color)) (:foreground "green")) 1985 '((((type tty) (class color)) (:foreground "green"))
@@ -1823,7 +1987,7 @@ Changing this variable requires a restart of Emacs to take effect."
1823 (((class color) (background dark)) (:foreground "LightSalmon")) 1987 (((class color) (background dark)) (:foreground "LightSalmon"))
1824 (t (:italic t))) 1988 (t (:italic t)))
1825 "Face used for special keywords." 1989 "Face used for special keywords."
1826 :group 'org-font-lock) 1990 :group 'org-faces)
1827 1991
1828(defface org-warning ;; font-lock-warning-face 1992(defface org-warning ;; font-lock-warning-face
1829 '((((type tty) (class color)) (:foreground "red")) 1993 '((((type tty) (class color)) (:foreground "red"))
@@ -1832,7 +1996,7 @@ Changing this variable requires a restart of Emacs to take effect."
1832; (((class color) (background dark)) (:foreground "Pink" :bold t)) 1996; (((class color) (background dark)) (:foreground "Pink" :bold t))
1833 (t (:inverse-video t :bold t))) 1997 (t (:inverse-video t :bold t)))
1834 "Face for deadlines and TODO keywords." 1998 "Face for deadlines and TODO keywords."
1835 :group 'org-font-lock) 1999 :group 'org-faces)
1836 2000
1837(defface org-headline-done ;; font-lock-string-face 2001(defface org-headline-done ;; font-lock-string-face
1838 '((((type tty) (class color)) (:foreground "green")) 2002 '((((type tty) (class color)) (:foreground "green"))
@@ -1841,9 +2005,9 @@ Changing this variable requires a restart of Emacs to take effect."
1841 (t (:italic t))) 2005 (t (:italic t)))
1842 "Face used to indicate that a headline is DONE. See also the variable 2006 "Face used to indicate that a headline is DONE. See also the variable
1843`org-fontify-done-headline'." 2007`org-fontify-done-headline'."
1844 :group 'org-font-lock) 2008 :group 'org-faces)
1845 2009
1846;; Inheritance does not yet work for xemacs. So we just copy... 2010;; Inheritance does not work for xemacs. So we just copy...
1847 2011
1848(defface org-deadline-announce 2012(defface org-deadline-announce
1849 '((((type tty) (class color)) (:foreground "blue" :weight bold)) 2013 '((((type tty) (class color)) (:foreground "blue" :weight bold))
@@ -1851,7 +2015,7 @@ Changing this variable requires a restart of Emacs to take effect."
1851 (((class color) (background dark)) (:foreground "LightSkyBlue")) 2015 (((class color) (background dark)) (:foreground "LightSkyBlue"))
1852 (t (:inverse-video t :bold t))) 2016 (t (:inverse-video t :bold t)))
1853 "Face for upcoming deadlines." 2017 "Face for upcoming deadlines."
1854 :group 'org-font-lock) 2018 :group 'org-faces)
1855 2019
1856(defface org-scheduled-today 2020(defface org-scheduled-today
1857 '((((type tty) (class color)) (:foreground "green")) 2021 '((((type tty) (class color)) (:foreground "green"))
@@ -1859,7 +2023,7 @@ Changing this variable requires a restart of Emacs to take effect."
1859 (((class color) (background dark)) (:foreground "PaleGreen")) 2023 (((class color) (background dark)) (:foreground "PaleGreen"))
1860 (t (:bold t :underline t))) 2024 (t (:bold t :underline t)))
1861 "Face for items scheduled for a certain day." 2025 "Face for items scheduled for a certain day."
1862 :group 'org-font-lock) 2026 :group 'org-faces)
1863 2027
1864(defface org-scheduled-previously 2028(defface org-scheduled-previously
1865 '((((type tty pc) (class color) (background light)) (:foreground "red")) 2029 '((((type tty pc) (class color) (background light)) (:foreground "red"))
@@ -1868,7 +2032,7 @@ Changing this variable requires a restart of Emacs to take effect."
1868 (((class color) (background dark)) (:foreground "chocolate1")) 2032 (((class color) (background dark)) (:foreground "chocolate1"))
1869 (t (:bold t :italic t))) 2033 (t (:bold t :italic t)))
1870 "Face for items scheduled previously, and not yet done." 2034 "Face for items scheduled previously, and not yet done."
1871 :group 'org-font-lock) 2035 :group 'org-faces)
1872 2036
1873(defface org-formula 2037(defface org-formula
1874 '((((type tty pc) (class color) (background light)) (:foreground "red")) 2038 '((((type tty pc) (class color) (background light)) (:foreground "red"))
@@ -1877,23 +2041,23 @@ Changing this variable requires a restart of Emacs to take effect."
1877 (((class color) (background dark)) (:foreground "chocolate1")) 2041 (((class color) (background dark)) (:foreground "chocolate1"))
1878 (t (:bold t :italic t))) 2042 (t (:bold t :italic t)))
1879 "Face for formulas." 2043 "Face for formulas."
1880 :group 'org-font-lock) 2044 :group 'org-faces)
1881 2045
1882(defface org-link 2046(defface org-link
1883 '((((type tty) (class color)) (:foreground "cyan" :weight bold)) 2047 '((((type tty) (class color)) (:foreground "cyan" :weight bold))
1884 (((class color) (background light)) (:foreground "Purple")) 2048 (((class color) (background light)) (:foreground "Purple" :underline t))
1885 (((class color) (background dark)) (:foreground "Cyan")) 2049 (((class color) (background dark)) (:foreground "Cyan" :underline t))
1886 (t (:bold t))) 2050 (t (:bold t)))
1887 "Face for links." 2051 "Face for links."
1888 :group 'org-font-lock) 2052 :group 'org-faces)
1889 2053
1890(defface org-tag 2054(defface org-tag
1891 '((((type tty) (class color)) (:foreground "cyan" :weight bold)) 2055 '((((type tty) (class color)) (:weight bold))
1892 (((class color) (background light)) (:foreground "Purple" :weight bold)) 2056 (((class color) (background light)) (:weight bold))
1893 (((class color) (background dark)) (:foreground "Cyan" :weight bold)) 2057 (((class color) (background dark)) (:weight bold))
1894 (t (:bold t))) 2058 (t (:bold t)))
1895 "Face for tags." 2059 "Face for tags."
1896 :group 'org-font-lock) 2060 :group 'org-faces)
1897 2061
1898(defface org-done ;; font-lock-type-face 2062(defface org-done ;; font-lock-type-face
1899 '((((type tty) (class color)) (:foreground "green")) 2063 '((((type tty) (class color)) (:foreground "green"))
@@ -1901,7 +2065,7 @@ Changing this variable requires a restart of Emacs to take effect."
1901 (((class color) (background dark)) (:foreground "PaleGreen" :bold t)) 2065 (((class color) (background dark)) (:foreground "PaleGreen" :bold t))
1902 (t (:bold t :underline t))) 2066 (t (:bold t :underline t)))
1903 "Face used for DONE." 2067 "Face used for DONE."
1904 :group 'org-font-lock) 2068 :group 'org-faces)
1905 2069
1906(defface org-table ;; font-lock-function-name-face 2070(defface org-table ;; font-lock-function-name-face
1907 '((((type tty) (class color)) (:foreground "blue" :weight bold)) 2071 '((((type tty) (class color)) (:foreground "blue" :weight bold))
@@ -1909,7 +2073,7 @@ Changing this variable requires a restart of Emacs to take effect."
1909 (((class color) (background dark)) (:foreground "LightSkyBlue")) 2073 (((class color) (background dark)) (:foreground "LightSkyBlue"))
1910 (t (:inverse-video t :bold t))) 2074 (t (:inverse-video t :bold t)))
1911 "Face used for tables." 2075 "Face used for tables."
1912 :group 'org-font-lock) 2076 :group 'org-faces)
1913 2077
1914(defface org-time-grid ;; font-lock-variable-name-face 2078(defface org-time-grid ;; font-lock-variable-name-face
1915 '((((type tty) (class color)) (:foreground "yellow" :weight light)) 2079 '((((type tty) (class color)) (:foreground "yellow" :weight light))
@@ -1917,7 +2081,7 @@ Changing this variable requires a restart of Emacs to take effect."
1917 (((class color) (background dark)) (:foreground "LightGoldenrod")) 2081 (((class color) (background dark)) (:foreground "LightGoldenrod"))
1918 (t (:bold t :italic t))) 2082 (t (:bold t :italic t)))
1919 "Face used for time grids." 2083 "Face used for time grids."
1920 :group 'org-font-lock) 2084 :group 'org-faces)
1921 2085
1922(defvar org-level-faces 2086(defvar org-level-faces
1923 '(org-level-1 org-level-2 org-level-3 org-level-4 2087 '(org-level-1 org-level-2 org-level-3 org-level-4
@@ -1925,6 +2089,51 @@ Changing this variable requires a restart of Emacs to take effect."
1925 )) 2089 ))
1926(defvar org-n-levels (length org-level-faces)) 2090(defvar org-n-levels (length org-level-faces))
1927 2091
2092
2093;; Variables for pre-computed regular expressions, all buffer local
2094(defvar org-done-string nil
2095 "The last string in `org-todo-keywords', indicating an item is DONE.")
2096(make-variable-buffer-local 'org-done-string)
2097(defvar org-todo-regexp nil
2098 "Matches any of the TODO state keywords.")
2099(make-variable-buffer-local 'org-todo-regexp)
2100(defvar org-not-done-regexp nil
2101 "Matches any of the TODO state keywords except the last one.")
2102(make-variable-buffer-local 'org-not-done-regexp)
2103(defvar org-todo-line-regexp nil
2104 "Matches a headline and puts TODO state into group 2 if present.")
2105(make-variable-buffer-local 'org-todo-line-regexp)
2106(defvar org-nl-done-regexp nil
2107 "Matches newline followed by a headline with the DONE keyword.")
2108(make-variable-buffer-local 'org-nl-done-regexp)
2109(defvar org-looking-at-done-regexp nil
2110 "Matches the DONE keyword a point.")
2111(make-variable-buffer-local 'org-looking-at-done-regexp)
2112(defvar org-todo-kwd-priority-p nil
2113 "Do TODO items have priorities?")
2114(make-variable-buffer-local 'org-todo-kwd-priority-p)
2115(defvar org-todo-kwd-max-priority nil
2116 "Maximum priority of TODO items.")
2117(make-variable-buffer-local 'org-todo-kwd-max-priority)
2118(defvar org-ds-keyword-length 12
2119 "Maximum length of the Deadline and SCHEDULED keywords.")
2120(make-variable-buffer-local 'org-ds-keyword-length)
2121(defvar org-deadline-regexp nil
2122 "Matches the DEADLINE keyword.")
2123(make-variable-buffer-local 'org-deadline-regexp)
2124(defvar org-deadline-time-regexp nil
2125 "Matches the DEADLINE keyword together with a time stamp.")
2126(make-variable-buffer-local 'org-deadline-time-regexp)
2127(defvar org-deadline-line-regexp nil
2128 "Matches the DEADLINE keyword and the rest of the line.")
2129(make-variable-buffer-local 'org-deadline-line-regexp)
2130(defvar org-scheduled-regexp nil
2131 "Matches the SCHEDULED keyword.")
2132(make-variable-buffer-local 'org-scheduled-regexp)
2133(defvar org-scheduled-time-regexp nil
2134 "Matches the SCHEDULED keyword together with a time stamp.")
2135(make-variable-buffer-local 'org-scheduled-time-regexp)
2136
1928(defun org-set-regexps-and-options () 2137(defun org-set-regexps-and-options ()
1929 "Precompute regular expressions for current buffer." 2138 "Precompute regular expressions for current buffer."
1930 (when (eq major-mode 'org-mode) 2139 (when (eq major-mode 'org-mode)
@@ -1962,6 +2171,8 @@ Changing this variable requires a restart of Emacs to take effect."
1962 ("showstars" org-hide-leading-stars nil) 2171 ("showstars" org-hide-leading-stars nil)
1963 ("odd" org-odd-levels-only t) 2172 ("odd" org-odd-levels-only t)
1964 ("oddeven" org-odd-levels-only nil) 2173 ("oddeven" org-odd-levels-only nil)
2174 ("align" org-startup-align-all-tables t)
2175 ("noalign" org-startup-align-all-tables nil)
1965 ("dlcheck" org-startup-with-deadline-check t) 2176 ("dlcheck" org-startup-with-deadline-check t)
1966 ("nodlcheck" org-startup-with-deadline-check nil))) 2177 ("nodlcheck" org-startup-with-deadline-check nil)))
1967 l var val) 2178 l var val)
@@ -2014,57 +2225,57 @@ Changing this variable requires a restart of Emacs to take effect."
2014 2225
2015;; Tell the compiler about dynamically scoped variables, 2226;; Tell the compiler about dynamically scoped variables,
2016;; and variables from other packages 2227;; and variables from other packages
2017(defvar zmacs-regions) 2228(defvar zmacs-regions) ; XEmacs regions
2018(defvar original-date) 2229(defvar original-date) ; dynamically scoped in calendar
2019(defvar org-transient-mark-mode) 2230(defvar org-old-auto-fill-inhibit-regexp) ; local variable used by `orgtbl-mode'
2020(defvar org-old-auto-fill-inhibit-regexp) 2231(defvar orgtbl-mode-menu) ; defined when orgtbl mode get initialized
2021(defvar orgtbl-mode-menu) 2232(defvar org-html-entities) ; defined later in this file
2022(defvar org-html-entities) 2233(defvar org-goto-start-pos) ; dynamically scoped parameter
2023(defvar org-goto-start-pos) 2234(defvar org-time-was-given) ; dynamically scoped parameter
2024(defvar org-cursor-color) 2235(defvar org-ts-what) ; dynamically scoped parameter
2025(defvar org-time-was-given) 2236(defvar mark-active) ; Emacs only, not available in XEmacs.
2026(defvar org-ts-what) 2237(defvar timecnt) ; dynamically scoped parameter
2027(defvar mark-active) 2238(defvar levels-open) ; dynamically scoped parameter
2028(defvar timecnt) 2239(defvar title) ; dynamically scoped parameter
2029(defvar levels-open) 2240(defvar author) ; dynamically scoped parameter
2030(defvar title) 2241(defvar email) ; dynamically scoped parameter
2031(defvar author) 2242(defvar text) ; dynamically scoped parameter
2032(defvar email) 2243(defvar entry) ; dynamically scoped parameter
2033(defvar text) 2244(defvar date) ; dynamically scoped parameter
2034(defvar entry) 2245(defvar language) ; dynamically scoped parameter
2035(defvar date) 2246(defvar options) ; dynamically scoped parameter
2036(defvar language) 2247(defvar ans1) ; dynamically scoped parameter
2037(defvar options) 2248(defvar ans2) ; dynamically scoped parameter
2038(defvar ans1) 2249(defvar starting-day) ; local variable
2039(defvar ans2) 2250(defvar include-all-loc) ; local variable
2040(defvar starting-day) 2251(defvar vm-message-pointer) ; from vm
2041(defvar include-all-loc) 2252(defvar vm-folder-directory) ; from vm
2042(defvar vm-message-pointer) 2253(defvar wl-summary-buffer-elmo-folder) ; from wanderlust
2043(defvar vm-folder-directory) 2254(defvar wl-summary-buffer-folder-name) ; from wanderlust
2044(defvar wl-summary-buffer-elmo-folder) 2255(defvar gnus-group-name) ; from gnus
2045(defvar wl-summary-buffer-folder-name) 2256(defvar gnus-article-current) ; from gnus
2046(defvar gnus-group-name) 2257(defvar w3m-current-url) ; from w3m
2047(defvar gnus-article-current) 2258(defvar mh-progs) ; from MH-E
2048(defvar w3m-current-url) 2259(defvar mh-current-folder) ; from MH-E
2049(defvar mh-progs) 2260(defvar mh-show-folder-buffer) ; from MH-E
2050(defvar mh-current-folder) 2261(defvar mh-index-folder) ; from MH-E
2051(defvar mh-show-folder-buffer) 2262(defvar mh-searcher) ; from MH-E
2052(defvar mh-index-folder) 2263(defvar org-selected-point) ; dynamically scoped parameter
2053(defvar mh-searcher) 2264(defvar calendar-mode-map) ; from calendar.el
2054(defvar org-selected-point) 2265(defvar last-arg) ; local variable
2055(defvar calendar-mode-map) 2266(defvar remember-save-after-remembering) ; from remember.el
2056(defvar remember-save-after-remembering) 2267(defvar remember-data-file) ; from remember.el
2057(defvar remember-data-file) 2268(defvar annotation) ; from remember.el, dynamically scoped in `remember-mode'
2058(defvar last-arg) 2269(defvar initial) ; from remember.el, dynamically scoped in `remember-mode'
2059 2270(defvar orgtbl-mode) ; defined later in this file
2060;;; Define the mode 2271;;; Define the mode
2061 2272
2062(defvar org-mode-map (copy-keymap outline-mode-map) 2273(defvar org-mode-map (copy-keymap outline-mode-map)
2063 "Keymap for Org-mode.") 2274 "Keymap for Org-mode.")
2064 2275
2065(defvar org-struct-menu) 2276(defvar org-struct-menu) ; defined later in this file
2066(defvar org-org-menu) 2277(defvar org-org-menu) ; defined later in this file
2067(defvar org-tbl-menu) 2278(defvar org-tbl-menu) ; defined later in this file
2068 2279
2069;; We use a before-change function to check if a table might need 2280;; We use a before-change function to check if a table might need
2070;; an update. 2281;; an update.
@@ -2099,11 +2310,19 @@ The following commands are available:
2099 (easy-menu-add org-org-menu) 2310 (easy-menu-add org-org-menu)
2100 (easy-menu-add org-tbl-menu) 2311 (easy-menu-add org-tbl-menu)
2101 (org-install-agenda-files-menu) 2312 (org-install-agenda-files-menu)
2313 (if org-descriptive-links (org-add-to-invisibility-spec '(org-link)))
2314 (org-add-to-invisibility-spec '(org-cwidth))
2102 (setq outline-regexp "\\*+") 2315 (setq outline-regexp "\\*+")
2103; (setq outline-regexp "\\(?:\\*+\\|[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\) \\)") 2316 ;;(setq outline-regexp "\\(?:\\*+\\|[ \t]*\\(?:[-+*]\\|[0-9]+[.)]\\) \\)")
2104 (setq outline-level 'org-outline-level) 2317 (setq outline-level 'org-outline-level)
2105 (if org-startup-truncated (setq truncate-lines t)) 2318 (when (and org-ellipsis (stringp org-ellipsis))
2319 (unless org-display-table
2320 (setq org-display-table (make-display-table)))
2321 (set-display-table-slot org-display-table
2322 4 (string-to-vector org-ellipsis))
2323 (setq buffer-display-table org-display-table))
2106 (org-set-regexps-and-options) 2324 (org-set-regexps-and-options)
2325 (if org-startup-truncated (setq truncate-lines t))
2107 (set (make-local-variable 'font-lock-unfontify-region-function) 2326 (set (make-local-variable 'font-lock-unfontify-region-function)
2108 'org-unfontify-region) 2327 'org-unfontify-region)
2109 ;; Activate before-change-function 2328 ;; Activate before-change-function
@@ -2124,7 +2343,7 @@ The following commands are available:
2124 ;; Get rid of Outline menus, they are not needed 2343 ;; Get rid of Outline menus, they are not needed
2125 ;; Need to do this here because define-derived-mode sets up 2344 ;; Need to do this here because define-derived-mode sets up
2126 ;; the keymap so late. 2345 ;; the keymap so late.
2127 (if org-xemacs-p 2346 (if (featurep 'xemacs)
2128 (progn 2347 (progn
2129 (delete-menu-item '("Headings")) 2348 (delete-menu-item '("Headings"))
2130 (delete-menu-item '("Show")) 2349 (delete-menu-item '("Show"))
@@ -2135,6 +2354,8 @@ The following commands are available:
2135 (define-key org-mode-map [menu-bar show] 'undefined)) 2354 (define-key org-mode-map [menu-bar show] 'undefined))
2136 2355
2137 (unless org-inhibit-startup 2356 (unless org-inhibit-startup
2357 (if org-startup-align-all-tables
2358 (org-table-map-tables 'org-table-align))
2138 (if org-startup-with-deadline-check 2359 (if org-startup-with-deadline-check
2139 (call-interactively 'org-check-deadlines) 2360 (call-interactively 'org-check-deadlines)
2140 (cond 2361 (cond
@@ -2147,20 +2368,44 @@ The following commands are available:
2147(defsubst org-current-line (&optional pos) 2368(defsubst org-current-line (&optional pos)
2148 (+ (if (bolp) 1 0) (count-lines (point-min) (or pos (point))))) 2369 (+ (if (bolp) 1 0) (count-lines (point-min) (or pos (point)))))
2149 2370
2371(defconst org-rm-props '(invisible t face t keymap t intangible t mouse-face t
2372 mouse-map t)
2373 "Properties to remove when a string without properties is wanted.")
2150 2374
2151;; FIXME: Do we need to copy? 2375(defsubst org-match-string-no-properties (num &optional string)
2152(defun org-string-props (string &rest properties) 2376 (if (featurep 'xemacs)
2153 "Add PROPERTIES to string." 2377 (let ((s (match-string num string)))
2154 (add-text-properties 0 (length string) properties string) 2378 (remove-text-properties 0 (length s) org-rm-props s)
2379 s)
2380 (match-string-no-properties num string)))
2381
2382(defun org-current-time ()
2383 "Current time, possibly rounded to `org-time-stamp-rounding-minutes'."
2384 (if (> org-time-stamp-rounding-minutes 0)
2385 (let ((r org-time-stamp-rounding-minutes)
2386 (time (decode-time)))
2387 (apply 'encode-time
2388 (append (list 0 (* r (floor (+ .5 (/ (float (nth 1 time)) r)))))
2389 (nthcdr 2 time))))
2390 (current-time)))
2391
2392(defun org-add-props (string plist &rest props)
2393 "Add text properties to entire string, from beginning to end.
2394PLIST may be a list of properties, PROPS are individual properties and values
2395that will be added to PLIST. Returns the string that was modified."
2396 (add-text-properties
2397 0 (length string) (if props (append plist props) plist) string)
2155 string) 2398 string)
2399(put 'org-add-props 'lisp-indent-function 2)
2400
2156 2401
2157;;; Font-Lock stuff 2402;;; Font-Lock stuff
2158 2403
2159(defvar org-mouse-map (make-sparse-keymap)) 2404(defvar org-mouse-map (make-sparse-keymap))
2160(define-key org-mouse-map 2405(define-key org-mouse-map
2161 (if org-xemacs-p [button2] [mouse-2]) 'org-open-at-mouse) 2406 (if (featurep 'xemacs) [button2] [mouse-2]) 'org-open-at-mouse)
2162(define-key org-mouse-map 2407(define-key org-mouse-map
2163 (if org-xemacs-p [button3] [mouse-3]) 'org-find-file-at-mouse) 2408 (if (featurep 'xemacs) [button3] [mouse-3]) 'org-find-file-at-mouse)
2164(define-key org-mouse-map [follow-link] 'mouse-face) 2409(define-key org-mouse-map [follow-link] 'mouse-face)
2165(when org-tab-follows-link 2410(when org-tab-follows-link
2166 (define-key org-mouse-map [(tab)] 'org-open-at-point) 2411 (define-key org-mouse-map [(tab)] 'org-open-at-point)
@@ -2171,26 +2416,57 @@ The following commands are available:
2171 2416
2172(require 'font-lock) 2417(require 'font-lock)
2173 2418
2174(defconst org-non-link-chars "\t\n\r|<>\000") 2419(defconst org-non-link-chars "]\t\n\r<>")
2175(defconst org-link-regexp 2420(defconst org-link-types '("https?" "ftp" "mailto" "file" "news" "bbdb" "vm"
2176 (if org-allow-space-in-links 2421 "wl" "mhe" "rmail" "gnus" "shell"))
2177 (concat 2422(defconst org-link-re-with-space
2178 "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|mhe\\|rmail\\|gnus\\|shell\\):\\([^" org-non-link-chars "]+[^ " org-non-link-chars "]\\)") 2423 (concat
2179 (concat 2424 "<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
2180 "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|mhe\\|rmail\\|gnus\\|shell\\):\\([^ " org-non-link-chars "]+\\)") 2425 "\\([^" org-non-link-chars " ]"
2181 ) 2426 "[^" org-non-link-chars "]*"
2182 "Regular expression for matching links.") 2427 "[^" org-non-link-chars " ]\\)>?")
2183(defconst org-link-maybe-angles-regexp 2428 "Matches a link with spaces, optional angular brackets around it.")
2184 (concat "<?\\(" org-link-regexp "\\)>?") 2429
2185 "Matches a link and optionally surrounding angle brackets.") 2430(defconst org-link-re-with-space2
2186(defconst org-protected-link-regexp 2431 (concat
2187 (concat "\000" org-link-regexp "\000") 2432 "<?\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
2188 "Matches a link and optionally surrounding angle brackets.") 2433 "\\([^" org-non-link-chars " ]"
2434 "[^]\t\n\r]*"
2435 "[^" org-non-link-chars " ]\\)>?")
2436 "Matches a link with spaces, optional angular brackets around it.")
2437
2438(defconst org-angle-link-re
2439 (concat
2440 "<\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
2441 "\\([^" org-non-link-chars " ]"
2442 "[^" org-non-link-chars "]*"
2443 "\\)>")
2444 "Matches link with angular brackets, spaces are allowed.")
2445(defconst org-plain-link-re
2446 (concat
2447 "\\(" (mapconcat 'identity org-link-types "\\|") "\\):"
2448 "\\([^]\t\n\r<>,;() ]+\\)")
2449 "Matches plain link, without spaces.")
2189 2450
2190(defconst org-bracket-link-regexp 2451(defconst org-bracket-link-regexp
2191 "\\[\\[\\([^]]+\\)\\]\\(\\[\\([^]]+\\)\\]\\)?\\]" 2452 "\\[\\[\\([^]]+\\)\\]\\(\\[\\([^]]+\\)\\]\\)?\\]"
2192 "Matches a link in double brackets.") 2453 "Matches a link in double brackets.")
2193 2454
2455(defconst org-bracket-link-analytic-regexp
2456 (concat
2457 "\\[\\["
2458 "\\(\\(" (mapconcat 'identity org-link-types "\\|") "\\):\\)?"
2459 "\\([^]]+\\)"
2460 "\\]"
2461 "\\(\\[" "\\([^]]+\\)" "\\]\\)?"
2462 "\\]"))
2463; 1: http:
2464; 2: http
2465; 3: path
2466; 4: [desc]
2467; 5: desc
2468
2469
2194(defconst org-ts-lengths 2470(defconst org-ts-lengths
2195 (cons (length (format-time-string (car org-time-stamp-formats))) 2471 (cons (length (format-time-string (car org-time-stamp-formats)))
2196 (length (format-time-string (cdr org-time-stamp-formats)))) 2472 (length (format-time-string (cdr org-time-stamp-formats))))
@@ -2209,22 +2485,48 @@ The following commands are available:
2209 org-ts-regexp "\\)?") 2485 org-ts-regexp "\\)?")
2210 "Regular expression matching a time stamp or time stamp range.") 2486 "Regular expression matching a time stamp or time stamp range.")
2211 2487
2212(defun org-activate-links (limit) 2488(defun org-activate-plain-links (limit)
2213 "Run through the buffer and add overlays to links." 2489 "Run through the buffer and add overlays to links."
2214 (if (re-search-forward org-link-regexp limit t) 2490 (if (re-search-forward org-plain-link-re limit t)
2215 (progn 2491 (progn
2216 (add-text-properties (match-beginning 0) (match-end 0) 2492 (add-text-properties (match-beginning 0) (match-end 0)
2217 (list 'mouse-face 'highlight 2493 (list 'mouse-face 'highlight
2218 'keymap org-mouse-map)) 2494 'keymap org-mouse-map
2495 ))
2219 t))) 2496 t)))
2220 2497
2221(defun org-activate-links2 (limit) 2498(defun org-activate-angle-links (limit)
2222 "Run through the buffer and add overlays to links." 2499 "Run through the buffer and add overlays to links."
2223 (if (re-search-forward org-bracket-link-regexp limit t) 2500 (if (re-search-forward org-angle-link-re limit t)
2224 (progn 2501 (progn
2225 (add-text-properties (match-beginning 0) (match-end 0) 2502 (add-text-properties (match-beginning 0) (match-end 0)
2226 (list 'mouse-face 'highlight 2503 (list 'mouse-face 'highlight
2227 'keymap org-mouse-map)) 2504 'keymap org-mouse-map
2505 ))
2506 t)))
2507
2508(defun org-activate-bracket-links (limit)
2509 "Run through the buffer and add overlays to bracketed links."
2510 (if (re-search-forward org-bracket-link-regexp limit t)
2511 (let* ((help (concat "LINK: " (org-match-string-no-properties 1)))
2512 (ip (list 'invisible 'org-link 'intangible t 'rear-nonsticky t
2513 'keymap org-mouse-map 'mouse-face 'highlight
2514 'help-echo help))
2515 (vp (list 'rear-nonsticky t
2516 'keymap org-mouse-map 'mouse-face 'highlight
2517 'help-echo help)))
2518 ;; We need to remove the invisible property here. Table narrowing
2519 ;; may have made some of this invisible.
2520 (remove-text-properties (match-beginning 0) (match-end 0)
2521 '(invisible nil))
2522 (if (match-end 3)
2523 (progn
2524 (add-text-properties (match-beginning 0) (match-beginning 3) ip)
2525 (add-text-properties (match-beginning 3) (match-end 3) vp)
2526 (add-text-properties (match-end 3) (match-end 0) ip))
2527 (add-text-properties (match-beginning 0) (match-beginning 1) ip)
2528 (add-text-properties (match-beginning 1) (match-end 1) vp)
2529 (add-text-properties (match-end 1) (match-end 0) ip))
2228 t))) 2530 t)))
2229 2531
2230(defun org-activate-dates (limit) 2532(defun org-activate-dates (limit)
@@ -2245,22 +2547,38 @@ The following commands are available:
2245 2547
2246(defun org-activate-target-links (limit) 2548(defun org-activate-target-links (limit)
2247 "Run through the buffer and add overlays to target matches." 2549 "Run through the buffer and add overlays to target matches."
2248 (when (and org-radio-targets org-target-link-regexp) 2550 (when org-target-link-regexp
2249 (let ((case-fold-search t)) 2551 (let ((case-fold-search t))
2250 (if (re-search-forward org-target-link-regexp limit t) 2552 (if (re-search-forward org-target-link-regexp limit t)
2251 (progn 2553 (progn
2252 (add-text-properties (match-beginning 0) (match-end 0) 2554 (add-text-properties (match-beginning 0) (match-end 0)
2253 (list 'mouse-face 'highlight 2555 (list 'mouse-face 'highlight
2254 'keymap org-mouse-map 2556 'keymap org-mouse-map
2557 'help-echo "Radio target link"
2255 'org-linked-text t)) 2558 'org-linked-text t))
2256 t))))) 2559 t)))))
2257 2560
2258(defun org-update-radio-target-regexp () 2561(defun org-update-radio-target-regexp ()
2259 "Find all radio targets in this file and update the regular expression." 2562 "Find all radio targets in this file and update the regular expression."
2260 (interactive) 2563 (interactive)
2261 (when org-radio-targets 2564 (when (memq 'radio org-activate-links)
2262 (setq org-target-link-regexp 2565 (setq org-target-link-regexp
2263 (org-make-target-link-regexp (org-all-targets 'radio))) 2566 (org-make-target-link-regexp (org-all-targets 'radio)))
2567 (org-restart-font-lock)))
2568
2569(defun org-hide-wide-columns (limit)
2570 (let (s e)
2571 (setq s (text-property-any (point) (or limit (point-max))
2572 'org-cwidth t))
2573 (when s
2574 (setq e (next-single-property-change s 'org-cwidth))
2575 (add-text-properties s e '(invisible org-cwidth intangible t))
2576 (goto-char e)
2577 t)))
2578
2579(defun org-restart-font-lock ()
2580 "Restart font-lock-mode, to force refontification."
2581 (when (and (boundp 'font-lock-mode) font-lock-mode)
2264 (font-lock-mode -1) 2582 (font-lock-mode -1)
2265 (font-lock-mode 1))) 2583 (font-lock-mode 1)))
2266 2584
@@ -2272,10 +2590,7 @@ With optional argument RADIO, only find radio targets."
2272 (save-excursion 2590 (save-excursion
2273 (goto-char (point-min)) 2591 (goto-char (point-min))
2274 (while (re-search-forward re nil t) 2592 (while (re-search-forward re nil t)
2275 (add-to-list 'rtn (downcase 2593 (add-to-list 'rtn (downcase (org-match-string-no-properties 1))))
2276 (if (fboundp 'match-string-no-properties)
2277 (match-string-no-properties 1)
2278 (match-string 1)))))
2279 rtn))) 2594 rtn)))
2280 2595
2281(defun org-make-target-link-regexp (targets) 2596(defun org-make-target-link-regexp (targets)
@@ -2299,13 +2614,12 @@ between words."
2299 2614
2300(defun org-activate-camels (limit) 2615(defun org-activate-camels (limit)
2301 "Run through the buffer and add overlays to dates." 2616 "Run through the buffer and add overlays to dates."
2302 (if org-activate-camels 2617 (if (re-search-forward org-camel-regexp limit t)
2303 (if (re-search-forward org-camel-regexp limit t) 2618 (progn
2304 (progn 2619 (add-text-properties (match-beginning 0) (match-end 0)
2305 (add-text-properties (match-beginning 0) (match-end 0) 2620 (list 'mouse-face 'highlight
2306 (list 'mouse-face 'highlight 2621 'keymap org-mouse-map))
2307 'keymap org-mouse-map)) 2622 t)))
2308 t))))
2309 2623
2310(defun org-activate-tags (limit) 2624(defun org-activate-tags (limit)
2311 (if (re-search-forward "[ \t]\\(:[A-Za-z_@0-9:]+:\\)[ \r\n]" limit t) 2625 (if (re-search-forward "[ \t]\\(:[A-Za-z_@0-9:]+:\\)[ \r\n]" limit t)
@@ -2331,28 +2645,31 @@ between words."
2331 2645
2332(defun org-set-font-lock-defaults () 2646(defun org-set-font-lock-defaults ()
2333 (let* ((em org-fontify-emphasized-text) 2647 (let* ((em org-fontify-emphasized-text)
2648 (lk org-activate-links)
2334 (org-font-lock-extra-keywords 2649 (org-font-lock-extra-keywords
2335 (list 2650 (list
2336 '("^\\(\\**\\)\\(\\*\\)\\(.*\\)" (1 (org-get-level-face 1)) 2651 '("^\\(\\**\\)\\(\\*\\)\\(.*\\)" (1 (org-get-level-face 1))
2337 (2 (org-get-level-face 2)) (3 (org-get-level-face 3))) 2652 (2 (org-get-level-face 2)) (3 (org-get-level-face 3)))
2338 '(org-activate-links (0 'org-link t)) 2653 '("^[ \t]*\\(\\(|\\|\\+-[-+]\\).*\\S-\\)"
2339 '(org-activate-links2 (0 'org-link t)) 2654 (1 'org-table))
2340 '(org-activate-target-links (0 'org-link t)) 2655 (if (memq 'angle lk) '(org-activate-angle-links (0 'org-link t)))
2341 '(org-activate-dates (0 'org-link t)) 2656 (if (memq 'plain lk) '(org-activate-plain-links (0 'org-link t)))
2342 '(org-activate-camels (0 'org-link t)) 2657 (if (memq 'bracket lk) '(org-activate-bracket-links (0 'org-link t)))
2343 '(org-activate-tags (1 'org-tag t)) 2658 (if (memq 'radio lk) '(org-activate-target-links (0 'org-link t)))
2659 (if (memq 'date lk) '(org-activate-dates (0 'org-link t)))
2660 (if (memq 'camel lk) '(org-activate-camels (0 'org-link t)))
2661 (if (memq 'tag lk) '(org-activate-tags (1 'org-tag prepend)))
2662 (if org-table-limit-column-width
2663 '(org-hide-wide-columns (0 nil append)))
2344 (list (concat "^\\*+[ \t]*" org-not-done-regexp) 2664 (list (concat "^\\*+[ \t]*" org-not-done-regexp)
2345 '(1 'org-warning t)) 2665 '(1 'org-warning t))
2346 (list (concat "\\[#[A-Z]\\]") '(0 'org-special-keyword t)) 2666 (list (concat "\\[#[A-Z]\\]") '(0 'org-special-keyword t))
2347 (list (concat "\\<" org-deadline-string) '(0 'org-special-keyword t)) 2667 (list (concat "\\<" org-deadline-string) '(0 'org-special-keyword t))
2348 (list (concat "\\<" org-scheduled-string) '(0 'org-special-keyword t)) 2668 (list (concat "\\<" org-scheduled-string) '(0 'org-special-keyword t))
2349 (list (concat "\\<" org-closed-string) '(0 'org-special-keyword t)) 2669 (list (concat "\\<" org-closed-string) '(0 'org-special-keyword t))
2350; (if em '("\\(\\s-\\|^\\)\\(\\*\\([a-zA-Z]+\\)\\*\\)\\([^a-zA-Z*]\\|$\\)" (3 'bold))) 2670 (if em '("\\(\\W\\|^\\)\\(\\*\\w+\\*\\)\\(\\W\\|$\\)" 2 'bold prepend))
2351; (if em '("\\(\\s-\\|^\\)\\(/\\([a-zA-Z]+\\)/\\)\\([^a-zA-Z*]\\|$\\)" (3 'italic))) 2671 (if em '("\\(\\W\\|^\\)\\(/\\w+/\\)\\(\\W\\|$\\)" 2 'italic prepend))
2352; (if em '("\\(\\s-\\|^\\)\\(_\\([a-zA-Z]+\\)_\\)\\([^a-zA-Z*]\\|$\\)" (3 'underline))) 2672 (if em '("\\(\\W\\|^\\)\\(_\\w+_\\)\\(\\W\\|$\\)" 2 'underline prepend))
2353 (if em '("\\*[a-zA-Z]+\\*" 0 'bold))
2354 (if em '("/*[a-zA-Z]+/" 0 'italic))
2355 (if em '("_[a-zA-Z]+_" 0 'underline))
2356 (list (concat "^\\*+[ \t]*\\<\\(" org-comment-string 2673 (list (concat "^\\*+[ \t]*\\<\\(" org-comment-string
2357 "\\|" org-quote-string "\\)\\>") 2674 "\\|" org-quote-string "\\)\\>")
2358 '(1 'org-special-keyword t)) 2675 '(1 'org-special-keyword t))
@@ -2362,11 +2679,11 @@ between words."
2362 '(1 'org-done t) '(2 'org-headline-done t)) 2679 '(1 'org-done t) '(2 'org-headline-done t))
2363 (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\>") 2680 (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\>")
2364 '(1 'org-done t))) 2681 '(1 'org-done t)))
2365 '("^[ \t]*\\(\\(|\\|\\+-[-+]\\).*\\S-\\)"
2366 (1 'org-table t))
2367 '("^[ \t]*\\(:.*\\)" (1 'org-table t)) 2682 '("^[ \t]*\\(:.*\\)" (1 'org-table t))
2368 '("| *\\(:?=[^|\n]*\\)" (1 'org-formula t)) 2683 '("| *\\(:?=[^|\n]*\\)" (1 'org-formula t))
2369 '("^[ \t]*| *\\([#!$*_^]\\) *|" (1 'org-formula t)) 2684 '("^[ \t]*| *\\([#!$*_^]\\) *|" (1 'org-formula t))
2685 (if org-format-transports-properties-p
2686 '("| *\\(<[0-9]+>\\) *|" (1 'org-formula t)))
2370 ))) 2687 )))
2371 (setq org-font-lock-extra-keywords (delq nil org-font-lock-extra-keywords)) 2688 (setq org-font-lock-extra-keywords (delq nil org-font-lock-extra-keywords))
2372 ;; Now set the full font-lock-keywords 2689 ;; Now set the full font-lock-keywords
@@ -2383,6 +2700,7 @@ between words."
2383 "Get the right face for match N in font-lock matching of healdines." 2700 "Get the right face for match N in font-lock matching of healdines."
2384 (setq org-l (- (match-end 2) (match-beginning 1))) 2701 (setq org-l (- (match-end 2) (match-beginning 1)))
2385 (if org-odd-levels-only (setq org-l (1+ (/ org-l 2)))) 2702 (if org-odd-levels-only (setq org-l (1+ (/ org-l 2))))
2703; (setq org-f (nth (1- (% org-l org-n-levels)) org-level-faces))
2386 (setq org-f (nth (% (1- org-l) org-n-levels) org-level-faces)) 2704 (setq org-f (nth (% (1- org-l) org-n-levels) org-level-faces))
2387 (cond 2705 (cond
2388 ((eq n 1) (if org-hide-leading-stars 'org-hide org-f)) 2706 ((eq n 1) (if org-hide-leading-stars 'org-hide org-f))
@@ -2397,8 +2715,8 @@ between words."
2397 (inhibit-modification-hooks t) 2715 (inhibit-modification-hooks t)
2398 deactivate-mark buffer-file-name buffer-file-truename) 2716 deactivate-mark buffer-file-name buffer-file-truename)
2399 (remove-text-properties beg end 2717 (remove-text-properties beg end
2400 '(mouse-face nil keymap nil org-linked-text nil)))) 2718 '(mouse-face nil keymap nil org-linked-text nil
2401 2719 invisible nil intangible nil))))
2402;;; Visibility cycling 2720;;; Visibility cycling
2403 2721
2404(defvar org-cycle-global-status nil) 2722(defvar org-cycle-global-status nil)
@@ -2448,8 +2766,9 @@ between words."
2448 ;; Enter the table or move to the next field in the table 2766 ;; Enter the table or move to the next field in the table
2449 (or (org-table-recognize-table.el) 2767 (or (org-table-recognize-table.el)
2450 (progn 2768 (progn
2451 (org-table-justify-field-maybe) 2769 (if arg (org-table-edit-field t)
2452 (org-table-next-field)))) 2770 (org-table-justify-field-maybe)
2771 (org-table-next-field)))))
2453 2772
2454 ((eq arg t) ;; Global cycling 2773 ((eq arg t) ;; Global cycling
2455 2774
@@ -2560,13 +2879,14 @@ between words."
2560(defun org-optimize-window-after-visibility-change (state) 2879(defun org-optimize-window-after-visibility-change (state)
2561 "Adjust the window after a change in outline visibility. 2880 "Adjust the window after a change in outline visibility.
2562This function is the default value of the hook `org-cycle-hook'." 2881This function is the default value of the hook `org-cycle-hook'."
2563 (cond 2882 (when (get-buffer-window (current-buffer))
2564 ((eq state 'overview) (org-first-headline-recenter 1)) 2883 (cond
2565 ((eq state 'content) nil) 2884 ((eq state 'overview) (org-first-headline-recenter 1))
2566 ((eq state 'all) nil) 2885 ((eq state 'content) nil)
2567 ((eq state 'folded) nil) 2886 ((eq state 'all) nil)
2568 ((eq state 'children) (or (org-subtree-end-visible-p) (recenter 1))) 2887 ((eq state 'folded) nil)
2569 ((eq state 'subtree) (or (org-subtree-end-visible-p) (recenter 1))))) 2888 ((eq state 'children) (or (org-subtree-end-visible-p) (recenter 1)))
2889 ((eq state 'subtree) (or (org-subtree-end-visible-p) (recenter 1))))))
2570 2890
2571(defun org-subtree-end-visible-p () 2891(defun org-subtree-end-visible-p ()
2572 "Is the end of the current subtree visible?" 2892 "Is the end of the current subtree visible?"
@@ -2655,6 +2975,7 @@ or nil."
2655 (insert-buffer-substring buf) 2975 (insert-buffer-substring buf)
2656 (let ((org-startup-truncated t) 2976 (let ((org-startup-truncated t)
2657 (org-startup-folded t) 2977 (org-startup-folded t)
2978 (org-startup-align-all-tables nil)
2658 (org-startup-with-deadline-check nil)) 2979 (org-startup-with-deadline-check nil))
2659 (org-mode)) 2980 (org-mode))
2660 (setq buffer-read-only t) 2981 (setq buffer-read-only t)
@@ -2729,10 +3050,8 @@ or nil."
2729 (funcall outline-level))))) 3050 (funcall outline-level)))))
2730 (unless (bolp) (newline)) 3051 (unless (bolp) (newline))
2731 (insert head) 3052 (insert head)
2732 (unless (eolp) 3053 (if (looking-at "[ \t]*")
2733 (save-excursion (newline-and-indent))) 3054 (replace-match " "))
2734 (unless (equal (char-before) ?\ )
2735 (insert " "))
2736 (run-hooks 'org-insert-heading-hook)))) 3055 (run-hooks 'org-insert-heading-hook))))
2737 3056
2738(defun org-insert-item () 3057(defun org-insert-item ()
@@ -2976,7 +3295,6 @@ If CUT is non nil, actually cut the subtree."
2976 (if cut "Cut" "Copied") 3295 (if cut "Cut" "Copied")
2977 (length org-subtree-clip))))) 3296 (length org-subtree-clip)))))
2978 3297
2979;; FIXME: this needs to be adapted for the odd-level-only stuff.
2980(defun org-paste-subtree (&optional level tree) 3298(defun org-paste-subtree (&optional level tree)
2981 "Paste the clipboard as a subtree, with modification of headline level. 3299 "Paste the clipboard as a subtree, with modification of headline level.
2982The entire subtree is promoted or demoted in order to match a new headline 3300The entire subtree is promoted or demoted in order to match a new headline
@@ -3283,7 +3601,6 @@ with something like \"1.\" or \"2)\"."
3283(defvar org-last-indent-begin-marker (make-marker)) 3601(defvar org-last-indent-begin-marker (make-marker))
3284(defvar org-last-indent-end-marker (make-marker)) 3602(defvar org-last-indent-end-marker (make-marker))
3285 3603
3286
3287(defun org-outdent-item (arg) 3604(defun org-outdent-item (arg)
3288 "Outdent a local list item." 3605 "Outdent a local list item."
3289 (interactive "p") 3606 (interactive "p")
@@ -3401,7 +3718,7 @@ heading be marked DONE, and the current time will be added."
3401 (looking-at org-todo-line-regexp) 3718 (looking-at org-todo-line-regexp)
3402 (goto-char (or (match-end 2) (match-beginning 3))) 3719 (goto-char (or (match-end 2) (match-beginning 3)))
3403 (insert "(" (format-time-string (cdr org-time-stamp-formats) 3720 (insert "(" (format-time-string (cdr org-time-stamp-formats)
3404 (current-time)) 3721 (org-current-time))
3405 ")")) 3722 ")"))
3406 ;; Save the buffer, if it is not the same buffer. 3723 ;; Save the buffer, if it is not the same buffer.
3407 (if (not (eq this-buffer buffer)) (save-buffer)))) 3724 (if (not (eq this-buffer buffer)) (save-buffer))))
@@ -3632,7 +3949,7 @@ When UNDONE is non-nil, remove such a time stamp again."
3632 (insert org-closed-string " " 3949 (insert org-closed-string " "
3633 (format-time-string 3950 (format-time-string
3634 (concat "[" (substring (cdr org-time-stamp-formats) 1 -1) "]") 3951 (concat "[" (substring (cdr org-time-stamp-formats) 1 -1) "]")
3635 (current-time)) 3952 (org-current-time))
3636 "\n"))))) 3953 "\n")))))
3637 3954
3638(defun org-show-todo-tree (arg) 3955(defun org-show-todo-tree (arg)
@@ -3727,17 +4044,19 @@ that the match should indeed be shown."
3727 4044
3728;; Overlay compatibility functions 4045;; Overlay compatibility functions
3729(defun org-make-overlay (beg end &optional buffer) 4046(defun org-make-overlay (beg end &optional buffer)
3730 (if org-xemacs-p (make-extent beg end buffer) (make-overlay beg end buffer))) 4047 (if (featurep 'xemacs)
4048 (make-extent beg end buffer)
4049 (make-overlay beg end buffer)))
3731(defun org-delete-overlay (ovl) 4050(defun org-delete-overlay (ovl)
3732 (if org-xemacs-p (delete-extent ovl) (delete-overlay ovl))) 4051 (if (featurep 'xemacs) (delete-extent ovl) (delete-overlay ovl)))
3733(defun org-detatch-overlay (ovl) 4052(defun org-detatch-overlay (ovl)
3734 (if org-xemacs-p (detach-extent ovl) (delete-overlay ovl))) 4053 (if (featurep 'xemacs) (detach-extent ovl) (delete-overlay ovl)))
3735(defun org-move-overlay (ovl beg end &optional buffer) 4054(defun org-move-overlay (ovl beg end &optional buffer)
3736 (if org-xemacs-p 4055 (if (featurep 'xemacs)
3737 (set-extent-endpoints ovl beg end buffer) 4056 (set-extent-endpoints ovl beg end buffer)
3738 (move-overlay ovl beg end buffer))) 4057 (move-overlay ovl beg end buffer)))
3739(defun org-overlay-put (ovl prop value) 4058(defun org-overlay-put (ovl prop value)
3740 (if org-xemacs-p 4059 (if (featurep 'xemacs)
3741 (set-extent-property ovl prop value) 4060 (set-extent-property ovl prop value)
3742 (overlay-put ovl prop value))) 4061 (overlay-put ovl prop value)))
3743 4062
@@ -3876,7 +4195,6 @@ An inactive time stamp is enclosed in square brackets instead of angle
3876brackets. It is inactive in the sense that it does not trigger agenda entries, 4195brackets. It is inactive in the sense that it does not trigger agenda entries,
3877does not link to the calendar and cannot be changed with the S-cursor keys. 4196does not link to the calendar and cannot be changed with the S-cursor keys.
3878So these are more for recording a certain time/date." 4197So these are more for recording a certain time/date."
3879 ;; FIXME: Would it be better not to ask for a date/time here?
3880 (interactive "P") 4198 (interactive "P")
3881 (let ((fmt (if arg (cdr org-time-stamp-formats) 4199 (let ((fmt (if arg (cdr org-time-stamp-formats)
3882 (car org-time-stamp-formats))) 4200 (car org-time-stamp-formats)))
@@ -3891,8 +4209,6 @@ So these are more for recording a certain time/date."
3891(org-overlay-put org-date-ovl 'face 'org-warning) 4209(org-overlay-put org-date-ovl 'face 'org-warning)
3892(org-detatch-overlay org-date-ovl) 4210(org-detatch-overlay org-date-ovl)
3893 4211
3894;;; FIXME: Make the function take "Fri" as "next friday"
3895;;; because these are mostly being used to record the current time.
3896(defun org-read-date (&optional with-time to-time) 4212(defun org-read-date (&optional with-time to-time)
3897 "Read a date and make things smooth for the user. 4213 "Read a date and make things smooth for the user.
3898The prompt will suggest to enter an ISO date, but you can also enter anything 4214The prompt will suggest to enter an ISO date, but you can also enter anything
@@ -3905,6 +4221,7 @@ hour and minute. For example,
3905 12:45 --> today 12:45 4221 12:45 --> today 12:45
3906 22 sept 0:34 --> currentyear-09-22 0:34 4222 22 sept 0:34 --> currentyear-09-22 0:34
3907 12 --> currentyear-currentmonth-12 4223 12 --> currentyear-currentmonth-12
4224 Fri --> nearest Friday (today or later)
3908 etc. 4225 etc.
3909The function understands only English month and weekday abbreviations, 4226The function understands only English month and weekday abbreviations,
3910but this can be configured with the variables `parse-time-months' and 4227but this can be configured with the variables `parse-time-months' and
@@ -3924,7 +4241,10 @@ enter a time, and this function will inform the calling routine about
3924this change. The calling routine may then choose to change the format 4241this change. The calling routine may then choose to change the format
3925used to insert the time stamp into the buffer to include the time." 4242used to insert the time stamp into the buffer to include the time."
3926 (require 'parse-time) 4243 (require 'parse-time)
3927 (let* ((default-time 4244 (let* ((org-time-stamp-rounding-minutes
4245 (if (equal with-time '(16)) 0 org-time-stamp-rounding-minutes))
4246 (ct (org-current-time))
4247 (default-time
3928 ;; Default time is either today, or, when entering a range, 4248 ;; Default time is either today, or, when entering a range,
3929 ;; the range start. 4249 ;; the range start.
3930 (if (save-excursion 4250 (if (save-excursion
@@ -3933,20 +4253,18 @@ used to insert the time stamp into the buffer to include the time."
3933 (- (point) 20) t)) 4253 (- (point) 20) t))
3934 (apply 4254 (apply
3935 'encode-time 4255 'encode-time
3936 (mapcar (lambda(x) (or x 0)) ;; FIXME: Problem with timezone? 4256 (mapcar (lambda(x) (or x 0))
3937 (parse-time-string (match-string 1)))) 4257 (parse-time-string (match-string 1))))
3938 (current-time))) 4258 ct))
3939 (calendar-move-hook nil) 4259 (calendar-move-hook nil)
3940 (view-diary-entries-initially nil) 4260 (view-diary-entries-initially nil)
3941 (timestr (format-time-string 4261 (timestr (format-time-string
3942 (if with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") default-time)) 4262 (if with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") default-time))
3943 (prompt (format "YYYY-MM-DD [%s]: " timestr)) 4263 (prompt (format "YYYY-MM-DD [%s]: " timestr))
3944 ans ans1 ans2 4264 ans ans1 ans2
3945 second minute hour day month year tl) 4265 second minute hour day month year tl wday wday1)
3946 4266
3947 (if org-popup-calendar-for-date-prompt 4267 (if org-popup-calendar-for-date-prompt
3948 ;; Also show a calendar for date selection
3949 ;; Copied (with modifications) from planner.el by John Wiegley
3950 (save-excursion 4268 (save-excursion
3951 (save-window-excursion 4269 (save-window-excursion
3952 (calendar) 4270 (calendar)
@@ -3958,9 +4276,9 @@ used to insert the time stamp into the buffer to include the time."
3958 (map (copy-keymap calendar-mode-map)) 4276 (map (copy-keymap calendar-mode-map))
3959 (minibuffer-local-map (copy-keymap minibuffer-local-map))) 4277 (minibuffer-local-map (copy-keymap minibuffer-local-map)))
3960 (define-key map (kbd "RET") 'org-calendar-select) 4278 (define-key map (kbd "RET") 'org-calendar-select)
3961 (define-key map (if org-xemacs-p [button1] [mouse-1]) 4279 (define-key map (if (featurep 'xemacs) [button1] [mouse-1])
3962 'org-calendar-select-mouse) 4280 'org-calendar-select-mouse)
3963 (define-key map (if org-xemacs-p [button2] [mouse-2]) 4281 (define-key map (if (featurep 'xemacs) [button2] [mouse-2])
3964 'org-calendar-select-mouse) 4282 'org-calendar-select-mouse)
3965 (define-key minibuffer-local-map [(meta shift left)] 4283 (define-key minibuffer-local-map [(meta shift left)]
3966 (lambda () (interactive) 4284 (lambda () (interactive)
@@ -4009,12 +4327,19 @@ used to insert the time stamp into the buffer to include the time."
4009 (setq ans (replace-match (format "%04d-%02d-%02d\\5" year month day) 4327 (setq ans (replace-match (format "%04d-%02d-%02d\\5" year month day)
4010 t nil ans)))) 4328 t nil ans))))
4011 (setq tl (parse-time-string ans) 4329 (setq tl (parse-time-string ans)
4012 year (or (nth 5 tl) (string-to-number (format-time-string "%Y"))) 4330 year (or (nth 5 tl) (string-to-number (format-time-string "%Y" ct)))
4013 month (or (nth 4 tl) (string-to-number (format-time-string "%m"))) 4331 month (or (nth 4 tl) (string-to-number (format-time-string "%m" ct)))
4014 day (or (nth 3 tl) (string-to-number (format-time-string "%d"))) 4332 day (or (nth 3 tl) (string-to-number (format-time-string "%d" ct)))
4015 hour (or (nth 2 tl) (string-to-number (format-time-string "%H"))) 4333 hour (or (nth 2 tl) (string-to-number (format-time-string "%H" ct)))
4016 minute (or (nth 1 tl) (string-to-number (format-time-string "%M"))) 4334 minute (or (nth 1 tl) (string-to-number (format-time-string "%M" ct)))
4017 second (or (nth 0 tl) 0)) 4335 second (or (nth 0 tl) 0)
4336 wday (nth 6 tl))
4337 (when (and wday (not (nth 3 tl)))
4338 ;; Weekday was given, but no day, so pick that day in the week
4339 ;; on or after the derived date.
4340 (setq wday1 (nth 6 (decode-time (encode-time 0 0 0 day month year))))
4341 (unless (equal wday wday1)
4342 (setq day (+ day (% (- wday wday1 -7) 7)))))
4018 (if (and (boundp 'org-time-was-given) 4343 (if (and (boundp 'org-time-was-given)
4019 (nth 2 tl)) 4344 (nth 2 tl))
4020 (setq org-time-was-given t)) 4345 (setq org-time-was-given t))
@@ -4118,8 +4443,6 @@ days in order to avoid rounding problems."
4118 (fd1 "%dd") 4443 (fd1 "%dd")
4119 (fh "%02d:%02d") 4444 (fh "%02d:%02d")
4120 y d h m align) 4445 y d h m align)
4121 ;; FIXME: Should I re-introduce years, make year refer to same date?
4122 ;; This would be the only useful way to have years, actually.
4123 (if havetime 4446 (if havetime
4124 (setq ; y (floor (/ diff ys)) diff (mod diff ys) 4447 (setq ; y (floor (/ diff ys)) diff (mod diff ys)
4125 y 0 4448 y 0
@@ -4336,7 +4659,7 @@ If there is already a time stamp at the cursor position, update it."
4336(defvar org-agenda-mode-map (make-sparse-keymap) 4659(defvar org-agenda-mode-map (make-sparse-keymap)
4337 "Keymap for `org-agenda-mode'.") 4660 "Keymap for `org-agenda-mode'.")
4338 4661
4339(defvar org-agenda-menu) 4662(defvar org-agenda-menu) ; defined later in this file.
4340(defvar org-agenda-follow-mode nil) 4663(defvar org-agenda-follow-mode nil)
4341(defvar org-agenda-show-log nil) 4664(defvar org-agenda-show-log nil)
4342(defvar org-agenda-buffer-name "*Org Agenda*") 4665(defvar org-agenda-buffer-name "*Org Agenda*")
@@ -4372,7 +4695,7 @@ The following commands are available:
4372 (if (get 'org-agenda-files 'org-restrict) 4695 (if (get 'org-agenda-files 'org-restrict)
4373 "Restricted to single file" 4696 "Restricted to single file"
4374 "Edit File List") 4697 "Edit File List")
4375 '(customize-variable 'org-agenda-files) 4698 '(org-edit-agenda-file-list)
4376 (not (get 'org-agenda-files 'org-restrict))) 4699 (not (get 'org-agenda-files 'org-restrict)))
4377 "--") 4700 "--")
4378 (mapcar 'org-file-menu-entry (org-agenda-files)))) 4701 (mapcar 'org-file-menu-entry (org-agenda-files))))
@@ -4443,9 +4766,9 @@ The following commands are available:
4443 "Local keymap for agenda entries from Org-mode.") 4766 "Local keymap for agenda entries from Org-mode.")
4444 4767
4445(define-key org-agenda-keymap 4768(define-key org-agenda-keymap
4446 (if org-xemacs-p [(button2)] [(mouse-2)]) 'org-agenda-goto-mouse) 4769 (if (featurep 'xemacs) [(button2)] [(mouse-2)]) 'org-agenda-goto-mouse)
4447(define-key org-agenda-keymap 4770(define-key org-agenda-keymap
4448 (if org-xemacs-p [(button3)] [(mouse-3)]) 'org-agenda-show-mouse) 4771 (if (featurep 'xemacs) [(button3)] [(mouse-3)]) 'org-agenda-show-mouse)
4449(define-key org-agenda-keymap [follow-link] 'mouse-face) 4772(define-key org-agenda-keymap [follow-link] 'mouse-face)
4450(easy-menu-define org-agenda-menu org-agenda-mode-map "Agenda menu" 4773(easy-menu-define org-agenda-menu org-agenda-mode-map "Agenda menu"
4451 '("Agenda" 4774 '("Agenda"
@@ -4553,7 +4876,7 @@ C Configure your own agenda commands")
4553 ((eq type 'todo-tree) "TODO kwd tree") 4876 ((eq type 'todo-tree) "TODO kwd tree")
4554 ((eq type 'occur-tree) "Occur tree") 4877 ((eq type 'occur-tree) "Occur tree")
4555 (t "???")) 4878 (t "???"))
4556 (org-string-props string 'face 'org-link)))) 4879 (org-add-props string nil 'face 'org-warning))))
4557 (goto-char (point-min)) 4880 (goto-char (point-min))
4558 (if (fboundp 'fit-window-to-buffer) (fit-window-to-buffer)) 4881 (if (fboundp 'fit-window-to-buffer) (fit-window-to-buffer))
4559 (message "Press key for agenda command%s" 4882 (message "Press key for agenda command%s"
@@ -4614,10 +4937,58 @@ C Configure your own agenda commands")
4614 (fit-window-to-buffer nil (/ (* (frame-height) 3) 4) 4937 (fit-window-to-buffer nil (/ (* (frame-height) 3) 4)
4615 (/ (frame-height) 2)))) 4938 (/ (frame-height) 2))))
4616 4939
4617(defun org-agenda-files () 4940(defun org-agenda-files (&optional unrestricted)
4618 "Get the list of agenda files." 4941 "Get the list of agenda files.
4619 (or (get 'org-agenda-files 'org-restrict) 4942Optional UNRESTRICTED means return the full list even if a restriction
4620 org-agenda-files)) 4943is currently in place."
4944 (cond
4945 ((and (not unrestricted) (get 'org-agenda-files 'org-restrict)))
4946 ((stringp org-agenda-files) (org-read-agenda-file-list))
4947 ((listp org-agenda-files) org-agenda-files)
4948 (t (error "Invalid value of `org-agenda-files'"))))
4949
4950(defvar org-window-configuration)
4951
4952(defun org-edit-agenda-file-list ()
4953 "Edit the list of agenda files.
4954Depending on setup, this either uses customize to edit the variable
4955`org-agenda-files', or it visits the file that is holding the list. In the
4956latter case, the buffer is set up in a way that saving it automatically kills
4957the buffer and restores the previous window configuration."
4958 (interactive)
4959 (if (stringp org-agenda-files)
4960 (let ((cw (current-window-configuration)))
4961 (find-file org-agenda-files)
4962 (set (make-local-variable 'org-window-configuration) cw)
4963 (org-add-hook 'after-save-hook
4964 (lambda ()
4965 (set-window-configuration
4966 (prog1 org-window-configuration
4967 (kill-buffer (current-buffer))))
4968 (org-install-agenda-files-menu)
4969 (message "New agenda file list installed"))
4970 nil 'local)
4971 (message (substitute-command-keys
4972 "Edit list and finish with \\[save-buffer]")))
4973 (customize-variable 'org-agenda-files)))
4974
4975(defun org-store-new-agenda-file-list (list)
4976 "Set new value for the agenda file list and save it correcly."
4977 (if (stringp org-agenda-files)
4978 (let ((f org-agenda-files) b)
4979 (while (setq b (find-buffer-visiting f)) (kill-buffer b))
4980 (with-temp-file f
4981 (insert (mapconcat 'identity list "\n") "\n")))
4982 (let ((org-mode-hook nil) (default-major-mode 'fundamental-mode))
4983 (setq org-agenda-files list)
4984 (customize-save-variable 'org-agenda-files org-agenda-files))))
4985
4986(defun org-read-agenda-file-list ()
4987 "Read the list of agenda files from a file."
4988 (when (stringp org-agenda-files)
4989 (with-temp-buffer
4990 (insert-file-contents org-agenda-files)
4991 (org-split-string (buffer-string) "[ \t\r\n]*?[\r\n][ \t\r\n]*"))))
4621 4992
4622(defvar org-agenda-markers nil 4993(defvar org-agenda-markers nil
4623 "List of all currently active markers created by `org-agenda'.") 4994 "List of all currently active markers created by `org-agenda'.")
@@ -4736,7 +5107,7 @@ dates."
4736 (calendar-month-name (extract-calendar-month date)) " " 5107 (calendar-month-name (extract-calendar-month date)) " "
4737 (number-to-string (extract-calendar-year date)) "\n") 5108 (number-to-string (extract-calendar-year date)) "\n")
4738 (put-text-property s (1- (point)) 'face 5109 (put-text-property s (1- (point)) 'face
4739 'org-link) 5110 'org-level-3)
4740 (if (equal d today) 5111 (if (equal d today)
4741 (put-text-property s (1- (point)) 'org-today t)) 5112 (put-text-property s (1- (point)) 'org-today t))
4742 (insert (org-finalize-agenda-entries rtn) "\n") 5113 (insert (org-finalize-agenda-entries rtn) "\n")
@@ -4771,7 +5142,8 @@ NDAYS defaults to `org-agenda-ndays'."
4771 (and (null ndays) (equal 1 org-agenda-ndays))) 5142 (and (null ndays) (equal 1 org-agenda-ndays)))
4772 nil org-agenda-start-on-weekday)) 5143 nil org-agenda-start-on-weekday))
4773 (org-agenda-keep-modes keep-modes) 5144 (org-agenda-keep-modes keep-modes)
4774 (files (copy-sequence (org-agenda-files))) 5145 (thefiles (org-agenda-files))
5146 (files thefiles)
4775 (win (selected-window)) 5147 (win (selected-window))
4776 (today (time-to-days (current-time))) 5148 (today (time-to-days (current-time)))
4777 (sd (or start-day today)) 5149 (sd (or start-day today))
@@ -4784,7 +5156,7 @@ NDAYS defaults to `org-agenda-ndays'."
4784 (d (- nt n1))) 5156 (d (- nt n1)))
4785 (- sd (+ (if (< d 0) 7 0) d))))) 5157 (- sd (+ (if (< d 0) 7 0) d)))))
4786 (day-numbers (list start)) 5158 (day-numbers (list start))
4787 (inhibit-redisplay t) 5159;FIXME (inhibit-redisplay t)
4788 s e rtn rtnall file date d start-pos end-pos todayp nd) 5160 s e rtn rtnall file date d start-pos end-pos todayp nd)
4789 (setq org-agenda-redo-command 5161 (setq org-agenda-redo-command
4790 (list 'org-agenda-list (list 'quote include-all) start-day ndays t)) 5162 (list 'org-agenda-list (list 'quote include-all) start-day ndays t))
@@ -4808,7 +5180,7 @@ NDAYS defaults to `org-agenda-ndays'."
4808 (set (make-local-variable 'include-all-loc) include-all) 5180 (set (make-local-variable 'include-all-loc) include-all)
4809 (when (and (or include-all org-agenda-include-all-todo) 5181 (when (and (or include-all org-agenda-include-all-todo)
4810 (member today day-numbers)) 5182 (member today day-numbers))
4811 (setq files (org-agenda-files) 5183 (setq files thefiles
4812 rtnall nil) 5184 rtnall nil)
4813 (while (setq file (pop files)) 5185 (while (setq file (pop files))
4814 (catch 'nextfile 5186 (catch 'nextfile
@@ -4820,7 +5192,7 @@ NDAYS defaults to `org-agenda-ndays'."
4820 (when rtnall 5192 (when rtnall
4821 (insert "ALL CURRENTLY OPEN TODO ITEMS:\n") 5193 (insert "ALL CURRENTLY OPEN TODO ITEMS:\n")
4822 (add-text-properties (point-min) (1- (point)) 5194 (add-text-properties (point-min) (1- (point))
4823 (list 'face 'org-link)) 5195 (list 'face 'org-level-3))
4824 (insert (org-finalize-agenda-entries rtnall) "\n"))) 5196 (insert (org-finalize-agenda-entries rtnall) "\n")))
4825 (while (setq d (pop day-numbers)) 5197 (while (setq d (pop day-numbers))
4826 (setq date (calendar-gregorian-from-absolute d) 5198 (setq date (calendar-gregorian-from-absolute d)
@@ -4830,7 +5202,7 @@ NDAYS defaults to `org-agenda-ndays'."
4830 (setq start-pos (point)) 5202 (setq start-pos (point))
4831 (if (and start-pos (not end-pos)) 5203 (if (and start-pos (not end-pos))
4832 (setq end-pos (point)))) 5204 (setq end-pos (point))))
4833 (setq files (org-agenda-files) 5205 (setq files thefiles
4834 rtnall nil) 5206 rtnall nil)
4835 (while (setq file (pop files)) 5207 (while (setq file (pop files))
4836 (catch 'nextfile 5208 (catch 'nextfile
@@ -4856,7 +5228,7 @@ NDAYS defaults to `org-agenda-ndays'."
4856 (calendar-month-name (extract-calendar-month date)) 5228 (calendar-month-name (extract-calendar-month date))
4857 (extract-calendar-year date))) 5229 (extract-calendar-year date)))
4858 (put-text-property s (1- (point)) 'face 5230 (put-text-property s (1- (point)) 'face
4859 'org-link) 5231 'org-level-3)
4860 (if rtnall (insert 5232 (if rtnall (insert
4861 (org-finalize-agenda-entries 5233 (org-finalize-agenda-entries
4862 (org-agenda-add-time-grid-maybe 5234 (org-agenda-add-time-grid-maybe
@@ -4927,7 +5299,7 @@ for a keyword. A numeric prefix directly selects the Nth keyword in
4927 (setq rtnall (append rtnall rtn)))) 5299 (setq rtnall (append rtnall rtn))))
4928 (insert "Global list of TODO items of type: ") 5300 (insert "Global list of TODO items of type: ")
4929 (add-text-properties (point-min) (1- (point)) 5301 (add-text-properties (point-min) (1- (point))
4930 (list 'face 'org-link)) 5302 (list 'face 'org-level-3))
4931 (setq pos (point)) 5303 (setq pos (point))
4932 (insert (or org-select-this-todo-keyword "ALL") "\n") 5304 (insert (or org-select-this-todo-keyword "ALL") "\n")
4933 (add-text-properties pos (1- (point)) (list 'face 'org-warning)) 5305 (add-text-properties pos (1- (point)) (list 'face 'org-warning))
@@ -4939,7 +5311,7 @@ for a keyword. A numeric prefix directly selects the Nth keyword in
4939 (format "(%d)%s" (setq n (1+ n)) x)) 5311 (format "(%d)%s" (setq n (1+ n)) x))
4940 org-todo-keywords " ")) 5312 org-todo-keywords " "))
4941 "\n") 5313 "\n")
4942 (add-text-properties pos (1- (point)) (list 'face 'org-link)) 5314 (add-text-properties pos (1- (point)) (list 'face 'org-level-3))
4943 (when rtnall 5315 (when rtnall
4944 (insert (org-finalize-agenda-entries rtnall) "\n")) 5316 (insert (org-finalize-agenda-entries rtnall) "\n"))
4945 (goto-char (point-min)) 5317 (goto-char (point-min))
@@ -4949,12 +5321,9 @@ for a keyword. A numeric prefix directly selects the Nth keyword in
4949 5321
4950(defun org-check-agenda-file (file) 5322(defun org-check-agenda-file (file)
4951 "Make sure FILE exists. If not, ask user what to do." 5323 "Make sure FILE exists. If not, ask user what to do."
4952 ;; FIXME: this does not correctly change the menus
4953 ;; Could probably be fixed by explicitly going to the buffer where
4954 ;; the call originated.
4955 (when (not (file-exists-p file)) 5324 (when (not (file-exists-p file))
4956 (message "non-existent file %s. [R]emove from agenda-files or [A]bort?" 5325 (message "non-existent file %s. [R]emove from list or [A]bort?"
4957 file) 5326 (abbreviate-file-name file))
4958 (let ((r (downcase (read-char-exclusive)))) 5327 (let ((r (downcase (read-char-exclusive))))
4959 (cond 5328 (cond
4960 ((equal r ?r) 5329 ((equal r ?r)
@@ -5075,12 +5444,12 @@ With prefix ARG, go back that many times `org-agenda-ndays'."
5075 5444
5076(defun org-highlight (begin end &optional buffer) 5445(defun org-highlight (begin end &optional buffer)
5077 "Highlight a region with overlay." 5446 "Highlight a region with overlay."
5078 (funcall (if org-xemacs-p 'set-extent-endpoints 'move-overlay) 5447 (funcall (if (featurep 'xemacs) 'set-extent-endpoints 'move-overlay)
5079 org-hl begin end (or buffer (current-buffer)))) 5448 org-hl begin end (or buffer (current-buffer))))
5080 5449
5081(defun org-unhighlight () 5450(defun org-unhighlight ()
5082 "Detach overlay INDEX." 5451 "Detach overlay INDEX."
5083 (funcall (if org-xemacs-p 'detach-extent 'delete-overlay) org-hl)) 5452 (funcall (if (featurep 'xemacs) 'detach-extent 'delete-overlay) org-hl))
5084 5453
5085 5454
5086(defun org-agenda-follow-mode () 5455(defun org-agenda-follow-mode ()
@@ -5176,11 +5545,7 @@ With prefix ARG, go back that many times `org-agenda-ndays'."
5176 (lambda (x) 5545 (lambda (x)
5177 (setq x (org-format-agenda-item "" x "Diary" nil 'time)) 5546 (setq x (org-format-agenda-item "" x "Diary" nil 'time))
5178 ;; Extend the text properties to the beginning of the line 5547 ;; Extend the text properties to the beginning of the line
5179 (add-text-properties 5548 (org-add-props x (text-properties-at (1- (length x)) x)))
5180 0 (length x)
5181 (text-properties-at (1- (length x)) x)
5182 x)
5183 x)
5184 entries))))) 5549 entries)))))
5185 5550
5186(defun org-agenda-cleanup-fancy-diary () 5551(defun org-agenda-cleanup-fancy-diary ()
@@ -5219,18 +5584,13 @@ date. It also removes lines that contain only whitespace."
5219 5584
5220(defun org-modify-diary-entry-string (string) 5585(defun org-modify-diary-entry-string (string)
5221 "Add text properties to string, allowing org-mode to act on it." 5586 "Add text properties to string, allowing org-mode to act on it."
5222 (add-text-properties 5587 (org-add-props string nil
5223 0 (length string) 5588 'mouse-face 'highlight
5224 (list 'mouse-face 'highlight 5589 'keymap org-agenda-keymap
5225 'keymap org-agenda-keymap 5590 'help-echo (format "mouse-2 or RET jump to diary file %s"
5226 'help-echo 5591 (abbreviate-file-name buffer-file-name))
5227 (format 5592 'org-agenda-diary-link t
5228 "mouse-2 or RET jump to diary file %s" 5593 'org-marker (org-agenda-new-marker (point-at-bol))))
5229 (abbreviate-file-name buffer-file-name))
5230 'org-agenda-diary-link t
5231 'org-marker (org-agenda-new-marker (point-at-bol)))
5232 string)
5233 string)
5234 5594
5235(defun org-diary-default-entry () 5595(defun org-diary-default-entry ()
5236 "Add a dummy entry to the diary. 5596 "Add a dummy entry to the diary.
@@ -5247,9 +5607,10 @@ Needed to avoid empty dates which mess up holiday display."
5247If the current buffer visits an agenda file, find the next one in the list. 5607If the current buffer visits an agenda file, find the next one in the list.
5248If the current buffer does not, find the first agenda file." 5608If the current buffer does not, find the first agenda file."
5249 (interactive) 5609 (interactive)
5250 (let ((files (append org-agenda-files (list (car org-agenda-files)))) 5610 (let* ((fs (org-agenda-files t))
5251 (tcf (if buffer-file-name (file-truename buffer-file-name))) 5611 (files (append fs (list (car fs))))
5252 file) 5612 (tcf (if buffer-file-name (file-truename buffer-file-name)))
5613 file)
5253 (unless files (error "No agenda files")) 5614 (unless files (error "No agenda files"))
5254 (catch 'exit 5615 (catch 'exit
5255 (while (setq file (pop files)) 5616 (while (setq file (pop files))
@@ -5257,7 +5618,7 @@ If the current buffer does not, find the first agenda file."
5257 (when (car files) 5618 (when (car files)
5258 (find-file (car files)) 5619 (find-file (car files))
5259 (throw 'exit t)))) 5620 (throw 'exit t))))
5260 (find-file (car org-agenda-files))))) 5621 (find-file (car fs)))))
5261 5622
5262(defun org-agenda-file-to-end () 5623(defun org-agenda-file-to-end ()
5263 "Move/add the current file to the end of the agenda file list. 5624 "Move/add the current file to the end of the agenda file list.
@@ -5274,7 +5635,7 @@ end of the list."
5274 (interactive "P") 5635 (interactive "P")
5275 (let ((file-alist (mapcar (lambda (x) 5636 (let ((file-alist (mapcar (lambda (x)
5276 (cons (file-truename x) x)) 5637 (cons (file-truename x) x))
5277 org-agenda-files)) 5638 (org-agenda-files t)))
5278 (ctf (file-truename buffer-file-name)) 5639 (ctf (file-truename buffer-file-name))
5279 x had) 5640 x had)
5280 (setq x (assoc ctf file-alist) had x) 5641 (setq x (assoc ctf file-alist) had x)
@@ -5283,9 +5644,7 @@ end of the list."
5283 (if to-end 5644 (if to-end
5284 (setq file-alist (append (delq x file-alist) (list x))) 5645 (setq file-alist (append (delq x file-alist) (list x)))
5285 (setq file-alist (cons x (delq x file-alist)))) 5646 (setq file-alist (cons x (delq x file-alist))))
5286 (setq org-agenda-files (mapcar 'cdr file-alist)) 5647 (org-store-new-agenda-file-list (mapcar 'cdr file-alist))
5287 (let ((org-mode-hook nil) (default-major-mode 'fundamental-mode))
5288 (customize-save-variable 'org-agenda-files org-agenda-files))
5289 (org-install-agenda-files-menu) 5648 (org-install-agenda-files-menu)
5290 (message "File %s to %s of agenda file list" 5649 (message "File %s to %s of agenda file list"
5291 (if had "moved" "added") (if to-end "end" "front")))) 5650 (if had "moved" "added") (if to-end "end" "front"))))
@@ -5303,20 +5662,16 @@ Optional argument FILE means, use this file instead of the current."
5303 (if (equal true-file 5662 (if (equal true-file
5304 (file-truename x)) 5663 (file-truename x))
5305 nil x)) 5664 nil x))
5306 org-agenda-files)))) 5665 (org-agenda-files t)))))
5307 (if (not (= (length files) (length org-agenda-files))) 5666 (if (not (= (length files) (length (org-agenda-files t))))
5308 (progn 5667 (progn
5309 (setq org-agenda-files files) 5668 (org-store-new-agenda-file-list files)
5310 (customize-save-variable 'org-agenda-files org-agenda-files)
5311 (org-install-agenda-files-menu) 5669 (org-install-agenda-files-menu)
5312 (message "Removed file: %s" afile)) 5670 (message "Removed file: %s" afile))
5313 (message "File was not in list: %s" afile)))) 5671 (message "File was not in list: %s" afile))))
5314 5672
5315(defun org-file-menu-entry (file) 5673(defun org-file-menu-entry (file)
5316 (vector file (list 'find-file file) t)) 5674 (vector file (list 'find-file file) t))
5317;; FIXME: Maybe we removed a buffer visited through the menu from
5318;; org-agenda-new-buffers, so that the buffer will not be removed
5319;; when exiting the agenda????
5320 5675
5321(defun org-get-all-dates (beg end &optional no-ranges force-today inactive) 5676(defun org-get-all-dates (beg end &optional no-ranges force-today inactive)
5322 "Return a list of all relevant day numbers from BEG to END buffer positions. 5677 "Return a list of all relevant day numbers from BEG to END buffer positions.
@@ -5394,7 +5749,7 @@ function from a program - use `org-agenda-get-day-entries' instead."
5394 (setq args (or args '(:deadline :scheduled :timestamp))) 5749 (setq args (or args '(:deadline :scheduled :timestamp)))
5395 (let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry)) 5750 (let* ((files (if (and entry (stringp entry) (string-match "\\S-" entry))
5396 (list entry) 5751 (list entry)
5397 org-agenda-files)) 5752 (org-agenda-files t)))
5398 file rtn results) 5753 file rtn results)
5399 ;; If this is called during org-agenda, don't return any entries to 5754 ;; If this is called during org-agenda, don't return any entries to
5400 ;; the calendar. Org Agenda will list these entries itself. 5755 ;; the calendar. Org Agenda will list these entries itself.
@@ -5441,6 +5796,7 @@ the documentation of `org-diary'."
5441 (setq args (or args '(:deadline :scheduled :timestamp))) 5796 (setq args (or args '(:deadline :scheduled :timestamp)))
5442 (let* ((org-startup-with-deadline-check nil) 5797 (let* ((org-startup-with-deadline-check nil)
5443 (org-startup-folded nil) 5798 (org-startup-folded nil)
5799 (org-startup-align-all-tables nil)
5444 (buffer (if (file-exists-p file) 5800 (buffer (if (file-exists-p file)
5445 (org-get-agenda-file-buffer file) 5801 (org-get-agenda-file-buffer file)
5446 (error "No such file %s" file))) 5802 (error "No such file %s" file)))
@@ -5541,11 +5897,9 @@ the documentation of `org-diary'."
5541 (length 5897 (length
5542 (member (match-string 2) org-todo-keywords))) 5898 (member (match-string 2) org-todo-keywords)))
5543 1))) 5899 1)))
5544 (add-text-properties 5900 (org-add-props txt props
5545 0 (length txt) (append (list 'org-marker marker 'org-hd-marker marker 5901 'org-marker marker 'org-hd-marker marker
5546 'priority priority 'category category) 5902 'priority priority 'category category)
5547 props)
5548 txt)
5549 (push txt ee) 5903 (push txt ee)
5550 (goto-char (match-end 1))) 5904 (goto-char (match-end 1)))
5551 (nreverse ee))) 5905 (nreverse ee)))
@@ -5601,32 +5955,19 @@ the documentation of `org-diary'."
5601 (match-string 1) category tags timestr))) 5955 (match-string 1) category tags timestr)))
5602 (setq txt org-agenda-no-heading-message)) 5956 (setq txt org-agenda-no-heading-message))
5603 (setq priority (org-get-priority txt)) 5957 (setq priority (org-get-priority txt))
5604 (add-text-properties 5958 (org-add-props txt props
5605 0 (length txt) (append (list 'org-marker marker 5959 'org-marker marker 'org-hd-marker hdmarker)
5606 'org-hd-marker hdmarker) props)
5607 txt)
5608 (if deadlinep 5960 (if deadlinep
5609 (add-text-properties 5961 (org-add-props txt nil
5610 0 (length txt) 5962 'face (if donep 'org-done 'org-warning)
5611 (list 'face 5963 'undone-face 'org-warning 'done-face 'org-done
5612 (if donep 'org-done 'org-warning) 5964 'category category 'priority (+ 100 priority))
5613 'undone-face 'org-warning
5614 'done-face 'org-done
5615 'category category
5616 'priority (+ 100 priority))
5617 txt)
5618 (if scheduledp 5965 (if scheduledp
5619 (add-text-properties 5966 (org-add-props txt nil
5620 0 (length txt) 5967 'face 'org-scheduled-today
5621 (list 'face 'org-scheduled-today 5968 'undone-face 'org-scheduled-today 'done-face 'org-done
5622 'undone-face 'org-scheduled-today 5969 'category category priority (+ 99 priority))
5623 'done-face 'org-done 5970 (org-add-props txt nil 'priority priority 'category category)))
5624 'category category
5625 priority (+ 99 priority))
5626 txt)
5627 (add-text-properties
5628 0 (length txt)
5629 (list 'priority priority 'category category) txt)))
5630 (push txt ee)) 5971 (push txt ee))
5631 (outline-next-heading)))) 5972 (outline-next-heading))))
5632 (nreverse ee))) 5973 (nreverse ee)))
@@ -5673,15 +6014,10 @@ the documentation of `org-diary'."
5673 (match-string 1) category tags timestr))) 6014 (match-string 1) category tags timestr)))
5674 (setq txt org-agenda-no-heading-message)) 6015 (setq txt org-agenda-no-heading-message))
5675 (setq priority 100000) 6016 (setq priority 100000)
5676 (add-text-properties 6017 (org-add-props txt props
5677 0 (length txt) (append (list 'org-marker marker 6018 'org-marker marker 'org-hd-marker hdmarker 'face 'org-done
5678 'org-hd-marker hdmarker 6019 'priority priority 'category category
5679 'face 'org-done 6020 'undone-face 'org-warning 'done-face 'org-done)
5680 'priority priority
5681 'category category
5682 'undone-face 'org-warning
5683 'done-face 'org-done) props)
5684 txt)
5685 (push txt ee)) 6021 (push txt ee))
5686 (outline-next-heading)))) 6022 (outline-next-heading))))
5687 (nreverse ee))) 6023 (nreverse ee)))
@@ -5726,23 +6062,19 @@ the documentation of `org-diary'."
5726 (format "In %3d d.: " diff) head category tags)))) 6062 (format "In %3d d.: " diff) head category tags))))
5727 (setq txt org-agenda-no-heading-message)) 6063 (setq txt org-agenda-no-heading-message))
5728 (when txt 6064 (when txt
5729 (add-text-properties 6065 (org-add-props txt props
5730 0 (length txt) 6066 'org-marker (org-agenda-new-marker pos)
5731 (append 6067 'org-hd-marker (org-agenda-new-marker pos1)
5732 (list 'org-marker (org-agenda-new-marker pos) 6068 'priority (+ (- 10 diff) (org-get-priority txt))
5733 'org-hd-marker (org-agenda-new-marker pos1) 6069 'category category
5734 'priority (+ (- 10 diff) (org-get-priority txt)) 6070 'face (cond ((<= diff 0) 'org-warning)
5735 'category category 6071 ((<= diff 5) 'org-scheduled-previously)
5736 'face (cond ((<= diff 0) 'org-warning) 6072 (t nil))
5737 ((<= diff 5) 'org-scheduled-previously) 6073 'undone-face (cond
5738 (t nil)) 6074 ((<= diff 0) 'org-warning)
5739 'undone-face (cond 6075 ((<= diff 5) 'org-scheduled-previously)
5740 ((<= diff 0) 'org-warning) 6076 (t nil))
5741 ((<= diff 5) 'org-scheduled-previously) 6077 'done-face 'org-done)
5742 (t nil))
5743 'done-face 'org-done)
5744 props)
5745 txt)
5746 (push txt ee))))) 6078 (push txt ee)))))
5747 ee)) 6079 ee))
5748 6080
@@ -5787,13 +6119,11 @@ the documentation of `org-diary'."
5787 category tags)))) 6119 category tags))))
5788 (setq txt org-agenda-no-heading-message)) 6120 (setq txt org-agenda-no-heading-message))
5789 (when txt 6121 (when txt
5790 (add-text-properties 6122 (org-add-props txt props
5791 0 (length txt) 6123 'org-marker (org-agenda-new-marker pos)
5792 (append (list 'org-marker (org-agenda-new-marker pos) 6124 'org-hd-marker (org-agenda-new-marker pos1)
5793 'org-hd-marker (org-agenda-new-marker pos1) 6125 'priority (+ (- 5 diff) (org-get-priority txt))
5794 'priority (+ (- 5 diff) (org-get-priority txt)) 6126 'category category)
5795 'category category)
5796 props) txt)
5797 (push txt ee))))) 6127 (push txt ee)))))
5798 ee)) 6128 ee))
5799 6129
@@ -5833,13 +6163,9 @@ the documentation of `org-diary'."
5833 (match-string 1) category tags 6163 (match-string 1) category tags
5834 (if (= d0 d1) timestr)))) 6164 (if (= d0 d1) timestr))))
5835 (setq txt org-agenda-no-heading-message)) 6165 (setq txt org-agenda-no-heading-message))
5836 (add-text-properties 6166 (org-add-props txt props
5837 0 (length txt) (append (list 'org-marker marker 6167 'org-marker marker 'org-hd-marker hdmarker
5838 'org-hd-marker hdmarker 6168 'priority (org-get-priority txt) 'category category)
5839 'priority (org-get-priority txt)
5840 'category category)
5841 props)
5842 txt)
5843 (push txt ee))) 6169 (push txt ee)))
5844 (outline-next-heading)) 6170 (outline-next-heading))
5845 ;; Sort the entries by expiration date. 6171 ;; Sort the entries by expiration date.
@@ -5946,14 +6272,11 @@ only the correctly processes TXT should be returned - this is used by
5946 (setq rtn (concat (eval org-prefix-format-compiled) txt))) 6272 (setq rtn (concat (eval org-prefix-format-compiled) txt)))
5947 6273
5948 ;; And finally add the text properties 6274 ;; And finally add the text properties
5949 (add-text-properties 6275 (org-add-props rtn nil
5950 0 (length rtn) (list 'category (downcase category) 6276 'category (downcase category) 'tags tags
5951 'tags tags 6277 'prefix-length (- (length rtn) (length txt))
5952 'prefix-length (- (length rtn) (length txt)) 6278 'time-of-day time-of-day
5953 'time-of-day time-of-day 6279 'dotime dotime))))
5954 'dotime dotime)
5955 rtn)
5956 rtn)))
5957 6280
5958(defun org-agenda-add-time-grid-maybe (list ndays todayp) 6281(defun org-agenda-add-time-grid-maybe (list ndays todayp)
5959 (catch 'exit 6282 (catch 'exit
@@ -5977,7 +6300,7 @@ only the correctly processes TXT should be returned - this is used by
5977 (unless (and remove (member time have)) 6300 (unless (and remove (member time have))
5978 (setq time (int-to-string time)) 6301 (setq time (int-to-string time))
5979 (push (org-format-agenda-item 6302 (push (org-format-agenda-item
5980 nil string "" nil ;; FIXME: put a category for the grid? 6303 nil string "" nil
5981 (concat (substring time 0 -2) ":" (substring time -2))) 6304 (concat (substring time 0 -2) ":" (substring time -2)))
5982 new) 6305 new)
5983 (put-text-property 6306 (put-text-property
@@ -6078,7 +6401,7 @@ HH:MM."
6078 (priority-down (if priority-up (- priority-up) nil)) 6401 (priority-down (if priority-up (- priority-up) nil))
6079 (category-up (org-cmp-category a b)) 6402 (category-up (org-cmp-category a b))
6080 (category-down (if category-up (- category-up) nil)) 6403 (category-down (if category-up (- category-up) nil))
6081 (category-keep (if category-up +1 nil))) ; FIXME +1 or -1? 6404 (category-keep (if category-up +1 nil)))
6082 (cdr (assoc 6405 (cdr (assoc
6083 (eval (cons 'or org-agenda-sorting-strategy)) 6406 (eval (cons 'or org-agenda-sorting-strategy))
6084 '((-1 . t) (1 . nil) (nil . nil)))))) 6407 '((-1 . t) (1 . nil) (nil . nil))))))
@@ -6370,7 +6693,6 @@ be used to request time specification in the time stamp."
6370 "Return the heading of the current entry, without the stars." 6693 "Return the heading of the current entry, without the stars."
6371 (save-excursion 6694 (save-excursion
6372 (and (memq (char-before) '(?\n ?\r)) (skip-chars-forward "^\n\r")) 6695 (and (memq (char-before) '(?\n ?\r)) (skip-chars-forward "^\n\r"))
6373;;FIXME???????? (and (bolp) (end-of-line 1))
6374 (if (and (re-search-backward "[\r\n]\\*" nil t) 6696 (if (and (re-search-backward "[\r\n]\\*" nil t)
6375 (looking-at "[\r\n]\\*+[ \t]+\\([^\r\n]*\\)")) 6697 (looking-at "[\r\n]\\*+[ \t]+\\([^\r\n]*\\)"))
6376 (match-string 1) 6698 (match-string 1)
@@ -6576,12 +6898,8 @@ are included in the output."
6576 category tags-list)) 6898 category tags-list))
6577 (goto-char lspos) 6899 (goto-char lspos)
6578 (setq marker (org-agenda-new-marker)) 6900 (setq marker (org-agenda-new-marker))
6579 (add-text-properties 6901 (org-add-props txt props
6580 0 (length txt) 6902 'org-marker marker 'org-hd-marker marker 'category category)
6581 (append (list 'org-marker marker 'org-hd-marker marker
6582 'category category)
6583 props)
6584 txt)
6585 (push txt rtn)) 6903 (push txt rtn))
6586 ;; if we are to skip sublevels, jump to end of subtree 6904 ;; if we are to skip sublevels, jump to end of subtree
6587 (point) 6905 (point)
@@ -6683,13 +7001,13 @@ The prefix arg TODO-ONLY limits the search to TODO entries."
6683 (setq rtnall (append rtnall rtn)))))))) 7001 (setq rtnall (append rtnall rtn))))))))
6684 (insert "Headlines with TAGS match: ") 7002 (insert "Headlines with TAGS match: ")
6685 (add-text-properties (point-min) (1- (point)) 7003 (add-text-properties (point-min) (1- (point))
6686 (list 'face 'org-link)) 7004 (list 'face 'org-level-3))
6687 (setq pos (point)) 7005 (setq pos (point))
6688 (insert match "\n") 7006 (insert match "\n")
6689 (add-text-properties pos (1- (point)) (list 'face 'org-warning)) 7007 (add-text-properties pos (1- (point)) (list 'face 'org-warning))
6690 (setq pos (point)) 7008 (setq pos (point))
6691 (insert "Press `C-u r' to search again with new search string\n") 7009 (insert "Press `C-u r' to search again with new search string\n")
6692 (add-text-properties pos (1- (point)) (list 'face 'org-link)) 7010 (add-text-properties pos (1- (point)) (list 'face 'org-level-3))
6693 (when rtnall 7011 (when rtnall
6694 (insert (mapconcat 'identity rtnall "\n"))) 7012 (insert (mapconcat 'identity rtnall "\n")))
6695 (goto-char (point-min)) 7013 (goto-char (point-min))
@@ -6724,7 +7042,7 @@ With prefix ARG, realign all tags in headings in the current buffer."
6724 nil nil current 'org-tags-history))) 7042 nil nil current 'org-tags-history)))
6725 (while (string-match "[-+&]+" tags) 7043 (while (string-match "[-+&]+" tags)
6726 (setq tags (replace-match ":" t t tags)))) 7044 (setq tags (replace-match ":" t t tags))))
6727 ;; FIXME: still optimize this byt not checking when JUST-ALIGN? 7045 ;; FIXME: still optimize this by not checking when JUST-ALIGN?
6728 (unless (setq empty (string-match "\\`[\t ]*\\'" tags)) 7046 (unless (setq empty (string-match "\\`[\t ]*\\'" tags))
6729 (unless (string-match ":$" tags) (setq tags (concat tags ":"))) 7047 (unless (string-match ":$" tags) (setq tags (concat tags ":")))
6730 (unless (string-match "^:" tags) (setq tags (concat ":" tags)))) 7048 (unless (string-match "^:" tags) (setq tags (concat ":" tags))))
@@ -6738,7 +7056,6 @@ With prefix ARG, realign all tags in headings in the current buffer."
6738 (setq hd (match-string 1)) 7056 (setq hd (match-string 1))
6739 (delete-region (match-beginning 0) (match-end 0)) 7057 (delete-region (match-beginning 0) (match-end 0))
6740 (insert-before-markers (org-trim hd) (if empty "" " "))) 7058 (insert-before-markers (org-trim hd) (if empty "" " ")))
6741 ;; FIXME: What happens when adding a new tag??? Seems OK!!!
6742 (unless (equal tags "") 7059 (unless (equal tags "")
6743 (move-to-column (max (current-column) 7060 (move-to-column (max (current-column)
6744 (if (> org-tags-column 0) 7061 (if (> org-tags-column 0)
@@ -6782,7 +7099,7 @@ With prefix ARG, realign all tags in headings in the current buffer."
6782 (save-excursion 7099 (save-excursion
6783 (beginning-of-line 1) 7100 (beginning-of-line 1)
6784 (if (looking-at ".*[ \t]\\(:[A-Za-z_@0-9:]+:\\)[ \t]*\\(\r\\|$\\)") 7101 (if (looking-at ".*[ \t]\\(:[A-Za-z_@0-9:]+:\\)[ \t]*\\(\r\\|$\\)")
6785 (match-string 1) 7102 (org-match-string-no-properties 1)
6786 ""))) 7103 "")))
6787 7104
6788(defun org-get-buffer-tags () 7105(defun org-get-buffer-tags ()
@@ -6792,7 +7109,7 @@ With prefix ARG, realign all tags in headings in the current buffer."
6792 (goto-char (point-min)) 7109 (goto-char (point-min))
6793 (while (re-search-forward "[ \t]:\\([A-Za-z_@0-9:]+\\):[ \t\r\n]" nil t) 7110 (while (re-search-forward "[ \t]:\\([A-Za-z_@0-9:]+\\):[ \t\r\n]" nil t)
6794 (mapc (lambda (x) (add-to-list 'tags x)) 7111 (mapc (lambda (x) (add-to-list 'tags x))
6795 (org-split-string (match-string 1) ":")))) 7112 (org-split-string (org-match-string-no-properties 1) ":"))))
6796 (mapcar 'list tags))) 7113 (mapcar 'list tags)))
6797 7114
6798;;; Link Stuff 7115;;; Link Stuff
@@ -6829,10 +7146,10 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file."
6829 (looking-at org-bracket-link-regexp) 7146 (looking-at org-bracket-link-regexp)
6830 (<= (match-beginning 0) pos) 7147 (<= (match-beginning 0) pos)
6831 (>= (match-end 0) pos)) 7148 (>= (match-end 0) pos))
6832 (setq link (match-string 1)) 7149 (setq link (org-link-unescape (org-match-string-no-properties 1)))
6833 (while (string-match " *\n *" link) 7150 (while (string-match " *\n *" link)
6834 (setq link (replace-match " " t t link))) 7151 (setq link (replace-match " " t t link)))
6835 (if (string-match org-link-regexp link) 7152 (if (string-match org-link-re-with-space2 link)
6836 (setq type (match-string 1 link) 7153 (setq type (match-string 1 link)
6837 path (match-string 2 link)) 7154 path (match-string 2 link))
6838 (setq type "thisfile" 7155 (setq type "thisfile"
@@ -6849,11 +7166,12 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file."
6849 (throw 'match t)) 7166 (throw 'match t))
6850 7167
6851 (save-excursion 7168 (save-excursion
6852 (skip-chars-backward 7169 (skip-chars-backward (concat "^[]" org-non-link-chars " "))
6853 (concat (if org-allow-space-in-links "^" "^ ") 7170 (if (equal (char-before) ?<) (backward-char 1))
6854 org-non-link-chars)) 7171 (when (or (looking-at org-angle-link-re)
6855 (when (or (looking-at org-link-regexp) 7172 (looking-at org-plain-link-re)
6856 (and (re-search-forward org-link-regexp (point-at-eol) t) 7173 (and (or (re-search-forward org-angle-link-re (point-at-eol) t)
7174 (re-search-forward org-plain-link-re (point-at-eol) t))
6857 (<= (match-beginning 0) pos) 7175 (<= (match-beginning 0) pos)
6858 (>= (match-end 0) pos))) 7176 (>= (match-end 0) pos)))
6859 (setq type (match-string 1) 7177 (setq type (match-string 1)
@@ -6869,22 +7187,12 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file."
6869 (throw 'match t))) 7187 (throw 'match t)))
6870 (save-excursion 7188 (save-excursion
6871 (skip-chars-backward "a-zA-Z_") 7189 (skip-chars-backward "a-zA-Z_")
6872 (when (and org-activate-camels 7190 (when (and (memq 'camel org-activate-links)
6873 (looking-at org-camel-regexp)) 7191 (looking-at org-camel-regexp))
6874 (setq type "camel" path (match-string 0)) 7192 (setq type "camel" path (match-string 0))
6875 (if (equal (char-before) ?*) 7193 (if (equal (char-before) ?*)
6876 (setq path (concat "*" path)))) 7194 (setq path (concat "*" path))))
6877 (throw 'match t)) 7195 (throw 'match t)))
6878 (save-excursion
6879 (when (re-search-forward
6880 org-link-regexp
6881 (save-excursion
6882 (condition-case nil
6883 (progn (outline-end-of-subtree) (max pos (point)))
6884 (error (end-of-line 1) (point))))
6885 t)
6886 (setq type (match-string 1)
6887 path (match-string 2)))))
6888 (unless path 7196 (unless path
6889 (error "No link found")) 7197 (error "No link found"))
6890 ;; Remove any trailing spaces in path 7198 ;; Remove any trailing spaces in path
@@ -6894,7 +7202,6 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file."
6894 (cond 7202 (cond
6895 7203
6896 ((member type '("http" "https" "ftp" "mailto" "news")) 7204 ((member type '("http" "https" "ftp" "mailto" "news"))
6897 ;; give these to some browser
6898 (browse-url (concat type ":" path))) 7205 (browse-url (concat type ":" path)))
6899 7206
6900 ((string= type "tags") 7207 ((string= type "tags")
@@ -6971,7 +7278,10 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file."
6971 (while (string-match "@}" cmd) 7278 (while (string-match "@}" cmd)
6972 (setq cmd (replace-match ">" t t cmd))) 7279 (setq cmd (replace-match ">" t t cmd)))
6973 (if (or (not org-confirm-shell-links) 7280 (if (or (not org-confirm-shell-links)
6974 (yes-or-no-p (format "Execute \"%s\" in the shell? " cmd))) 7281 (funcall org-confirm-shell-links
7282 (format "Execute \"%s\" in shell? "
7283 (org-add-props cmd nil
7284 'face 'org-warning))))
6975 (shell-command cmd) 7285 (shell-command cmd)
6976 (error "Abort")))) 7286 (error "Abort"))))
6977 7287
@@ -7044,7 +7354,7 @@ in all files."
7044 (if (or (org-search-not-link re0 nil t) 7354 (if (or (org-search-not-link re0 nil t)
7045 (org-search-not-link re1 nil t) 7355 (org-search-not-link re1 nil t)
7046 (org-search-not-link re2 nil t) 7356 (org-search-not-link re2 nil t)
7047 (org-search-not-link re2a nil t) ;; FIXME: Right place??? 7357 (org-search-not-link re2a nil t)
7048 (org-search-not-link re3 nil t) 7358 (org-search-not-link re3 nil t)
7049 (org-search-not-link re4 nil t) 7359 (org-search-not-link re4 nil t)
7050 (org-search-not-link re5 nil t) 7360 (org-search-not-link re5 nil t)
@@ -7202,12 +7512,12 @@ onto the ring."
7202 (cond 7512 (cond
7203 ((featurep 'tramp) 7513 ((featurep 'tramp)
7204 ;; use tramp to access the file 7514 ;; use tramp to access the file
7205 (if org-xemacs-p 7515 (if (featurep 'xemacs)
7206 (setq folder (format "[%s@%s]%s" user host file)) 7516 (setq folder (format "[%s@%s]%s" user host file))
7207 (setq folder (format "/%s@%s:%s" user host file)))) 7517 (setq folder (format "/%s@%s:%s" user host file))))
7208 (t 7518 (t
7209 ;; use ange-ftp or efs 7519 ;; use ange-ftp or efs
7210 (require (if org-xemacs-p 'efs 'ange-ftp)) 7520 (require (if (featurep 'xemacs) 'efs 'ange-ftp))
7211 (setq folder (format "/%s@%s:%s" user host file)))))) 7521 (setq folder (format "/%s@%s:%s" user host file))))))
7212 (when folder 7522 (when folder
7213 (funcall (cdr (assq 'vm org-link-frame-setup)) folder readonly) 7523 (funcall (cdr (assq 'vm org-link-frame-setup)) folder readonly)
@@ -7409,7 +7719,7 @@ If the file does not exist, an error is thrown."
7409 (shell-command (concat cmd " &")))) 7719 (shell-command (concat cmd " &"))))
7410 ((or (stringp cmd) 7720 ((or (stringp cmd)
7411 (eq cmd 'emacs)) 7721 (eq cmd 'emacs))
7412 (unless (equal (file-truename file) (file-truename buffer-file-name)) 7722 (unless (equal (file-truename file) (file-truename (or buffer-file-name "")))
7413 (funcall (cdr (assq 'file org-link-frame-setup)) file)) 7723 (funcall (cdr (assq 'file org-link-frame-setup)) file))
7414 (if line (goto-line line) 7724 (if line (goto-line line)
7415 (if search (org-link-search search)))) 7725 (if search (org-link-search search))))
@@ -7450,7 +7760,7 @@ For some link types, a prefix arg is interpreted:
7450For links to usenet articles, arg negates `org-usenet-links-prefer-google'. 7760For links to usenet articles, arg negates `org-usenet-links-prefer-google'.
7451For file links, arg negates `org-context-in-file-links'." 7761For file links, arg negates `org-context-in-file-links'."
7452 (interactive "P") 7762 (interactive "P")
7453 (let (link cpltxt txt (pos (point))) 7763 (let (link cpltxt desc txt (pos (point)))
7454 (cond 7764 (cond
7455 7765
7456 ((eq major-mode 'bbdb-mode) 7766 ((eq major-mode 'bbdb-mode)
@@ -7486,9 +7796,7 @@ For file links, arg negates `org-context-in-file-links'."
7486 folder) 7796 folder)
7487 (setq folder (replace-match "" t t folder))) 7797 (setq folder (replace-match "" t t folder)))
7488 (setq cpltxt (concat author " on: " subject)) 7798 (setq cpltxt (concat author " on: " subject))
7489 (setq link (concat cpltxt "\n " 7799 (setq link (org-make-link "vm:" folder "#" message-id)))))
7490 (org-make-link
7491 "vm:" folder "#" message-id))))))
7492 7800
7493 ((eq major-mode 'wl-summary-mode) 7801 ((eq major-mode 'wl-summary-mode)
7494 (let* ((msgnum (wl-summary-message-number)) 7802 (let* ((msgnum (wl-summary-message-number))
@@ -7496,14 +7804,12 @@ For file links, arg negates `org-context-in-file-links'."
7496 msgnum 'message-id)) 7804 msgnum 'message-id))
7497 (wl-message-entity (elmo-msgdb-overview-get-entity 7805 (wl-message-entity (elmo-msgdb-overview-get-entity
7498 msgnum (wl-summary-buffer-msgdb))) 7806 msgnum (wl-summary-buffer-msgdb)))
7499 (author (wl-summary-line-from)) ; FIXME: how to get author name? 7807 (author (wl-summary-line-from)) ; FIXME: correct?
7500 (subject "???")) ; FIXME: How to get subject of email? 7808 (subject "???")) ; FIXME:
7501 (setq message-id (org-remove-angle-brackets message-id)) 7809 (setq message-id (org-remove-angle-brackets message-id))
7502 (setq cpltxt (concat author " on: " subject)) 7810 (setq cpltxt (concat author " on: " subject))
7503 (setq link (concat cpltxt "\n " 7811 (setq link (org-make-link "wl:" wl-summary-buffer-folder-name
7504 (org-make-link 7812 "#" message-id))))
7505 "wl:" wl-summary-buffer-folder-name
7506 "#" message-id)))))
7507 7813
7508 ((or (equal major-mode 'mh-folder-mode) 7814 ((or (equal major-mode 'mh-folder-mode)
7509 (equal major-mode 'mh-show-mode)) 7815 (equal major-mode 'mh-show-mode))
@@ -7511,11 +7817,9 @@ For file links, arg negates `org-context-in-file-links'."
7511 (to-header (org-mhe-get-header "To:")) 7817 (to-header (org-mhe-get-header "To:"))
7512 (subject (org-mhe-get-header "Subject:"))) 7818 (subject (org-mhe-get-header "Subject:")))
7513 (setq cpltxt (concat from-header " on: " subject)) 7819 (setq cpltxt (concat from-header " on: " subject))
7514 (setq link (concat cpltxt "\n " 7820 (setq link (org-make-link "mhe:" (org-mhe-get-message-real-folder) "#"
7515 (org-make-link 7821 (org-remove-angle-brackets
7516 "mhe:" (org-mhe-get-message-real-folder) "#" 7822 (org-mhe-get-header "Message-Id:"))))))
7517 (org-remove-angle-brackets
7518 (org-mhe-get-header "Message-Id:")))))))
7519 7823
7520 ((eq major-mode 'rmail-mode) 7824 ((eq major-mode 'rmail-mode)
7521 (save-excursion 7825 (save-excursion
@@ -7527,9 +7831,7 @@ For file links, arg negates `org-context-in-file-links'."
7527 (subject (mail-fetch-field "subject"))) 7831 (subject (mail-fetch-field "subject")))
7528 (setq message-id (org-remove-angle-brackets message-id)) 7832 (setq message-id (org-remove-angle-brackets message-id))
7529 (setq cpltxt (concat author " on: " subject)) 7833 (setq cpltxt (concat author " on: " subject))
7530 (setq link (concat cpltxt "\n " 7834 (setq link (org-make-link "rmail:" folder "#" message-id))))))
7531 (org-make-link
7532 "rmail:" folder "#" message-id)))))))
7533 7835
7534 ((eq major-mode 'gnus-group-mode) 7836 ((eq major-mode 'gnus-group-mode)
7535 (let ((group (cond ((fboundp 'gnus-group-group-name) ; depending on Gnus 7837 (let ((group (cond ((fboundp 'gnus-group-group-name) ; depending on Gnus
@@ -7561,10 +7863,8 @@ For file links, arg negates `org-context-in-file-links'."
7561 cpltxt "\n " 7863 cpltxt "\n "
7562 (format "http://groups.google.com/groups?as_umsgid=%s" 7864 (format "http://groups.google.com/groups?as_umsgid=%s"
7563 (org-fixup-message-id-for-http message-id)))) 7865 (org-fixup-message-id-for-http message-id))))
7564 (setq link (concat cpltxt "\n" 7866 (setq link (org-make-link "gnus:" group
7565 (org-make-link 7867 "#" (number-to-string article))))))
7566 "gnus:" group
7567 "#" (number-to-string article)))))))
7568 7868
7569 ((eq major-mode 'w3-mode) 7869 ((eq major-mode 'w3-mode)
7570 (setq cpltxt (url-view-url t) 7870 (setq cpltxt (url-view-url t)
@@ -7596,7 +7896,8 @@ For file links, arg negates `org-context-in-file-links'."
7596 (concat cpltxt "::" 7896 (concat cpltxt "::"
7597 (if org-file-link-context-use-camel-case 7897 (if org-file-link-context-use-camel-case
7598 (org-make-org-heading-camel txt) 7898 (org-make-org-heading-camel txt)
7599 (org-make-org-heading-search-string txt)))))) 7899 (org-make-org-heading-search-string txt)))
7900 desc "NONE")))
7600 (if (string-match "::\\'" cpltxt) 7901 (if (string-match "::\\'" cpltxt)
7601 (setq cpltxt (substring cpltxt 0 -2))) 7902 (setq cpltxt (substring cpltxt 0 -2)))
7602 (setq link (org-make-link cpltxt))) 7903 (setq link (org-make-link cpltxt)))
@@ -7614,7 +7915,8 @@ For file links, arg negates `org-context-in-file-links'."
7614 (concat cpltxt "::" 7915 (concat cpltxt "::"
7615 (if org-file-link-context-use-camel-case 7916 (if org-file-link-context-use-camel-case
7616 (org-make-org-heading-camel txt) 7917 (org-make-org-heading-camel txt)
7617 (org-make-org-heading-search-string txt))))) 7918 (org-make-org-heading-search-string txt)))
7919 desc "NONE"))
7618 (setq link (org-make-link cpltxt))) 7920 (setq link (org-make-link cpltxt)))
7619 7921
7620 ((interactive-p) 7922 ((interactive-p)
@@ -7622,12 +7924,17 @@ For file links, arg negates `org-context-in-file-links'."
7622 7924
7623 (t (setq link nil))) 7925 (t (setq link nil)))
7624 7926
7927 (if (consp link) (setq cpltxt (car link) link (cdr link)))
7928 (setq link (or link cpltxt)
7929 desc (or desc cpltxt))
7930 (if (equal desc "NONE") (setq desc nil))
7931
7625 (if (and (interactive-p) link) 7932 (if (and (interactive-p) link)
7626 (progn 7933 (progn
7627 (setq org-stored-links 7934 (setq org-stored-links
7628 (cons (cons (or cpltxt link) link) org-stored-links)) 7935 (cons (list cpltxt link desc) org-stored-links))
7629 (message "Stored: %s" (or cpltxt link))) 7936 (message "Stored: %s" (or cpltxt link)))
7630 link))) 7937 (org-make-link-string link desc))))
7631 7938
7632(defun org-make-org-heading-search-string (&optional string heading) 7939(defun org-make-org-heading-search-string (&optional string heading)
7633 "Make search string for STRING or current headline." 7940 "Make search string for STRING or current headline."
@@ -7675,11 +7982,52 @@ For file links, arg negates `org-context-in-file-links'."
7675 "Concatenate STRINGS, format resulting string with `org-link-format'." 7982 "Concatenate STRINGS, format resulting string with `org-link-format'."
7676 (format org-link-format (apply 'concat strings))) 7983 (format org-link-format (apply 'concat strings)))
7677 7984
7678(defun org-make-link2 (link &optional description) 7985(defun org-make-link-string (link &optional description)
7679 "Make a link with brackets." 7986 "Make a link with brackets, consisting of LINK and DESCRIPTION."
7680 (concat "[[" link "]" 7987 (if (eq org-link-style 'plain)
7681 (if description (concat "[" description "]") "") 7988 (if (equal description link)
7682 "]")) 7989 link
7990 (concat description "\n" link))
7991 (when (stringp description)
7992 ;; Remove brackets from the description, they are fatal.
7993 (while (string-match "\\[\\|\\]" description)
7994 (setq description (replace-match "" t t description))))
7995 (when (equal (org-link-escape link) description)
7996 ;; No description needed, it is identical
7997 (setq description nil))
7998 (when (and (not description)
7999 (not (equal link (org-link-escape link))))
8000 (setq description link))
8001 (concat "[[" (org-link-escape link) "]"
8002 (if description (concat "[" description "]") "")
8003 "]")))
8004
8005(defconst org-link-escape-chars '(("[" . "%5B") ("]" . "%5D") (" " . "%20"))
8006 "Association list of escapes for some characters problematic in links.")
8007
8008(defun org-link-escape (text)
8009 "Escape charaters in TEXT that are problematic for links."
8010 (when text
8011 (let ((re (mapconcat (lambda (x) (regexp-quote (car x)))
8012 org-link-escape-chars "\\|")))
8013 (while (string-match re text)
8014 (setq text
8015 (replace-match
8016 (cdr (assoc (match-string 0 text) org-link-escape-chars))
8017 t t text)))
8018 text)))
8019
8020(defun org-link-unescape (text)
8021 "Reverse the action of `org-link-escape'."
8022 (when text
8023 (let ((re (mapconcat (lambda (x) (regexp-quote (cdr x)))
8024 org-link-escape-chars "\\|")))
8025 (while (string-match re text)
8026 (setq text
8027 (replace-match
8028 (car (rassoc (match-string 0 text) org-link-escape-chars))
8029 t t text)))
8030 text)))
7683 8031
7684(defun org-xor (a b) 8032(defun org-xor (a b)
7685 "Exclusive or." 8033 "Exclusive or."
@@ -7728,6 +8076,12 @@ press RET at the prompt), the link defaults to the most recently
7728stored link. As SPC triggers completion in the minibuffer, you need to 8076stored link. As SPC triggers completion in the minibuffer, you need to
7729use M-SPC or C-q SPC to force the insertion of a space character. 8077use M-SPC or C-q SPC to force the insertion of a space character.
7730 8078
8079You will also be prompted for a description, and if one is given, it will
8080be displayed in the buffer instead of the link.
8081
8082If there is already a link at point, this command will allow you to edit link
8083and description parts.
8084
7731With a \\[universal-argument] prefix, prompts for a file to link to. The file name can be 8085With a \\[universal-argument] prefix, prompts for a file to link to. The file name can be
7732selected using completion. The path to the file will be relative to 8086selected using completion. The path to the file will be relative to
7733the current directory if the file is in the current directory or a 8087the current directory if the file is in the current directory or a
@@ -7737,68 +8091,76 @@ completed in the minibuffer (i.e. normally ~/path/to/file).
7737With two \\[universal-argument] prefixes, enforce an absolute path even if the file 8091With two \\[universal-argument] prefixes, enforce an absolute path even if the file
7738is in the current directory or below." 8092is in the current directory or below."
7739 (interactive "P") 8093 (interactive "P")
7740 (let ((link (if complete-file 8094 (let (link desc entry remove file (pos (point)))
7741 (read-file-name "File: ") 8095 (cond
7742 (completing-read 8096 ((save-excursion
7743 "Link: " org-stored-links nil nil nil 8097 (skip-chars-forward "^]\n\r")
7744 org-insert-link-history 8098 (and (re-search-backward "\\[\\[" nil t)
7745 (or (car (car org-stored-links)))))) 8099 (looking-at org-bracket-link-regexp)
7746 linktxt matched) 8100 (<= (match-beginning 0) pos)
7747 (if (or (not link) (equal link "")) 8101 (>= (match-end 0) pos)))
7748 (error "No links available")) 8102 ;; We do have a link at point, and we are going to edit it.
7749 (if complete-file 8103 (setq remove (list (match-beginning 0) (match-end 0)))
7750 (let ((pwd (file-name-as-directory (expand-file-name ".")))) 8104 (setq desc (if (match-end 3) (org-match-string-no-properties 3)))
7751 (cond 8105 (setq link (read-string "Link: "
7752 ((equal complete-file '(16)) 8106 (org-link-unescape
7753 (insert 8107 (org-match-string-no-properties 1)))))
7754 (org-make-link 8108 (complete-file
7755 "file:" (abbreviate-file-name (expand-file-name link))))) 8109 ;; Completing read for file names.
7756 ((string-match (concat "^" (regexp-quote pwd) "\\(.+\\)") 8110 (setq file (read-file-name "File: "))
7757 (expand-file-name link)) 8111 (let ((pwd (file-name-as-directory (expand-file-name "."))))
7758 (insert 8112 (cond
7759 (org-make-link 8113 ((equal complete-file '(16))
7760 "file:" (match-string 1 (expand-file-name link))))) 8114 (setq link (org-make-link
7761 (t (insert (org-make-link "file:" link))))) 8115 "file:"
7762 (setq linktxt (cdr (assoc link org-stored-links))) 8116 (abbreviate-file-name (expand-file-name file)))))
8117 ((string-match (concat "^" (regexp-quote pwd) "\\(.+\\)")
8118 (expand-file-name file))
8119 (setq link (org-make-link
8120 "file:" (match-string 1 (expand-file-name file)))))
8121 (t (setq link (org-make-link "file:" file))))))
8122 (t
8123 ;; Read link, with completion for stored links.
8124 (setq link (org-completing-read
8125 "Link: " org-stored-links nil nil nil
8126 org-insert-link-history
8127 (or (car (car org-stored-links)))))
8128 (setq entry (assoc link org-stored-links))
7763 (if (not org-keep-stored-link-after-insertion) 8129 (if (not org-keep-stored-link-after-insertion)
7764 (setq org-stored-links (delq (assoc link org-stored-links) 8130 (setq org-stored-links (delq (assoc link org-stored-links)
7765 org-stored-links))) 8131 org-stored-links)))
7766 (if (not linktxt) (setq link (org-make-link link))) 8132 (setq link (if entry (nth 1 entry) link)
7767 (setq link (or linktxt link)) 8133 desc (or desc (nth 2 entry)))))
7768 (when (string-match "<\\<file:\\(.+?\\)::\\([^>]+\\)>" link) 8134
7769 (let* ((path (match-string 1 link)) 8135 (if (string-match org-plain-link-re link)
7770 (case-fold-search nil) 8136 ;; URL-like link, normalize the use of angular brackets.
7771 (search (match-string 2 link))) 8137 (setq link (org-make-link (org-remove-angle-brackets link))))
7772 (when (save-match-data 8138
7773 (equal (file-truename buffer-file-name) 8139 ;; Check if we are linking to the current file. If yes, simplify the link.
7774 (file-truename path))) 8140 (when (string-match "\\<file:\\(.+?\\)::\\([^>]+\\)" link)
7775 ;; We are linking to this same file 8141 (let* ((path (match-string 1 link))
7776 (if (and org-file-link-context-use-camel-case 8142 (case-fold-search nil)
7777 (save-match-data 8143 (search (match-string 2 link)))
7778 (string-match (concat "^" org-camel-regexp "$") search))) 8144 (when (save-match-data
7779 (setq link (replace-match search t t link) 8145 (equal (file-truename buffer-file-name)
7780 matched t) 8146 (file-truename path)))
7781 (setq link (replace-match (concat "[[" search "]]") 8147 ;; We are linking to this same file, with a search option
7782 t t link) 8148 (setq link search))))
7783 matched t))))) 8149 (setq desc (read-string "Description: " desc))
7784 (let ((lines (org-split-string link "\n"))) 8150 (unless (string-match "\\S-" desc) (setq desc nil))
7785 (insert (car lines)) 8151 (if remove (apply 'delete-region remove))
7786 (setq matched (or matched (string-match org-link-regexp (car lines)))) 8152 (insert (org-make-link-string link desc))))
7787 (setq lines (cdr lines)) 8153
7788 (while lines 8154(defun org-completing-read (&rest args)
7789 (insert "\n") 8155 (let ((minibuffer-local-completion-map
7790 (if (save-excursion 8156 (copy-keymap minibuffer-local-completion-map)))
7791 (beginning-of-line 0) 8157 (define-key minibuffer-local-completion-map " " 'self-insert-command)
7792 (looking-at "[ \t]+\\S-")) 8158 (apply 'completing-read args)))
7793 (indent-relative))
7794 (setq matched (or matched
7795 (string-match org-link-regexp (car lines))))
7796 (insert (car lines))
7797 (setq lines (cdr lines))))
7798 (unless matched
7799 (error "Add link type: http(s),ftp,mailto,file,news,bbdb,vm,wl,rmail,gnus, or shell")))))
7800 8159
7801;;; Hooks for remember.el 8160;;; Hooks for remember.el
8161
8162(defvar org-finish-function nil)
8163
7802;;;###autoload 8164;;;###autoload
7803(defun org-remember-annotation () 8165(defun org-remember-annotation ()
7804 "Return a link to the current location as an annotation for remember.el. 8166 "Return a link to the current location as an annotation for remember.el.
@@ -7815,6 +8177,51 @@ RET on headline -> Store as sublevel entry to current headline
7815<left>/<right> -> before/after current headline, same headings level") 8177<left>/<right> -> before/after current headline, same headings level")
7816 8178
7817;;;###autoload 8179;;;###autoload
8180(defun org-remember-apply-template ()
8181 "Initialize *remember* buffer with template, invode `org-mode'.
8182This function should be placed into `remember-mode-hook' and in fact requires
8183to be run from that hook to fucntion properly."
8184 (when org-remember-templates
8185 (let* ((entry (if (= (length org-remember-templates) 1)
8186 (cdar org-remember-templates)
8187 (message "Select template: %s"
8188 (mapconcat
8189 (lambda (x) (char-to-string (car x)))
8190 org-remember-templates " "))
8191 (cdr (assoc (read-char-exclusive) org-remember-templates))))
8192 (tpl (if (consp (cdr entry)) (cadr entry) (cdr entry)))
8193 (file (if (consp (cdr entry)) (nth 2 entry)))
8194 (v-t (format-time-string (car org-time-stamp-formats) (org-current-time)))
8195 (v-T (format-time-string (cdr org-time-stamp-formats) (org-current-time)))
8196 (v-u (concat "[" (substring v-t 1 -1) "]"))
8197 (v-U (concat "[" (substring v-T 1 -1) "]"))
8198 (v-a annotation) ; defined in `remember-mode'
8199 (v-i initial) ; defined in `remember-mode'
8200 (v-n user-full-name)
8201 )
8202 (unless tpl (setq tpl "") (message "No template") (ding))
8203 (insert tpl) (goto-char (point-min))
8204 (while (re-search-forward "%\\([tTuTai]\\)" nil t)
8205 (when (and initial (equal (match-string 0) "%i"))
8206 (save-match-data
8207 (let* ((lead (buffer-substring
8208 (point-at-bol) (match-beginning 0))))
8209 (setq v-i (mapconcat 'identity
8210 (org-split-string initial "\n")
8211 (concat "\n" lead))))))
8212 (replace-match
8213 (or (eval (intern (concat "v-" (match-string 1)))) "")
8214 t t))
8215 (let ((org-startup-folded nil)
8216 (org-startup-with-deadline-check nil))
8217 (org-mode))
8218 (if (and file (string-match "\\S-" file) (not (file-directory-p file)))
8219 (set (make-local-variable 'org-default-notes-file) file))
8220 (goto-char (point-min))
8221 (if (re-search-forward "%\\?" nil t) (replace-match ""))
8222 (set (make-local-variable 'org-finish-function) 'remember-buffer))))
8223
8224;;;###autoload
7818(defun org-remember-handler () 8225(defun org-remember-handler ()
7819 "Store stuff from remember.el into an org file. 8226 "Store stuff from remember.el into an org file.
7820First prompts for an org file. If the user just presses return, the value 8227First prompts for an org file. If the user just presses return, the value
@@ -7855,22 +8262,25 @@ See also the variable `org-reverse-note-order'."
7855 (visiting (find-buffer-visiting file)) 8262 (visiting (find-buffer-visiting file))
7856 (org-startup-with-deadline-check nil) 8263 (org-startup-with-deadline-check nil)
7857 (org-startup-folded nil) 8264 (org-startup-folded nil)
8265 (org-startup-align-all-tables nil)
7858 spos level indent reversed) 8266 spos level indent reversed)
7859 ;; Modify text so that it becomes a nice subtree which can be inserted 8267 ;; Modify text so that it becomes a nice subtree which can be inserted
7860 ;; into an org tree. 8268 ;; into an org tree.
7861 (let* ((lines (split-string txt "\n")) 8269 (let* ((lines (split-string txt "\n"))
7862 (first (car lines)) 8270 first)
7863 (lines (cdr lines))) 8271 ;; remove empty lines at the beginning
8272 (while (and lines (string-match "^[ \t]*\n" (car lines)))
8273 (setq lines (cdr lines)))
8274 (setq first (car lines) lines (cdr lines))
7864 (if (string-match "^\\*+" first) 8275 (if (string-match "^\\*+" first)
7865 ;; Is already a headline 8276 ;; Is already a headline
7866 (setq indent (make-string (- (match-end 0) (match-beginning 0) 8277 (setq indent nil)
7867 -1) ?\ ))
7868 ;; We need to add a headline: Use time and first buffer line 8278 ;; We need to add a headline: Use time and first buffer line
7869 (setq lines (cons first lines) 8279 (setq lines (cons first lines)
7870 first (concat "* " (current-time-string) 8280 first (concat "* " (current-time-string)
7871 " (" (remember-buffer-desc) ")") 8281 " (" (remember-buffer-desc) ")")
7872 indent " ")) 8282 indent " "))
7873 (if org-adapt-indentation 8283 (if (and org-adapt-indentation indent)
7874 (setq lines (mapcar (lambda (x) (concat indent x)) lines))) 8284 (setq lines (mapcar (lambda (x) (concat indent x)) lines)))
7875 (setq txt (concat first "\n" 8285 (setq txt (concat first "\n"
7876 (mapconcat 'identity lines "\n")))) 8286 (mapconcat 'identity lines "\n"))))
@@ -7895,7 +8305,7 @@ See also the variable `org-reverse-note-order'."
7895 (widen) 8305 (widen)
7896 (goto-char (if reversed (point-min) (point-max))) 8306 (goto-char (if reversed (point-min) (point-max)))
7897 (if (not (bolp)) (newline)) 8307 (if (not (bolp)) (newline))
7898 (org-paste-subtree (or current-prefix-arg 2) txt))) 8308 (org-paste-subtree 2 txt)))
7899 ((and (org-on-heading-p nil) (not current-prefix-arg)) 8309 ((and (org-on-heading-p nil) (not current-prefix-arg))
7900 ;; Put it below this entry, at the beg/end of the subtree 8310 ;; Put it below this entry, at the beg/end of the subtree
7901 (org-back-to-heading) 8311 (org-back-to-heading)
@@ -7987,6 +8397,15 @@ and table.el tables."
7987 (org-table-convert))) 8397 (org-table-convert)))
7988 (t (call-interactively 'table-insert)))) 8398 (t (call-interactively 'table-insert))))
7989 8399
8400(defun org-table-create-or-convert-from-region (arg)
8401 "Convert region to table, or create an empty table.
8402If there is an active region, convert it to a table. If there is no such
8403region, create an empty table."
8404 (interactive "P")
8405 (if (org-region-active-p)
8406 (org-table-convert-region (region-beginning) (region-end) arg)
8407 (org-table-create arg)))
8408
7990(defun org-table-create (&optional size) 8409(defun org-table-create (&optional size)
7991 "Query for a size and insert a table skeleton. 8410 "Query for a size and insert a table skeleton.
7992SIZE is a string Columns x Rows like for example \"3x2\"." 8411SIZE is a string Columns x Rows like for example \"3x2\"."
@@ -8019,12 +8438,13 @@ SIZE is a string Columns x Rows like for example \"3x2\"."
8019 (goto-char pos))) 8438 (goto-char pos)))
8020 (org-table-align))) 8439 (org-table-align)))
8021 8440
8022(defun org-table-convert-region (beg0 end0 nspace) 8441(defun org-table-convert-region (beg0 end0 &optional nspace)
8023 "Convert region to a table. 8442 "Convert region to a table.
8024The region goes from BEG0 to END0, but these borders will be moved 8443The region goes from BEG0 to END0, but these borders will be moved
8025slightly, to make sure a beginning of line in the first line is included. 8444slightly, to make sure a beginning of line in the first line is included.
8026When NSPACE is non-nil, it indicates the minimum number of spaces that 8445When NSPACE is non-nil, it indicates the minimum number of spaces that
8027separate columns (default: just one space)." 8446separate columns (default: just one space)."
8447 (interactive "rP")
8028 (let* ((beg (min beg0 end0)) 8448 (let* ((beg (min beg0 end0))
8029 (end (max beg0 end0)) 8449 (end (max beg0 end0))
8030 (tabsep t) 8450 (tabsep t)
@@ -8110,17 +8530,17 @@ Used to check if cursor still is in that table, to minimize realignment.")
8110(defvar org-table-last-alignment nil 8530(defvar org-table-last-alignment nil
8111 "List of flags for flushright alignment, from the last re-alignment. 8531 "List of flags for flushright alignment, from the last re-alignment.
8112This is being used to correctly align a single field after TAB or RET.") 8532This is being used to correctly align a single field after TAB or RET.")
8113;; FIXME: The following is currently not used.
8114(defvar org-table-last-column-widths nil 8533(defvar org-table-last-column-widths nil
8115 "List of max width of fields in each column. 8534 "List of max width of fields in each column.
8116This is being used to correctly align a single field after TAB or RET.") 8535This is being used to correctly align a single field after TAB or RET.")
8117 8536
8118(defvar org-last-recalc-line nil) 8537(defvar org-last-recalc-line nil)
8538(defconst org-narrow-column-arrow "=>"
8539 "Used as display property in narrowed table columns.")
8119 8540
8120(defun org-table-align () 8541(defun org-table-align ()
8121 "Align the table at point by aligning all vertical bars." 8542 "Align the table at point by aligning all vertical bars."
8122 (interactive) 8543 (interactive)
8123 ;; (message "align") (sit-for 2)
8124 (let* ( 8544 (let* (
8125 ;; Limits of table 8545 ;; Limits of table
8126 (beg (org-table-begin)) 8546 (beg (org-table-begin))
@@ -8133,25 +8553,33 @@ This is being used to correctly align a single field after TAB or RET.")
8133 column 8553 column
8134 (indent "") cnt frac 8554 (indent "") cnt frac
8135 rfmt hfmt 8555 rfmt hfmt
8136 (spaces (if (org-in-invisibility-spec-p '(org-table)) 8556 (spaces '(1 . 1))
8137 org-table-spaces-around-invisible-separators
8138 org-table-spaces-around-separators))
8139 (sp1 (car spaces)) 8557 (sp1 (car spaces))
8140 (sp2 (cdr spaces)) 8558 (sp2 (cdr spaces))
8141 (rfmt1 (concat 8559 (rfmt1 (concat
8142 (make-string sp2 ?\ ) "%%%s%ds" (make-string sp1 ?\ ) "|")) 8560 (make-string sp2 ?\ ) "%%%s%ds" (make-string sp1 ?\ ) "|"))
8143 (hfmt1 (concat 8561 (hfmt1 (concat
8144 (make-string sp2 ?-) "%s" (make-string sp1 ?-) "+")) 8562 (make-string sp2 ?-) "%s" (make-string sp1 ?-) "+"))
8145 emptystrings) 8563 emptystrings xx links narrow fmax fmin f1 len c e)
8146 (untabify beg end) 8564 (untabify beg end)
8147 ;; (message "Aligning table...") 8565 (remove-text-properties beg end '(org-cwidth t display t))
8566 ;; Check if we have links
8567 (goto-char beg)
8568 (setq links (re-search-forward org-bracket-link-regexp end t))
8569 ;; Make sure the link properties are right FIXME: Can this be optimized????
8570 (when links (goto-char beg) (while (org-activate-bracket-links end)))
8571 ;; Check if we are narrowing any columns
8572 (goto-char beg)
8573 (setq narrow (and org-format-transports-properties-p
8574 (re-search-forward "<[0-9]+>" end t)))
8148 ;; Get the rows 8575 ;; Get the rows
8149 (setq lines (org-split-string 8576 (setq lines (org-split-string
8150 (buffer-substring-no-properties beg end) "\n")) 8577 (buffer-substring beg end) "\n"))
8151 ;; Store the indentation of the first line 8578 ;; Store the indentation of the first line
8152 (if (string-match "^ *" (car lines)) 8579 (if (string-match "^ *" (car lines))
8153 (setq indent (make-string (- (match-end 0) (match-beginning 0)) ?\ ))) 8580 (setq indent (make-string (- (match-end 0) (match-beginning 0)) ?\ )))
8154 ;; Mark the hlines 8581 ;; Mark the hlines by setting the corresponding element to nil
8582 ;; At the same time, we remove trailing space.
8155 (setq lines (mapcar (lambda (l) 8583 (setq lines (mapcar (lambda (l)
8156 (if (string-match "^ *|-" l) 8584 (if (string-match "^ *|-" l)
8157 nil 8585 nil
@@ -8159,7 +8587,7 @@ This is being used to correctly align a single field after TAB or RET.")
8159 (substring l 0 (match-beginning 0)) 8587 (substring l 0 (match-beginning 0))
8160 l))) 8588 l)))
8161 lines)) 8589 lines))
8162 ;; Get the data fields 8590 ;; Get the data fields by splitting the lines.
8163 (setq fields (mapcar 8591 (setq fields (mapcar
8164 (lambda (l) 8592 (lambda (l)
8165 (org-split-string l " *| *")) 8593 (org-split-string l " *| *"))
@@ -8173,28 +8601,62 @@ This is being used to correctly align a single field after TAB or RET.")
8173 (error "Empty table - created default table"))) 8601 (error "Empty table - created default table")))
8174 ;; A list of empty string to fill any short rows on output 8602 ;; A list of empty string to fill any short rows on output
8175 (setq emptystrings (make-list maxfields "")) 8603 (setq emptystrings (make-list maxfields ""))
8176 ;; Get the maximum length of a field and the most common datatype 8604 ;; Check for special formatting.
8177 ;; for each column
8178 (setq i -1) 8605 (setq i -1)
8179 (while (< (setq i (1+ i)) maxfields) ;; Loop over all columns 8606 (while (< (setq i (1+ i)) maxfields) ;; Loop over all columns
8180 (setq column (mapcar (lambda (x) (or (nth i x) "")) fields)) 8607 (setq column (mapcar (lambda (x) (or (nth i x) "")) fields))
8181 ;; maximum length 8608 ;; Check if there is an explicit width specified
8182 (push (apply 'max 1 (mapcar 'string-width column)) lengths) 8609 (when (and org-table-limit-column-width narrow)
8183 ;; compute the fraction stepwise, ignoring empty fields 8610 (setq c column fmax nil)
8611 (while c
8612 (setq e (pop c))
8613 (if (and (stringp e) (string-match "^<\\([0-9]+\\)>$" e))
8614 (setq fmax (string-to-number (match-string 1 e)) c nil)))
8615 ;; Find fields that are wider than fmax, and shorten them
8616 (when fmax
8617 (loop for xx in column do
8618 (when (and (stringp xx)
8619 (> (org-string-width xx) fmax))
8620 (org-add-props xx nil
8621 'help-echo
8622 (concat "Clipped table field, use C-c ` to edit. Full value is:\n" (copy-sequence xx)))
8623 (setq f1 (min fmax (or (string-match org-bracket-link-regexp xx) fmax)))
8624 (unless (> f1 1)
8625 (error "Cannot narrow field starting with wide link \"%s\""
8626 (match-string 0 xx)))
8627 (add-text-properties f1 (length xx) (list 'org-cwidth t) xx)
8628 (add-text-properties (- f1 2) f1
8629 (list 'display org-narrow-column-arrow)
8630 xx)))))
8631 ;; Get the maximum width for each column
8632 (push (apply 'max 1 (mapcar 'org-string-width column)) lengths)
8633 ;; Get the fraction of numbers, to decide about alignment of the column
8184 (setq cnt 0 frac 0.0) 8634 (setq cnt 0 frac 0.0)
8185 (mapcar 8635 (loop for x in column do
8186 (lambda (x) 8636 (if (equal x "")
8187 (if (equal x "") 8637 nil
8188 nil 8638 (setq frac ( / (+ (* frac cnt)
8189 (setq frac ( / (+ (* frac cnt) 8639 (if (string-match org-table-number-regexp x) 1 0))
8190 (if (string-match org-table-number-regexp x) 1 0)) 8640 (setq cnt (1+ cnt))))))
8191 (setq cnt (1+ cnt))))))
8192 column)
8193 (push (>= frac org-table-number-fraction) typenums)) 8641 (push (>= frac org-table-number-fraction) typenums))
8194 (setq lengths (nreverse lengths) 8642 (setq lengths (nreverse lengths) typenums (nreverse typenums))
8195 typenums (nreverse typenums)) 8643
8644 ;; Store the alignment of this table, for later editing of single fields
8196 (setq org-table-last-alignment typenums 8645 (setq org-table-last-alignment typenums
8197 org-table-last-column-widths lengths) 8646 org-table-last-column-widths lengths)
8647
8648 ;; With invisible characters, `format' does not get the field width right
8649 ;; So we need to make these fields wide by hand.
8650 (when links
8651 (loop for i from 0 upto (1- maxfields) do
8652 (setq len (nth i lengths))
8653 (loop for j from 0 upto (1- (length fields)) do
8654 (setq c (nthcdr i (car (nthcdr j fields))))
8655 (if (and (stringp (car c))
8656 (string-match org-bracket-link-regexp (car c))
8657 (< (org-string-width (car c)) len))
8658 (setcar c (concat (car c) (make-string (- len (org-string-width (car c))) ?\ )))))))
8659
8198 ;; Compute the formats needed for output of the table 8660 ;; Compute the formats needed for output of the table
8199 (setq rfmt (concat indent "|") hfmt (concat indent "|")) 8661 (setq rfmt (concat indent "|") hfmt (concat indent "|"))
8200 (while (setq l (pop lengths)) 8662 (while (setq l (pop lengths))
@@ -8203,13 +8665,7 @@ This is being used to correctly align a single field after TAB or RET.")
8203 hfmt (concat hfmt (format hfmt1 (make-string l ?-))))) 8665 hfmt (concat hfmt (format hfmt1 (make-string l ?-)))))
8204 (setq rfmt (concat rfmt "\n") 8666 (setq rfmt (concat rfmt "\n")
8205 hfmt (concat (substring hfmt 0 -1) "|\n")) 8667 hfmt (concat (substring hfmt 0 -1) "|\n"))
8206 ;; Produce the new table 8668
8207 ;;(while lines
8208 ;; (setq l (pop lines))
8209 ;; (if l
8210 ;; (setq new (concat new (apply 'format rfmt
8211 ;; (append (pop fields) emptystrings))))
8212 ;; (setq new (concat new hfmt))))
8213 (setq new (mapconcat 8669 (setq new (mapconcat
8214 (lambda (l) 8670 (lambda (l)
8215 (if l (apply 'format rfmt 8671 (if l (apply 'format rfmt
@@ -8222,15 +8678,35 @@ This is being used to correctly align a single field after TAB or RET.")
8222 (move-marker org-table-aligned-begin-marker (point)) 8678 (move-marker org-table-aligned-begin-marker (point))
8223 (insert new) 8679 (insert new)
8224 (move-marker org-table-aligned-end-marker (point)) 8680 (move-marker org-table-aligned-end-marker (point))
8681 (when (and orgtbl-mode (not (eq major-mode 'org-mode)))
8682 (goto-char org-table-aligned-begin-marker)
8683 (while (org-hide-wide-columns org-table-aligned-end-marker)))
8225 ;; Try to move to the old location (approximately) 8684 ;; Try to move to the old location (approximately)
8226 (goto-line linepos) 8685 (goto-line linepos)
8227 (set-window-start (selected-window) winstart 'noforce) 8686 (set-window-start (selected-window) winstart 'noforce)
8228 (org-table-goto-column colpos) 8687 (org-table-goto-column colpos)
8229 (setq org-table-may-need-update nil) 8688 (setq org-table-may-need-update nil)
8230 (if (org-in-invisibility-spec-p '(org-table))
8231 (org-table-add-invisible-to-vertical-lines))
8232 )) 8689 ))
8233 8690
8691(defun org-string-width (s)
8692 "Compute width of string, ignoring invisible characters.
8693This ignores character with invisibility property `org-link', and also
8694characters with property `org-cwidth', because these will become invisible
8695upon the next fontification round."
8696 (let (b)
8697 (when (or (eq t buffer-invisibility-spec)
8698 (assq 'org-link buffer-invisibility-spec))
8699 (while (setq b (text-property-any 0 (length s)
8700 'invisible 'org-link s))
8701 (setq s (concat (substring s 0 b)
8702 (substring s (or (next-single-property-change
8703 b 'invisible s) (length s)))))))
8704 (while (setq b (text-property-any 0 (length s) 'org-cwidth t s))
8705 (setq s (concat (substring s 0 b)
8706 (substring s (or (next-single-property-change
8707 b 'org-cwidth s) (length s))))))
8708 (string-width s)))
8709
8234(defun org-table-begin (&optional table-type) 8710(defun org-table-begin (&optional table-type)
8235 "Find the beginning of the table and return its position. 8711 "Find the beginning of the table and return its position.
8236With argument TABLE-TYPE, go to the beginning of a table.el-type table." 8712With argument TABLE-TYPE, go to the beginning of a table.el-type table."
@@ -8261,10 +8737,7 @@ With argument TABLE-TYPE, go to the end of a table.el-type table."
8261Optional argument NEW may specify text to replace the current field content." 8737Optional argument NEW may specify text to replace the current field content."
8262 (cond 8738 (cond
8263 ((and (not new) org-table-may-need-update)) ; Realignment will happen anyway 8739 ((and (not new) org-table-may-need-update)) ; Realignment will happen anyway
8264 ((org-at-table-hline-p) 8740 ((org-at-table-hline-p))
8265 ;; FIXME: I used to enforce realign here, but I think this is not needed.
8266 ;; (setq org-table-may-need-update t)
8267 )
8268 ((and (not new) 8741 ((and (not new)
8269 (or (not (equal (marker-buffer org-table-aligned-begin-marker) 8742 (or (not (equal (marker-buffer org-table-aligned-begin-marker)
8270 (current-buffer))) 8743 (current-buffer)))
@@ -8275,7 +8748,7 @@ Optional argument NEW may specify text to replace the current field content."
8275 (t ;; realign the current field, based on previous full realign 8748 (t ;; realign the current field, based on previous full realign
8276 (let* ((pos (point)) s 8749 (let* ((pos (point)) s
8277 (col (org-table-current-column)) 8750 (col (org-table-current-column))
8278 (num (nth (1- col) org-table-last-alignment)) 8751 (num (if (> col 0) (nth (1- col) org-table-last-alignment)))
8279 l f n o e) 8752 l f n o e)
8280 (when (> col 0) 8753 (when (> col 0)
8281 (skip-chars-backward "^|\n") 8754 (skip-chars-backward "^|\n")
@@ -8435,7 +8908,7 @@ This actually throws an error, so it aborts the current command."
8435 (if (looking-at "|[^|\n]+") 8908 (if (looking-at "|[^|\n]+")
8436 (let* ((pos (match-beginning 0)) 8909 (let* ((pos (match-beginning 0))
8437 (match (match-string 0)) 8910 (match (match-string 0))
8438 (len (string-width match))) 8911 (len (org-string-width match)))
8439 (replace-match (concat "|" (make-string (1- len) ?\ ))) 8912 (replace-match (concat "|" (make-string (1- len) ?\ )))
8440 (goto-char (+ 2 pos)) 8913 (goto-char (+ 2 pos))
8441 (substring match 1))))) 8914 (substring match 1)))))
@@ -8693,21 +9166,13 @@ With prefix ARG, insert below the current line."
8693 (interactive "P") 9166 (interactive "P")
8694 (if (not (org-at-table-p)) 9167 (if (not (org-at-table-p))
8695 (error "Not at a table")) 9168 (error "Not at a table"))
8696 (let* ((line 9169 (let* ((line (buffer-substring (point-at-bol) (point-at-eol)))
8697 (org-expand-wide-chars 9170 (new (org-table-clean-line line)))
8698 (buffer-substring-no-properties (point-at-bol) (point-at-eol))))
8699 new)
8700 (if (string-match "^[ \t]*|-" line)
8701 (setq new (mapcar (lambda (x) (if (member x '(?| ?+)) ?| ?\ )) line))
8702 (setq new (mapcar (lambda (x) (if (equal x ?|) ?| ?\ )) line)))
8703 ;; Fix the first field if necessary 9171 ;; Fix the first field if necessary
8704 (setq new (concat new))
8705 (if (string-match "^[ \t]*| *[#$] *|" line) 9172 (if (string-match "^[ \t]*| *[#$] *|" line)
8706 (setq new (replace-match (match-string 0 line) t t new))) 9173 (setq new (replace-match (match-string 0 line) t t new)))
8707 (beginning-of-line (if arg 2 1)) 9174 (beginning-of-line (if arg 2 1))
8708 (let (org-table-may-need-update) 9175 (let (org-table-may-need-update) (insert-before-markers new "\n"))
8709 (insert-before-markers new)
8710 (insert-before-markers "\n"))
8711 (beginning-of-line 0) 9176 (beginning-of-line 0)
8712 (re-search-forward "| ?" (point-at-eol) t) 9177 (re-search-forward "| ?" (point-at-eol) t)
8713 (and org-table-may-need-update (org-table-align)))) 9178 (and org-table-may-need-update (org-table-align))))
@@ -8718,39 +9183,31 @@ With prefix ARG, insert above the current line."
8718 (interactive "P") 9183 (interactive "P")
8719 (if (not (org-at-table-p)) 9184 (if (not (org-at-table-p))
8720 (error "Not at a table")) 9185 (error "Not at a table"))
8721 (let ((line 9186 (let ((line (org-table-clean-line
8722 (org-expand-wide-chars 9187 (buffer-substring (point-at-bol) (point-at-eol))))
8723 (buffer-substring-no-properties (point-at-bol) (point-at-eol)))) 9188 (col (current-column)))
8724 (col (current-column)) 9189 (while (string-match "|\\( +\\)|" line)
8725 start) 9190 (setq line (replace-match
8726 (if (string-match "^[ \t]*|-" line) 9191 (concat "+" (make-string (- (match-end 1) (match-beginning 1))
8727 (setq line 9192 ?-) "|") t t line)))
8728 (mapcar (lambda (x) (if (member x '(?| ?+)) 9193 (and (string-match "\\+" line) (setq line (replace-match "|" t t line)))
8729 (prog1 (if start ?+ ?|) (setq start t))
8730 (if start ?- ?\ )))
8731 line))
8732 (setq line
8733 (mapcar (lambda (x) (if (equal x ?|)
8734 (prog1 (if start ?+ ?|) (setq start t))
8735 (if start ?- ?\ )))
8736 line)))
8737 (beginning-of-line (if arg 1 2)) 9194 (beginning-of-line (if arg 1 2))
8738 (apply 'insert line) 9195 (insert line "\n")
8739 (if (equal (char-before (point)) ?+)
8740 (progn (backward-delete-char 1) (insert "|")))
8741 (insert "\n")
8742 (beginning-of-line (if arg 1 -1)) 9196 (beginning-of-line (if arg 1 -1))
8743 (move-to-column col))) 9197 (move-to-column col)))
8744 9198
8745(defun org-expand-wide-chars (s) 9199(defun org-table-clean-line (s)
8746 "Expand wide characters to spaces." 9200 "Convert a table line S into a string with only \"|\" and space.
8747 (let (w a) 9201In particular, this does handle wide and invisible characters."
8748 (mapconcat 9202 (if (string-match "^[ \t]*|-" s)
8749 (lambda (x) 9203 ;; It's a hline, just map the characters
8750 (if (> (setq w (string-width (setq a (char-to-string x)))) 1) 9204 (setq s (mapcar (lambda (x) (if (member x '(?| ?+)) ?| ?\ )) s))
8751 (make-string w ?\ ) 9205 (while (string-match "|\\([ \t]*?[^ \t\r\n|][^\r\n|]*\\)|" s)
8752 a)) 9206 (setq s (replace-match
8753 s ""))) 9207 (concat "|" (make-string (org-string-width (match-string 1 s))
9208 ?\ ) "|")
9209 t t s)))
9210 s))
8754 9211
8755(defun org-table-kill-row () 9212(defun org-table-kill-row ()
8756 "Delete the current row or horizontal line from the table." 9213 "Delete the current row or horizontal line from the table."
@@ -8982,6 +9439,64 @@ blank, and the content is appended to the field above."
8982 (insert (org-trim s) " ") 9439 (insert (org-trim s) " ")
8983 (org-table-align)))))) 9440 (org-table-align))))))
8984 9441
9442(defvar org-field-marker nil)
9443
9444(defun org-table-edit-field (arg)
9445 "Edit table field in a different window.
9446This is mainly useful for fields that contain hidden parts.
9447When called with a \\[universal-argument] prefix, just make the full field visible so that
9448it can be edited in place."
9449 (interactive "P")
9450 (if arg
9451 (let ((b (save-excursion (skip-chars-backward "^|") (point)))
9452 (e (save-excursion (skip-chars-forward "^|\r\n") (point))))
9453 (remove-text-properties b e '(org-cwidth t invisible t
9454 display t intangible t))
9455 (if (and (boundp 'font-lock-mode) font-lock-mode)
9456 (font-lock-fontify-block)))
9457 (let ((pos (move-marker (make-marker) (point)))
9458 (field (org-table-get-field))
9459 (cw (current-window-configuration))
9460 p)
9461 (switch-to-buffer-other-window "*Org tmp*")
9462 (erase-buffer)
9463 (insert "#\n# Edit field and finish with C-c C-c\n#\n")
9464 (org-mode)
9465 (goto-char (setq p (point-max)))
9466 (insert (org-trim field))
9467 (remove-text-properties p (point-max)
9468 '(invisible t org-cwidth t display t
9469 intangible t))
9470 (goto-char p)
9471 (set (make-local-variable 'org-finish-function)
9472 'org-table-finish-edit-field)
9473 (set (make-local-variable 'org-window-configuration) cw)
9474 (set (make-local-variable 'org-field-marker) pos)
9475 (message "Edit and finish with C-c C-c"))))
9476
9477(defun org-table-finish-edit-field ()
9478 "Finish editing a table data field.
9479Remove all newline characters, insert the result into the table, realign
9480the table and kill the editing buffer."
9481 (let ((pos org-field-marker)
9482 (cw org-window-configuration)
9483 (cb (current-buffer))
9484 text)
9485 (goto-char (point-min))
9486 (while (re-search-forward "^#.*\n?" nil t) (replace-match ""))
9487 (while (re-search-forward "\\([ \t]*\n[ \t]*\\)+" nil t)
9488 (replace-match " "))
9489 (setq text (org-trim (buffer-string)))
9490 (set-window-configuration cw)
9491 (kill-buffer cb)
9492 (select-window (get-buffer-window (marker-buffer pos)))
9493 (goto-char pos)
9494 (move-marker pos nil)
9495 (org-table-check-inside-data-field)
9496 (org-table-get-field nil text)
9497 (org-table-align)
9498 (message "New field value inserted")))
9499
8985(defun org-trim (s) 9500(defun org-trim (s)
8986 "Remove whitespace at beginning and end of string." 9501 "Remove whitespace at beginning and end of string."
8987 (if (string-match "^[ \t]+" s) (setq s (replace-match "" t t s))) 9502 (if (string-match "^[ \t]+" s) (setq s (replace-match "" t t s)))
@@ -8997,7 +9512,7 @@ IF WIDTH is nil and LINES is non-nil, the string is forced into at most that
8997many lines, whatever width that takes. 9512many lines, whatever width that takes.
8998The return value is a list of lines, without newlines at the end." 9513The return value is a list of lines, without newlines at the end."
8999 (let* ((words (org-split-string string "[ \t\n]+")) 9514 (let* ((words (org-split-string string "[ \t\n]+"))
9000 (maxword (apply 'max (mapcar 'string-width words))) 9515 (maxword (apply 'max (mapcar 'org-string-width words)))
9001 w ll) 9516 w ll)
9002 (cond (width 9517 (cond (width
9003 (org-do-wrap words (max maxword width))) 9518 (org-do-wrap words (max maxword width)))
@@ -9024,7 +9539,6 @@ The return value is a list of lines, without newlines at the end."
9024 (setq lines (push line lines))) 9539 (setq lines (push line lines)))
9025 (nreverse lines))) 9540 (nreverse lines)))
9026 9541
9027;; FIXME: I think I can make this more efficient
9028(defun org-split-string (string &optional separators) 9542(defun org-split-string (string &optional separators)
9029 "Splits STRING into substrings at SEPARATORS. 9543 "Splits STRING into substrings at SEPARATORS.
9030No empty strings are returned if there are matches at the beginning 9544No empty strings are returned if there are matches at the beginning
@@ -9053,49 +9567,6 @@ and end of string."
9053 list))) 9567 list)))
9054 (nreverse list))) 9568 (nreverse list)))
9055 9569
9056(defun org-table-add-invisible-to-vertical-lines ()
9057 "Add an `invisible' property to vertical lines of current table."
9058 (interactive)
9059 (let* ((beg (org-table-begin))
9060 (end (org-table-end))
9061 (end1))
9062 (save-excursion
9063 (goto-char beg)
9064 (while (< (point) end)
9065 (setq end1 (point-at-eol))
9066 (if (looking-at org-table-dataline-regexp)
9067 (while (re-search-forward "|" end1 t)
9068 (add-text-properties (1- (point)) (point)
9069 '(invisible org-table)))
9070 (while (re-search-forward "[+|]" end1 t)
9071 (add-text-properties (1- (point)) (point)
9072 '(invisible org-table))))
9073 (beginning-of-line 2)))))
9074
9075(defun org-table-toggle-vline-visibility (&optional arg)
9076 "Toggle the visibility of table vertical lines.
9077The effect is immediate and on all tables in the file.
9078With prefix ARG, make lines invisible when ARG is positive, make lines
9079visible when ARG is not positive."
9080 (interactive "P")
9081 (let ((action (cond
9082 ((and arg (> (prefix-numeric-value arg) 0)) 'on)
9083 ((and arg (< (prefix-numeric-value arg) 1)) 'off)
9084 (t (if (org-in-invisibility-spec-p '(org-table))
9085 'off
9086 'on)))))
9087 (if (eq action 'off)
9088 (progn
9089 (org-remove-from-invisibility-spec '(org-table))
9090 (org-table-map-tables 'org-table-align)
9091 (message "Vertical table lines visible")
9092 (if (org-at-table-p)
9093 (org-table-align)))
9094 (org-add-to-invisibility-spec '(org-table))
9095 (org-table-map-tables 'org-table-align)
9096 (message "Vertical table lines invisible"))
9097 (redraw-frame (selected-frame))))
9098
9099(defun org-table-map-tables (function) 9570(defun org-table-map-tables (function)
9100 "Apply FUNCTION to the start of all tables in the buffer." 9571 "Apply FUNCTION to the start of all tables in the buffer."
9101 (save-excursion 9572 (save-excursion
@@ -9107,7 +9578,8 @@ visible when ARG is not positive."
9107 (beginning-of-line 1) 9578 (beginning-of-line 1)
9108 (if (looking-at org-table-line-regexp) 9579 (if (looking-at org-table-line-regexp)
9109 (save-excursion (funcall function))) 9580 (save-excursion (funcall function)))
9110 (re-search-forward org-table-any-border-regexp nil 1))))) 9581 (re-search-forward org-table-any-border-regexp nil 1))))
9582 (message "Mapping tables: done"))
9111 9583
9112(defun org-table-sum (&optional beg end nlast) 9584(defun org-table-sum (&optional beg end nlast)
9113 "Sum numbers in region of current table column. 9585 "Sum numbers in region of current table column.
@@ -9362,13 +9834,13 @@ expected, for the other actions only a single column number is needed."
9362 ((eq action 'swap) 9834 ((eq action 'swap)
9363 (setq col1 (car columns) col2 (nth 1 columns) 9835 (setq col1 (car columns) col2 (nth 1 columns)
9364 sc1 (int-to-string col1) sc2 (int-to-string col2)) 9836 sc1 (int-to-string col1) sc2 (int-to-string col2))
9365 ;; Hopefully, ZqZ will never be a name in a table... FIXME: 9837 ;; Hopefully, ZqZtZ will never be a name in a table
9366 (org-table-replace-in-formulas list sc1 "ZqZ") 9838 (org-table-replace-in-formulas list sc1 "ZqZtZ")
9367 (org-table-replace-in-formulas list sc2 sc1) 9839 (org-table-replace-in-formulas list sc2 sc1)
9368 (org-table-replace-in-formulas list "ZqZ" sc2) 9840 (org-table-replace-in-formulas list "ZqZtZ" sc2)
9369 (if (assoc sc1 list) (setcar (assoc sc1 list) "ZqZ")) 9841 (if (assoc sc1 list) (setcar (assoc sc1 list) "ZqZtZ"))
9370 (if (assoc sc2 list) (setcar (assoc sc2 list) sc1)) 9842 (if (assoc sc2 list) (setcar (assoc sc2 list) sc1))
9371 (if (assoc "ZqZ" list) (setcar (assoc "ZqZ" list) sc2))) 9843 (if (assoc "ZqZtZ" list) (setcar (assoc "ZqZtZ" list) sc2)))
9372 (t (error "Invalid action in `org-table-modify-formulas'"))) 9844 (t (error "Invalid action in `org-table-modify-formulas'")))
9373 (if list (org-table-store-formulas list)))) 9845 (if list (org-table-store-formulas list))))
9374 9846
@@ -9797,7 +10269,6 @@ Parameters get priority."
9797(define-key org-edit-formulas-map "\C-c?" 'org-show-variable) 10269(define-key org-edit-formulas-map "\C-c?" 'org-show-variable)
9798 10270
9799(defvar org-pos) 10271(defvar org-pos)
9800(defvar org-window-configuration)
9801 10272
9802(defun org-table-edit-formulas () 10273(defun org-table-edit-formulas ()
9803 "Edit the formulas of the current table in a separate buffer." 10274 "Edit the formulas of the current table in a separate buffer."
@@ -9949,20 +10420,6 @@ With prefix ARG, apply the new formulas to the table."
9949;; active, this binding is ignored inside tables and replaced with a 10420;; active, this binding is ignored inside tables and replaced with a
9950;; modified self-insert. 10421;; modified self-insert.
9951 10422
9952(defcustom orgtbl-optimized (eq org-enable-table-editor 'optimized)
9953 "Non-nil means, use the optimized table editor version for `orgtbl-mode'.
9954In the optimized version, the table editor takes over all simple keys that
9955normally just insert a character. In tables, the characters are inserted
9956in a way to minimize disturbing the table structure (i.e. in overwrite mode
9957for empty fields). Outside tables, the correct binding of the keys is
9958restored.
9959
9960The default for this option is t if the optimized version is also used in
9961Org-mode. See the variable `org-enable-table-editor' for details. Changing
9962this variable requires a restart of Emacs to become effective."
9963 :group 'org-table
9964 :type 'boolean)
9965
9966(defvar orgtbl-mode nil 10423(defvar orgtbl-mode nil
9967 "Variable controlling `orgtbl-mode', a minor mode enabling the `org-mode' 10424 "Variable controlling `orgtbl-mode', a minor mode enabling the `org-mode'
9968table editor in arbitrary modes.") 10425table editor in arbitrary modes.")
@@ -10002,13 +10459,29 @@ table editor in arbitrary modes.")
10002 (if auto-fill-inhibit-regexp 10459 (if auto-fill-inhibit-regexp
10003 (concat "\\([ \t]*|\\|" auto-fill-inhibit-regexp) 10460 (concat "\\([ \t]*|\\|" auto-fill-inhibit-regexp)
10004 "[ \t]*|")) 10461 "[ \t]*|"))
10462 (org-add-to-invisibility-spec '(org-cwidth))
10005 (easy-menu-add orgtbl-mode-menu) 10463 (easy-menu-add orgtbl-mode-menu)
10006 (run-hooks 'orgtbl-mode-hook)) 10464 (run-hooks 'orgtbl-mode-hook))
10007 (setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp) 10465 (setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp)
10466 (org-cleanup-narrow-column-properties)
10467 (org-remove-from-invisibility-spec '(org-cwidth))
10008 (remove-hook 'before-change-functions 'org-before-change-function t) 10468 (remove-hook 'before-change-functions 'org-before-change-function t)
10009 (easy-menu-remove orgtbl-mode-menu) 10469 (easy-menu-remove orgtbl-mode-menu)
10010 (force-mode-line-update 'all)))) 10470 (force-mode-line-update 'all))))
10011 10471
10472(defun org-cleanup-narrow-column-properties ()
10473 "Remove all properties related to narrow-column invisibility."
10474 (let ((s 1))
10475 (while (setq s (text-property-any s (point-max)
10476 'display org-narrow-column-arrow))
10477 (remove-text-properties s (1+ s) '(display t)))
10478 (setq s 1)
10479 (while (setq s (text-property-any s (point-max) 'org-cwidth 1))
10480 (remove-text-properties s (1+ s) '(org-cwidth t)))
10481 (setq s 1)
10482 (while (setq s (text-property-any s (point-max) 'invisible 'org-cwidth))
10483 (remove-text-properties s (1+ s) '(invisible t)))))
10484
10012;; Install it as a minor mode. 10485;; Install it as a minor mode.
10013(put 'orgtbl-mode :included t) 10486(put 'orgtbl-mode :included t)
10014(put 'orgtbl-mode :menu-tag "Org Table Mode") 10487(put 'orgtbl-mode :menu-tag "Org Table Mode")
@@ -10069,10 +10542,11 @@ to execute outside of tables."
10069 '("\C-c?" org-table-current-column) 10542 '("\C-c?" org-table-current-column)
10070 '("\C-c " org-table-blank-field) 10543 '("\C-c " org-table-blank-field)
10071 '("\C-c+" org-table-sum) 10544 '("\C-c+" org-table-sum)
10072 '("\C-c|" org-table-toggle-vline-visibility)
10073 '("\C-c=" org-table-eval-formula) 10545 '("\C-c=" org-table-eval-formula)
10074 '("\C-c'" org-table-edit-formulas) 10546 '("\C-c'" org-table-edit-formulas)
10547 '("\C-c`" org-table-edit-field)
10075 '("\C-c*" org-table-recalculate) 10548 '("\C-c*" org-table-recalculate)
10549 '("\C-c|" org-table-create-or-convert-from-region)
10076 '("\C-c^" org-table-sort-lines) 10550 '("\C-c^" org-table-sort-lines)
10077 '([(control ?#)] org-table-rotate-recalc-marks))) 10551 '([(control ?#)] org-table-rotate-recalc-marks)))
10078 elt key fun cmd) 10552 elt key fun cmd)
@@ -10100,8 +10574,8 @@ to execute outside of tables."
10100 ;; some standard editing functions 10574 ;; some standard editing functions
10101 (org-remap orgtbl-mode-map 10575 (org-remap orgtbl-mode-map
10102 'self-insert-command 'orgtbl-self-insert-command 10576 'self-insert-command 'orgtbl-self-insert-command
10103 'delete-char 'orgtbl-delete-char 10577 'delete-char 'org-delete-char
10104 'delete-backward-char 'orgtbl-delete-backward-char) 10578 'delete-backward-char 'org-delete-backward-char)
10105 (define-key orgtbl-mode-map "|" 'org-force-self-insert)) 10579 (define-key orgtbl-mode-map "|" 'org-force-self-insert))
10106 (easy-menu-define orgtbl-mode-menu orgtbl-mode-map "OrgTbl menu" 10580 (easy-menu-define orgtbl-mode-menu orgtbl-mode-map "OrgTbl menu"
10107 '("OrgTbl" 10581 '("OrgTbl"
@@ -10111,6 +10585,7 @@ to execute outside of tables."
10111 ["Next Row" org-return :active (org-at-table-p) :keys "RET"] 10585 ["Next Row" org-return :active (org-at-table-p) :keys "RET"]
10112 "--" 10586 "--"
10113 ["Blank Field" org-table-blank-field :active (org-at-table-p) :keys "C-c SPC"] 10587 ["Blank Field" org-table-blank-field :active (org-at-table-p) :keys "C-c SPC"]
10588 ["Edit Field" org-table-edit-field :active (org-at-table-p) :keys "C-c ` "]
10114 ["Copy Field from Above" 10589 ["Copy Field from Above"
10115 org-table-copy-down :active (org-at-table-p) :keys "S-RET"] 10590 org-table-copy-down :active (org-at-table-p) :keys "S-RET"]
10116 "--" 10591 "--"
@@ -10118,7 +10593,9 @@ to execute outside of tables."
10118 ["Move Column Left" org-metaleft :active (org-at-table-p) :keys "M-<left>"] 10593 ["Move Column Left" org-metaleft :active (org-at-table-p) :keys "M-<left>"]
10119 ["Move Column Right" org-metaright :active (org-at-table-p) :keys "M-<right>"] 10594 ["Move Column Right" org-metaright :active (org-at-table-p) :keys "M-<right>"]
10120 ["Delete Column" org-shiftmetaleft :active (org-at-table-p) :keys "M-S-<left>"] 10595 ["Delete Column" org-shiftmetaleft :active (org-at-table-p) :keys "M-S-<left>"]
10121 ["Insert Column" org-shiftmetaright :active (org-at-table-p) :keys "M-S-<right>"]) 10596 ["Insert Column" org-shiftmetaright :active (org-at-table-p) :keys "M-S-<right>"]
10597 "--"
10598 ["Enable Narrowing" (setq org-table-limit-column-width (not org-table-limit-column-width)) :active (org-at-table-p) :selected org-table-limit-column-width :style toggle])
10122 ("Row" 10599 ("Row"
10123 ["Move Row Up" org-metaup :active (org-at-table-p) :keys "M-<up>"] 10600 ["Move Row Up" org-metaup :active (org-at-table-p) :keys "M-<up>"]
10124 ["Move Row Down" org-metadown :active (org-at-table-p) :keys "M-<down>"] 10601 ["Move Row Down" org-metadown :active (org-at-table-p) :keys "M-<down>"]
@@ -10148,11 +10625,12 @@ to execute outside of tables."
10148 )) 10625 ))
10149 t) 10626 t)
10150 10627
10151(defun orgtbl-tab () 10628(defun orgtbl-tab (arg)
10152 "Justification and field motion for `orgtbl-mode'." 10629 "Justification and field motion for `orgtbl-mode'."
10153 (interactive) 10630 (interactive "P")
10154 (org-table-justify-field-maybe) 10631 (if arg (org-table-edit-field t)
10155 (org-table-next-field)) 10632 (org-table-justify-field-maybe)
10633 (org-table-next-field)))
10156 10634
10157(defun orgtbl-ret () 10635(defun orgtbl-ret ()
10158 "Justification and field motion for `orgtbl-mode'." 10636 "Justification and field motion for `orgtbl-mode'."
@@ -10193,43 +10671,6 @@ overwritten, and the table is not marked as requiring realignment."
10193 (interactive "p") 10671 (interactive "p")
10194 (self-insert-command N)) 10672 (self-insert-command N))
10195 10673
10196(defun orgtbl-delete-backward-char (N)
10197 "Like `delete-backward-char', insert whitespace at field end in tables.
10198When deleting backwards, in tables this function will insert whitespace in
10199front of the next \"|\" separator, to keep the table aligned. The table will
10200still be marked for re-alignment, because a narrow field may lead to a
10201reduced column width."
10202 (interactive "p")
10203 (if (and (org-at-table-p)
10204 (eq N 1)
10205 (string-match "|" (buffer-substring (point-at-bol) (point)))
10206 (looking-at ".*?|"))
10207 (let ((pos (point)))
10208 (backward-delete-char N)
10209 (skip-chars-forward "^|")
10210 (insert " ")
10211 (goto-char (1- pos)))
10212 (delete-backward-char N)))
10213
10214(defun orgtbl-delete-char (N)
10215 "Like `delete-char', but insert whitespace at field end in tables.
10216When deleting characters, in tables this function will insert whitespace in
10217front of the next \"|\" separator, to keep the table aligned. The table
10218will still be marked for re-alignment, because a narrow field may lead to
10219a reduced column width."
10220 (interactive "p")
10221 (if (and (org-at-table-p)
10222 (not (bolp))
10223 (not (= (char-after) ?|))
10224 (eq N 1))
10225 (if (looking-at ".*?|")
10226 (let ((pos (point)))
10227 (replace-match (concat
10228 (substring (match-string 0) 1 -1)
10229 " |"))
10230 (goto-char pos)))
10231 (delete-char N)))
10232
10233;;; Exporting 10674;;; Exporting
10234 10675
10235(defconst org-level-max 20) 10676(defconst org-level-max 20)
@@ -10576,6 +11017,8 @@ translations. There is currently no way for users to extend this.")
10576 (let* ((cb (current-buffer)) 11017 (let* ((cb (current-buffer))
10577 (re-radio (and org-target-link-regexp 11018 (re-radio (and org-target-link-regexp
10578 (concat "\\([^<]\\)\\(" org-target-link-regexp "\\)"))) 11019 (concat "\\([^<]\\)\\(" org-target-link-regexp "\\)")))
11020 (re-plain-link (concat "\\([^[<]\\)" org-plain-link-re))
11021 (re-angle-link (concat "\\([^[]\\)" org-angle-link-re))
10579 rtn) 11022 rtn)
10580 (save-excursion 11023 (save-excursion
10581 (set-buffer (get-buffer-create " org-mode-tmp")) 11024 (set-buffer (get-buffer-create " org-mode-tmp"))
@@ -10587,16 +11030,30 @@ translations. There is currently no way for users to extend this.")
10587 (goto-char (point-min)) 11030 (goto-char (point-min))
10588 (while (re-search-forward "^#.*?\\(<<<?[^>\r\n]+>>>?\\).*" nil t) 11031 (while (re-search-forward "^#.*?\\(<<<?[^>\r\n]+>>>?\\).*" nil t)
10589 (replace-match "\\1(INVISIBLE)")) 11032 (replace-match "\\1(INVISIBLE)"))
10590 ;; Find matches for radio targets and turn them into links 11033 ;; Find matches for radio targets and turn them into internal links
10591 (goto-char (point-min)) 11034 (goto-char (point-min))
10592 (when re-radio 11035 (when re-radio
10593 (while (re-search-forward re-radio nil t) 11036 (while (re-search-forward re-radio nil t)
10594 (replace-match "\\1[[\\2]]"))) 11037 (replace-match "\\1[[\\2]]")))
10595 ;; Find all links that contain a newline and put them into a single line 11038 ;; Find all links that contain a newline and put them into a single line
10596 (goto-char (point-min)) 11039 (goto-char (point-min))
10597 (while (re-search-forward "\\(\\[\\[[^]]*?\\)[ \t]*\n[ \t]*\\([^]]*\\]\\]\\)" nil t) 11040 (while (re-search-forward "\\(\\(\\[\\|\\]\\)\\[[^]]*?\\)[ \t]*\n[ \t]*\\([^]]*\\]\\(\\[\\|\\]\\)\\)" nil t)
10598 (replace-match "\\1 \\2") 11041 (replace-match "\\1 \\3")
10599 (goto-char (match-beginning 0))) 11042 (goto-char (match-beginning 0)))
11043 ;; Normalize links: Convert angle and plain links into bracket links
11044 (goto-char (point-min))
11045 (while (re-search-forward re-plain-link nil t)
11046 (replace-match
11047 (concat
11048 (match-string 1) "[[" (match-string 2) ":" (match-string 3) "]]")
11049 t t))
11050 (goto-char (point-min))
11051 (while (re-search-forward re-angle-link nil t)
11052 (replace-match
11053 (concat
11054 (match-string 1) "[[" (match-string 2) ":" (match-string 3) "]]")
11055 t t))
11056
10600 ;; Remove comments 11057 ;; Remove comments
10601 (goto-char (point-min)) 11058 (goto-char (point-min))
10602 (while (re-search-forward "^#.*\n?" nil t) 11059 (while (re-search-forward "^#.*\n?" nil t)
@@ -10683,7 +11140,7 @@ underlined headlines. The default is 3."
10683 (buffer (find-file-noselect filename)) 11140 (buffer (find-file-noselect filename))
10684 (levels-open (make-vector org-level-max nil)) 11141 (levels-open (make-vector org-level-max nil))
10685 (date (format-time-string "%Y/%m/%d" (current-time))) 11142 (date (format-time-string "%Y/%m/%d" (current-time)))
10686 (time (format-time-string "%X" (current-time))) 11143 (time (format-time-string "%X" (org-current-time)))
10687 (author user-full-name) 11144 (author user-full-name)
10688 (title (buffer-name)) 11145 (title (buffer-name))
10689 (options nil) 11146 (options nil)
@@ -10742,7 +11199,8 @@ underlined headlines. The default is 3."
10742 (not (equal (match-string 2 line) 11199 (not (equal (match-string 2 line)
10743 org-done-string))) 11200 org-done-string)))
10744 ; TODO, not DONE 11201 ; TODO, not DONE
10745 (and (= level umax) 11202 (and org-export-mark-todo-in-toc
11203 (= level umax)
10746 (org-search-todo-below 11204 (org-search-todo-below
10747 line lines level)))) 11205 line lines level))))
10748 (setq txt (org-html-expand-for-ascii txt)) 11206 (setq txt (org-html-expand-for-ascii txt))
@@ -10800,7 +11258,7 @@ underlined headlines. The default is 3."
10800 (if todo (throw 'exit t)))))))) 11258 (if todo (throw 'exit t))))))))
10801 11259
10802;; FIXME: Try to handle <b> and <i> as faces via text properties. 11260;; FIXME: Try to handle <b> and <i> as faces via text properties.
10803;; FIXME: Can I implement *bold*,/italic/ and _underline_ for ASCII export? 11261;; We could also implement *bold*,/italic/ and _underline_ for ASCII export
10804(defun org-html-expand-for-ascii (line) 11262(defun org-html-expand-for-ascii (line)
10805 "Handle quoted HTML for ASCII export." 11263 "Handle quoted HTML for ASCII export."
10806 (if org-export-html-expand 11264 (if org-export-html-expand
@@ -10896,7 +11354,7 @@ Does include HTML export options as well as TODO and CATEGORY stuff."
10896#+CATEGORY: %s 11354#+CATEGORY: %s
10897#+SEQ_TODO: %s 11355#+SEQ_TODO: %s
10898#+TYP_TODO: %s 11356#+TYP_TODO: %s
10899#+STARTUP: %s %s %s %s 11357#+STARTUP: %s %s %s %s %s
10900#+ARCHIVE: %s 11358#+ARCHIVE: %s
10901" 11359"
10902 (buffer-name) (user-full-name) user-mail-address org-export-default-language 11360 (buffer-name) (user-full-name) user-mail-address org-export-default-language
@@ -10922,6 +11380,7 @@ Does include HTML export options as well as TODO and CATEGORY stuff."
10922 (if org-startup-with-deadline-check "dlcheck" "nodlcheck") 11380 (if org-startup-with-deadline-check "dlcheck" "nodlcheck")
10923 (if org-odd-levels-only "odd" "oddeven") 11381 (if org-odd-levels-only "odd" "oddeven")
10924 (if org-hide-leading-stars "hidestars" "showstars") 11382 (if org-hide-leading-stars "hidestars" "showstars")
11383 (if org-startup-align-all-tables "align" "noalign")
10925 org-archive-location 11384 org-archive-location
10926 )) 11385 ))
10927 11386
@@ -11023,7 +11482,7 @@ headlines. The default is 3. Lower levels will become bulleted lists."
11023 (buffer (find-file-noselect filename)) 11482 (buffer (find-file-noselect filename))
11024 (levels-open (make-vector org-level-max nil)) 11483 (levels-open (make-vector org-level-max nil))
11025 (date (format-time-string "%Y/%m/%d" (current-time))) 11484 (date (format-time-string "%Y/%m/%d" (current-time)))
11026 (time (format-time-string "%X" (current-time))) 11485 (time (format-time-string "%X" (org-current-time)))
11027 (author user-full-name) 11486 (author user-full-name)
11028 (title (buffer-name)) 11487 (title (buffer-name))
11029 (options nil) 11488 (options nil)
@@ -11052,6 +11511,7 @@ headlines. The default is 3. Lower levels will become bulleted lists."
11052 table-open type 11511 table-open type
11053 table-buffer table-orig-buffer 11512 table-buffer table-orig-buffer
11054 ind start-is-num starter 11513 ind start-is-num starter
11514 rpl path desc desc1 desc2 link
11055 ) 11515 )
11056 (message "Exporting...") 11516 (message "Exporting...")
11057 11517
@@ -11118,7 +11578,8 @@ headlines. The default is 3. Lower levels will become bulleted lists."
11118 (not (equal (match-string 2 line) 11578 (not (equal (match-string 2 line)
11119 org-done-string))) 11579 org-done-string)))
11120 ; TODO, not DONE 11580 ; TODO, not DONE
11121 (and (= level umax) 11581 (and org-export-mark-todo-in-toc
11582 (= level umax)
11122 (org-search-todo-below 11583 (org-search-todo-below
11123 line lines level)))) 11584 line lines level))))
11124 (if org-export-with-section-numbers 11585 (if org-export-with-section-numbers
@@ -11200,7 +11661,7 @@ headlines. The default is 3. Lower levels will become bulleted lists."
11200 (cond 11661 (cond
11201 ((match-end 2) 11662 ((match-end 2)
11202 (setq line (replace-match 11663 (setq line (replace-match
11203 (concat "@<a name=\"" 11664 (concat "@<a name=\""
11204 (org-solidify-link-text (match-string 1 line)) 11665 (org-solidify-link-text (match-string 1 line))
11205 "\">\\nbsp@</a>") 11666 "\">\\nbsp@</a>")
11206 t t line))) 11667 t t line)))
@@ -11211,28 +11672,10 @@ headlines. The default is 3. Lower levels will become bulleted lists."
11211 t t line))) 11672 t t line)))
11212 (t 11673 (t
11213 (setq line (replace-match 11674 (setq line (replace-match
11214 (concat "@<a name=\"" 11675 (concat "@<a name=\""
11215 (org-solidify-link-text (match-string 1 line)) 11676 (org-solidify-link-text (match-string 1 line))
11216 "\" class=\"target\">" (match-string 1 line) "@</a> ") 11677 "\" class=\"target\">" (match-string 1 line) "@</a> ")
11217 t t line))))) 11678 t t line)))))
11218 ;; Replace internal links
11219 (while (string-match org-bracket-link-regexp line)
11220 (setq line (replace-match
11221 (concat
11222 "@<a href=\"#"
11223 (org-solidify-link-text (match-string 1 line) target-alist)
11224 "\">"
11225 (match-string (if (match-end 3) 3 1) line)
11226 "@</a>")
11227 t t line)))
11228
11229 ;; Protect the external links
11230 (setq start 0)
11231 (while (string-match org-link-maybe-angles-regexp line start)
11232 (setq start (match-end 0))
11233 (setq line (replace-match
11234 (concat "\000" (match-string 1 line) "\000")
11235 t t line)))
11236 11679
11237 ;; replace "&" by "&amp;", "<" and ">" by "&lt;" and "&gt;" 11680 ;; replace "&" by "&amp;", "<" and ">" by "&lt;" and "&gt;"
11238 ;; handle @<..> HTML tags (replace "@&gt;..&lt;" by "<..>") 11681 ;; handle @<..> HTML tags (replace "@&gt;..&lt;" by "<..>")
@@ -11240,19 +11683,27 @@ headlines. The default is 3. Lower levels will become bulleted lists."
11240 11683
11241 ;; Format the links 11684 ;; Format the links
11242 (setq start 0) 11685 (setq start 0)
11243 (while (string-match org-protected-link-regexp line start) 11686 (while (string-match org-bracket-link-analytic-regexp line start)
11244 (setq start (- (match-end 0) 2)) 11687 (setq start (match-beginning 0))
11245 (setq type (match-string 1 line)) 11688 (setq type (if (match-end 2) (match-string 2 line) "internal"))
11689 (setq path (match-string 3 line))
11690 (setq desc1 (if (match-end 5) (match-string 5 line))
11691 desc2 (if (match-end 2) (concat type ":" path) path)
11692 desc (or desc1 desc2))
11246 (cond 11693 (cond
11694 ((equal type "internal")
11695 (setq rpl
11696 (concat
11697 "<a href=\"#"
11698 (org-solidify-link-text path target-alist)
11699 "\">" desc "</a>")))
11247 ((member type '("http" "https" "ftp" "mailto" "news")) 11700 ((member type '("http" "https" "ftp" "mailto" "news"))
11248 ;; standard URL 11701 ;; standard URL
11249 (setq line (replace-match 11702 (setq link (concat type ":" path))
11250 ; "<a href=\"\\1:\\2\">&lt;\\1:\\2&gt;</a>" 11703 (setq rpl (concat "<a href=\"" link "\">" desc "</a>")))
11251 "<a href=\"\\1:\\2\">\\1:\\2</a>"
11252 nil nil line)))
11253 ((string= type "file") 11704 ((string= type "file")
11254 ;; FILE link 11705 ;; FILE link
11255 (let* ((filename (match-string 2 line)) 11706 (let* ((filename path)
11256 (abs-p (file-name-absolute-p filename)) 11707 (abs-p (file-name-absolute-p filename))
11257 (thefile (if abs-p (expand-file-name filename) filename)) 11708 (thefile (if abs-p (expand-file-name filename) filename))
11258 (thefile (save-match-data 11709 (thefile (save-match-data
@@ -11262,17 +11713,15 @@ headlines. The default is 3. Lower levels will become bulleted lists."
11262 (file-is-image-p 11713 (file-is-image-p
11263 (save-match-data 11714 (save-match-data
11264 (string-match (org-image-file-name-regexp) thefile)))) 11715 (string-match (org-image-file-name-regexp) thefile))))
11265 (setq line (replace-match 11716 (setq rpl (if (and org-export-html-inline-images
11266 (if (and org-export-html-inline-images 11717 file-is-image-p)
11267 file-is-image-p) 11718 (concat "<img src=\"" thefile "\"/>")
11268 (concat "<img src=\"" thefile "\"/>") 11719 (concat "<a href=\"" thefile "\">" desc "</a>")))))
11269 (concat "<a href=\"" thefile "\">\\1:\\2</a>"))
11270 nil nil line))))
11271
11272 ((member type '("bbdb" "vm" "wl" "mhe" "rmail" "gnus" "shell")) 11720 ((member type '("bbdb" "vm" "wl" "mhe" "rmail" "gnus" "shell"))
11273 (setq line (replace-match 11721 (setq rpl (concat "<i>&lt;" type ":" path "&gt;</i>"))))
11274 "<i>&lt;\\1:\\2&gt;</i>" nil nil line))))) 11722 ;; FIXME: We get to see the escaped links!!!!!
11275 11723 (setq line (replace-match rpl t t line)
11724 start (+ start (length rpl))))
11276 ;; TODO items 11725 ;; TODO items
11277 (if (and (string-match org-todo-line-regexp line) 11726 (if (and (string-match org-todo-line-regexp line)
11278 (match-beginning 2)) 11727 (match-beginning 2))
@@ -11330,8 +11779,7 @@ headlines. The default is 3. Lower levels will become bulleted lists."
11330 (insert (org-format-table-html table-buffer table-orig-buffer)))) 11779 (insert (org-format-table-html table-buffer table-orig-buffer))))
11331 (t 11780 (t
11332 ;; Normal lines 11781 ;; Normal lines
11333 (when (and (> org-export-plain-list-max-depth 0) 11782 (when (and (string-match
11334 (string-match
11335 (cond 11783 (cond
11336 ((eq llt t) "^\\([ \t]*\\)\\(\\([-+*]\\)\\|\\([0-9]+[.)]\\)\\)?\\( +[^ \t\n\r]\\|[ \t]*$\\)") 11784 ((eq llt t) "^\\([ \t]*\\)\\(\\([-+*]\\)\\|\\([0-9]+[.)]\\)\\)?\\( +[^ \t\n\r]\\|[ \t]*$\\)")
11337 ((= llt ?.) "^\\([ \t]*\\)\\(\\([-+*]\\)\\|\\([0-9]+\\.\\)\\)?\\( +[^ \t\n\r]\\|[ \t]*$\\)") 11785 ((= llt ?.) "^\\([ \t]*\\)\\(\\([-+*]\\)\\|\\([0-9]+\\.\\)\\)?\\( +[^ \t\n\r]\\|[ \t]*$\\)")
@@ -11355,9 +11803,7 @@ headlines. The default is 3. Lower levels will become bulleted lists."
11355 (cond 11803 (cond
11356 ((and starter 11804 ((and starter
11357 (or (not in-local-list) 11805 (or (not in-local-list)
11358 (> ind (car local-list-indent))) 11806 (> ind (car local-list-indent))))
11359 (< (length local-list-indent)
11360 org-export-plain-list-max-depth))
11361 ;; Start new (level of ) list 11807 ;; Start new (level of ) list
11362 (insert (if start-is-num "<ol>\n<li>\n" "<ul>\n<li>\n")) 11808 (insert (if start-is-num "<ol>\n<li>\n" "<ul>\n<li>\n"))
11363 (push start-is-num local-list-num) 11809 (push start-is-num local-list-num)
@@ -11541,32 +11987,38 @@ But it has the disadvantage, that Org-mode's HTML conversions cannot be used."
11541 s) 11987 s)
11542 11988
11543(defun org-html-expand (string) 11989(defun org-html-expand (string)
11544 "Prepare STRING for HTML export. Applies all active conversions." 11990 "Prepare STRING for HTML export. Applies all active conversions.
11545 ;; First check if there is a link in the line - if yes, apply conversions 11991If there are links in the string, don't modify these."
11546 ;; only before the start of the link. 11992 (let* (m s l res)
11547 ;; FIXME: This is no longer correct, because links now have an end. 11993 (while (setq m (string-match org-bracket-link-regexp string))
11548 (let* ((m (string-match org-link-regexp string)) 11994 (setq s (substring string 0 m)
11549 (s (if m (substring string 0 m) string)) 11995 l (match-string 0 string)
11550 (r (if m (substring string m) ""))) 11996 string (substring string (match-end 0)))
11551 ;; convert & to &amp;, < to &lt; and > to &gt; 11997 (push (org-html-do-expand s) res)
11552 (setq s (org-html-protect s)) 11998 (push l res))
11553 (if org-export-html-expand 11999 (push (org-html-do-expand string) res)
11554 (while (string-match "@&lt;\\([^&]*\\)&gt;" s) 12000 (apply 'concat (nreverse res))))
11555 (setq s (replace-match "<\\1>" nil nil s)))) 12001
11556 (if org-export-with-emphasize 12002(defun org-html-do-expand (s)
11557 (setq s (org-export-html-convert-emphasize s))) 12003 "Apply all active conversions to translate special ASCII to HTML."
11558 (if org-export-with-sub-superscripts 12004 (setq s (org-html-protect s))
11559 (setq s (org-export-html-convert-sub-super s))) 12005 (if org-export-html-expand
11560 (if org-export-with-TeX-macros 12006 (while (string-match "@&lt;\\([^&]*\\)&gt;" s)
11561 (let ((start 0) wd ass) 12007 (setq s (replace-match "<\\1>" nil nil s))))
11562 (while (setq start (string-match "\\\\\\([a-zA-Z]+\\)" s start)) 12008 (if org-export-with-emphasize
11563 (setq wd (match-string 1 s)) 12009 (setq s (org-export-html-convert-emphasize s)))
11564 (if (setq ass (assoc wd org-html-entities)) 12010 (if org-export-with-sub-superscripts
11565 (setq s (replace-match (or (cdr ass) 12011 (setq s (org-export-html-convert-sub-super s)))
11566 (concat "&" (car ass) ";")) 12012 (if org-export-with-TeX-macros
11567 t t s)) 12013 (let ((start 0) wd ass)
11568 (setq start (+ start (length wd))))))) 12014 (while (setq start (string-match "\\\\\\([a-zA-Z]+\\)" s start))
11569 (concat s r))) 12015 (setq wd (match-string 1 s))
12016 (if (setq ass (assoc wd org-html-entities))
12017 (setq s (replace-match (or (cdr ass)
12018 (concat "&" (car ass) ";"))
12019 t t s))
12020 (setq start (+ start (length wd)))))))
12021 s)
11570 12022
11571(defun org-create-multibrace-regexp (left right n) 12023(defun org-create-multibrace-regexp (left right n)
11572 "Create a regular expression which will match a balanced sexp. 12024 "Create a regular expression which will match a balanced sexp.
@@ -11613,25 +12065,14 @@ stacked delimiters is N. Escaping delimiters is not possible."
11613 string) 12065 string)
11614 12066
11615(defun org-export-html-convert-emphasize (string) 12067(defun org-export-html-convert-emphasize (string)
11616 (while (string-match 12068 (let (c (s 0))
11617 "\\(\\s-\\|^\\)\\(\\*\\([a-zA-Z]+\\)\\*\\)\\([^a-zA-Z*]\\|$\\)" 12069 (while (string-match "\\(\\W\\|^\\)\\([*/_]\\)\\(\\w+\\)\\2\\(\\W\\|$\\)" string s)
11618 string) 12070 (setq c (cdr (assoc (match-string 2 string)
11619 (setq string (replace-match 12071 '(("*" . "b") ("/" . "i") ("_" . "u"))))
11620 (concat "<b>" (match-string 3 string) "</b>") 12072 s (+ (match-end 0) 3)
11621 t t string 2))) 12073 string (replace-match
11622 (while (string-match 12074 (concat "\\1<" c ">\\3</" c ">\\4") t nil string)))
11623 "\\(\\s-\\|^\\)\\(/\\([a-zA-Z]+\\)/\\)\\([^a-zA-Z*]\\|$\\)" 12075 string))
11624 string)
11625 (setq string (replace-match
11626 (concat "<i>" (match-string 3 string) "</i>")
11627 t t string 2)))
11628 (while (string-match
11629 "\\(\\s-\\|^\\)\\(_\\([a-zA-Z]+\\)_\\)\\([^a-zA-Z*]\\|$\\)"
11630 string)
11631 (setq string (replace-match
11632 (concat "<u>" (match-string 3 string) "</u>")
11633 t t string 2)))
11634 string)
11635 12076
11636(defun org-parse-key-lines () 12077(defun org-parse-key-lines ()
11637 "Find the special key lines with the information for exporters." 12078 "Find the special key lines with the information for exporters."
@@ -11761,14 +12202,14 @@ file, but with extension `.ics'."
11761Each iCalendar file will be located in the same directory as the Org-mode 12202Each iCalendar file will be located in the same directory as the Org-mode
11762file, but with extension `.ics'." 12203file, but with extension `.ics'."
11763 (interactive) 12204 (interactive)
11764 (apply 'org-export-icalendar nil org-agenda-files)) 12205 (apply 'org-export-icalendar nil (org-agenda-files t)))
11765 12206
11766;;;###autoload 12207;;;###autoload
11767(defun org-export-icalendar-combine-agenda-files () 12208(defun org-export-icalendar-combine-agenda-files ()
11768 "Export all files in `org-agenda-files' to a single combined iCalendar file. 12209 "Export all files in `org-agenda-files' to a single combined iCalendar file.
11769The file is stored under the name `org-combined-agenda-icalendar-file'." 12210The file is stored under the name `org-combined-agenda-icalendar-file'."
11770 (interactive) 12211 (interactive)
11771 (apply 'org-export-icalendar t org-agenda-files)) 12212 (apply 'org-export-icalendar t (org-agenda-files t)))
11772 12213
11773(defun org-export-icalendar (combine &rest files) 12214(defun org-export-icalendar (combine &rest files)
11774 "Create iCalendar files for all elements of FILES. 12215 "Create iCalendar files for all elements of FILES.
@@ -11929,7 +12370,7 @@ a time), or the day by one (if it does not contain a time)."
11929(define-key org-mode-map [(meta tab)] 'org-complete) 12370(define-key org-mode-map [(meta tab)] 'org-complete)
11930(define-key org-mode-map "\M-\C-i" 'org-complete) ; for tty emacs 12371(define-key org-mode-map "\M-\C-i" 'org-complete) ; for tty emacs
11931;; The following line is necessary under Suse GNU/Linux 12372;; The following line is necessary under Suse GNU/Linux
11932(unless org-xemacs-p 12373(unless (featurep 'xemacs)
11933 (define-key org-mode-map [S-iso-lefttab] 'org-shifttab)) 12374 (define-key org-mode-map [S-iso-lefttab] 'org-shifttab))
11934(define-key org-mode-map [(shift tab)] 'org-shifttab) 12375(define-key org-mode-map [(shift tab)] 'org-shifttab)
11935 12376
@@ -12007,9 +12448,10 @@ a time), or the day by one (if it does not contain a time)."
12007(define-key org-mode-map "\C-c?" 'org-table-current-column) 12448(define-key org-mode-map "\C-c?" 'org-table-current-column)
12008(define-key org-mode-map "\C-c " 'org-table-blank-field) 12449(define-key org-mode-map "\C-c " 'org-table-blank-field)
12009(define-key org-mode-map "\C-c+" 'org-table-sum) 12450(define-key org-mode-map "\C-c+" 'org-table-sum)
12010(define-key org-mode-map "\C-c|" 'org-table-toggle-vline-visibility)
12011(define-key org-mode-map "\C-c=" 'org-table-eval-formula) 12451(define-key org-mode-map "\C-c=" 'org-table-eval-formula)
12012(define-key org-mode-map "\C-c'" 'org-table-edit-formulas) 12452(define-key org-mode-map "\C-c'" 'org-table-edit-formulas)
12453(define-key org-mode-map "\C-c`" 'org-table-edit-field)
12454(define-key org-mode-map "\C-c|" 'org-table-create-or-convert-from-region)
12013(define-key org-mode-map "\C-c*" 'org-table-recalculate) 12455(define-key org-mode-map "\C-c*" 'org-table-recalculate)
12014(define-key org-mode-map [(control ?#)] 'org-table-rotate-recalc-marks) 12456(define-key org-mode-map [(control ?#)] 'org-table-rotate-recalc-marks)
12015(define-key org-mode-map "\C-c~" 'org-table-create-with-table.el) 12457(define-key org-mode-map "\C-c~" 'org-table-create-with-table.el)
@@ -12028,6 +12470,8 @@ a time), or the day by one (if it does not contain a time)."
12028(define-key org-mode-map "\C-c\C-xt" 'org-insert-export-options-template) 12470(define-key org-mode-map "\C-c\C-xt" 'org-insert-export-options-template)
12029(define-key org-mode-map "\C-c:" 'org-toggle-fixed-width-section) 12471(define-key org-mode-map "\C-c:" 'org-toggle-fixed-width-section)
12030(define-key org-mode-map "\C-c\C-xh" 'org-export-as-html) 12472(define-key org-mode-map "\C-c\C-xh" 'org-export-as-html)
12473(define-key org-mode-map "\C-c\C-xx" 'org-export-as-xml)
12474(define-key org-mode-map "\C-c\C-x\C-x" 'org-export-as-xml)
12031(define-key org-mode-map "\C-c\C-xb" 'org-export-as-html-and-open) 12475(define-key org-mode-map "\C-c\C-xb" 'org-export-as-html-and-open)
12032(define-key org-mode-map "\C-c\C-x\C-b" 'org-export-as-html-and-open) 12476(define-key org-mode-map "\C-c\C-x\C-b" 'org-export-as-html-and-open)
12033 12477
@@ -12044,14 +12488,19 @@ If the cursor is in a table looking at whitespace, the whitespace is
12044overwritten, and the table is not marked as requiring realignment." 12488overwritten, and the table is not marked as requiring realignment."
12045 (interactive "p") 12489 (interactive "p")
12046 (if (and (org-table-p) 12490 (if (and (org-table-p)
12047 (or 12491 (progn
12048 (and org-table-auto-blank-field 12492 ;; check if we blank the field, and if that triggers align
12049 (member last-command 12493 (and org-table-auto-blank-field
12050 '(org-cycle org-return org-shifttab org-ctrl-c-ctrl-c)) 12494 (member last-command
12051 (org-table-blank-field)) 12495 '(org-cycle org-return org-shifttab org-ctrl-c-ctrl-c))
12052 t) 12496 (if (or (equal (char-after) ?\ ) (looking-at "[^|\n]* |"))
12497 ;; got extra space, this field does not determine column width
12498 (let (org-table-may-need-update) (org-table-blank-field))
12499 ;; no extra space, this field may determine column width
12500 (org-table-blank-field)))
12501 t)
12053 (eq N 1) 12502 (eq N 1)
12054 (looking-at "[^|\n]* +|")) 12503 (looking-at "[^|\n]* |"))
12055 (let (org-table-may-need-update) 12504 (let (org-table-may-need-update)
12056 (goto-char (1- (match-end 0))) 12505 (goto-char (1- (match-end 0)))
12057 (delete-backward-char 1) 12506 (delete-backward-char 1)
@@ -12060,45 +12509,51 @@ overwritten, and the table is not marked as requiring realignment."
12060 (setq org-table-may-need-update t) 12509 (setq org-table-may-need-update t)
12061 (self-insert-command N))) 12510 (self-insert-command N)))
12062 12511
12063;; FIXME:
12064;; The following two functions might still be optimized to trigger
12065;; re-alignment less frequently.
12066
12067(defun org-delete-backward-char (N) 12512(defun org-delete-backward-char (N)
12068 "Like `delete-backward-char', insert whitespace at field end in tables. 12513 "Like `delete-backward-char', insert whitespace at field end in tables.
12069When deleting backwards, in tables this function will insert whitespace in 12514When deleting backwards, in tables this function will insert whitespace in
12070front of the next \"|\" separator, to keep the table aligned. The table will 12515front of the next \"|\" separator, to keep the table aligned. The table will
12071still be marked for re-alignment, because a narrow field may lead to a 12516still be marked for re-alignment if the field did fill the entire column,
12072reduced column width." 12517because, in this case the deletion might narrow the column."
12073 (interactive "p") 12518 (interactive "p")
12074 (if (and (org-table-p) 12519 (if (and (org-table-p)
12075 (eq N 1) 12520 (eq N 1)
12076 (string-match "|" (buffer-substring (point-at-bol) (point))) 12521 (string-match "|" (buffer-substring (point-at-bol) (point)))
12077 (looking-at ".*?|")) 12522 (looking-at ".*?|"))
12078 (let ((pos (point))) 12523 (let ((pos (point))
12524 (noalign (looking-at "[^|\n\r]* |"))
12525 (c org-table-may-need-update))
12079 (backward-delete-char N) 12526 (backward-delete-char N)
12080 (skip-chars-forward "^|") 12527 (skip-chars-forward "^|")
12081 (insert " ") 12528 (insert " ")
12082 (goto-char (1- pos))) 12529 (goto-char (1- pos))
12530 ;; noalign: if there were two spaces at the end, this field
12531 ;; does not determine the width of the column.
12532 (if noalign (setq org-table-may-need-update c)))
12083 (backward-delete-char N))) 12533 (backward-delete-char N)))
12084 12534
12085(defun org-delete-char (N) 12535(defun org-delete-char (N)
12086 "Like `delete-char', but insert whitespace at field end in tables. 12536 "Like `delete-char', but insert whitespace at field end in tables.
12087When deleting characters, in tables this function will insert whitespace in 12537When deleting characters, in tables this function will insert whitespace in
12088front of the next \"|\" separator, to keep the table aligned. The table 12538front of the next \"|\" separator, to keep the table aligned. The table will
12089will still be marked for re-alignment, because a narrow field may lead to 12539still be marked for re-alignment if the field did fill the entire column,
12090a reduced column width." 12540because, in this case the deletion might narrow the column."
12091 (interactive "p") 12541 (interactive "p")
12092 (if (and (org-table-p) 12542 (if (and (org-table-p)
12093 (not (bolp)) 12543 (not (bolp))
12094 (not (= (char-after) ?|)) 12544 (not (= (char-after) ?|))
12095 (eq N 1)) 12545 (eq N 1))
12096 (if (looking-at ".*?|") 12546 (if (looking-at ".*?|")
12097 (let ((pos (point))) 12547 (let ((pos (point))
12548 (noalign (looking-at "[^|\n\r]* |"))
12549 (c org-table-may-need-update))
12098 (replace-match (concat 12550 (replace-match (concat
12099 (substring (match-string 0) 1 -1) 12551 (substring (match-string 0) 1 -1)
12100 " |")) 12552 " |"))
12101 (goto-char pos))) 12553 (goto-char pos)
12554 ;; noalign: if there were two spaces at the end, this field
12555 ;; does not determine the width of the column.
12556 (if noalign (setq org-table-may-need-update c))))
12102 (delete-char N))) 12557 (delete-char N)))
12103 12558
12104;; How to do this: Measure non-white length of current string 12559;; How to do this: Measure non-white length of current string
@@ -12303,6 +12758,9 @@ If the cursor is on a #+TBLFM line, re-apply the formulae to the table."
12303 (interactive "P") 12758 (interactive "P")
12304 (let ((org-enable-table-editor t)) 12759 (let ((org-enable-table-editor t))
12305 (cond 12760 (cond
12761 ((and (local-variable-p 'org-finish-function (current-buffer))
12762 (fboundp org-finish-function))
12763 (funcall org-finish-function))
12306 ((org-on-target-p) (org-update-radio-target-regexp)) 12764 ((org-on-target-p) (org-update-radio-target-regexp))
12307 ((org-on-heading-p) (org-set-tags arg)) 12765 ((org-on-heading-p) (org-set-tags arg))
12308 ((org-at-table.el-p) 12766 ((org-at-table.el-p)
@@ -12328,14 +12786,6 @@ If the cursor is on a #+TBLFM line, re-apply the formulae to the table."
12328 (if (org-at-table-p) (org-table-recalculate t)))) 12786 (if (org-at-table-p) (org-table-recalculate t))))
12329 (t 12787 (t
12330 (org-mode-restart)))) 12788 (org-mode-restart))))
12331 ((org-region-active-p)
12332 (org-table-convert-region (region-beginning) (region-end) arg))
12333 ((condition-case nil
12334 (and (region-beginning) (region-end))
12335 (error nil))
12336 (if (y-or-n-p "Convert inactive region to table? ")
12337 (org-table-convert-region (region-beginning) (region-end) arg)
12338 (error "Abort")))
12339 (t (error "C-c C-c can do nothing useful at this location."))))) 12789 (t (error "C-c C-c can do nothing useful at this location.")))))
12340 12790
12341(defun org-mode-restart () 12791(defun org-mode-restart ()
@@ -12377,13 +12827,16 @@ See the individual commands for more information."
12377 ["Next Row" org-return (org-at-table-p)] 12827 ["Next Row" org-return (org-at-table-p)]
12378 "--" 12828 "--"
12379 ["Blank Field" org-table-blank-field (org-at-table-p)] 12829 ["Blank Field" org-table-blank-field (org-at-table-p)]
12830 ["Edit Field" org-table-edit-field (org-at-table-p)]
12380 ["Copy Field from Above" org-table-copy-down (org-at-table-p)] 12831 ["Copy Field from Above" org-table-copy-down (org-at-table-p)]
12381 "--" 12832 "--"
12382 ("Column" 12833 ("Column"
12383 ["Move Column Left" org-metaleft (org-at-table-p)] 12834 ["Move Column Left" org-metaleft (org-at-table-p)]
12384 ["Move Column Right" org-metaright (org-at-table-p)] 12835 ["Move Column Right" org-metaright (org-at-table-p)]
12385 ["Delete Column" org-shiftmetaleft (org-at-table-p)] 12836 ["Delete Column" org-shiftmetaleft (org-at-table-p)]
12386 ["Insert Column" org-shiftmetaright (org-at-table-p)]) 12837 ["Insert Column" org-shiftmetaright (org-at-table-p)]
12838 "--"
12839 ["Enable Narrowing" (setq org-table-limit-column-width (not org-table-limit-column-width)) :active (org-at-table-p) :selected org-table-limit-column-width :style toggle])
12387 ("Row" 12840 ("Row"
12388 ["Move Row Up" org-metaup (org-at-table-p)] 12841 ["Move Row Up" org-metaup (org-at-table-p)]
12389 ["Move Row Down" org-metadown (org-at-table-p)] 12842 ["Move Row Down" org-metadown (org-at-table-p)]
@@ -12414,12 +12867,9 @@ See the individual commands for more information."
12414 (setq org-table-formula-debug (not org-table-formula-debug)) 12867 (setq org-table-formula-debug (not org-table-formula-debug))
12415 :style toggle :selected org-table-formula-debug] 12868 :style toggle :selected org-table-formula-debug]
12416 "--" 12869 "--"
12417 ["Invisible Vlines" org-table-toggle-vline-visibility
12418 :style toggle :selected (org-in-invisibility-spec-p '(org-table))]
12419 "--"
12420 ["Create" org-table-create (and (not (org-at-table-p)) 12870 ["Create" org-table-create (and (not (org-at-table-p))
12421 org-enable-table-editor)] 12871 org-enable-table-editor)]
12422 ["Convert Region" org-ctrl-c-ctrl-c (not (org-at-table-p 'any))] 12872 ["Convert Region" org-table-convert-region (not (org-at-table-p 'any))]
12423 ["Import from File" org-table-import (not (org-at-table-p))] 12873 ["Import from File" org-table-import (not (org-at-table-p))]
12424 ["Export to File" org-table-export (org-at-table-p)] 12874 ["Export to File" org-table-export (org-at-table-p)]
12425 "--" 12875 "--"
@@ -12493,14 +12943,26 @@ See the individual commands for more information."
12493 ("Hyperlinks" 12943 ("Hyperlinks"
12494 ["Store Link (Global)" org-store-link t] 12944 ["Store Link (Global)" org-store-link t]
12495 ["Insert Link" org-insert-link t] 12945 ["Insert Link" org-insert-link t]
12496 ["Follow Link" org-open-at-point t]) 12946 ["Follow Link" org-open-at-point t]
12947 "--"
12948 ["Descriptive Links"
12949 (progn (org-add-to-invisibility-spec '(org-link)) (org-restart-font-lock))
12950 :style radio :selected (member '(org-link) buffer-invisibility-spec)]
12951 ["Literal Links"
12952 (progn
12953 (org-remove-from-invisibility-spec '(org-link)) (org-restart-font-lock))
12954 :style radio :selected (not (member '(org-link) buffer-invisibility-spec))]
12955 "--"
12956 ["Upgrade all <link> to [[link][desc]]" org-upgrade-old-links
12957 (save-excursion (goto-char (point-min))
12958 (re-search-forward "<[a-z]+:" nil t))])
12497 "--" 12959 "--"
12498 ("Export" 12960 ("Export"
12499 ["ASCII" org-export-as-ascii t] 12961 ["ASCII" org-export-as-ascii t]
12500 ["Extract Visible Text" org-export-copy-visible t] 12962 ["Extract Visible Text" org-export-copy-visible t]
12501 ["HTML" org-export-as-html t] 12963 ["HTML" org-export-as-html t]
12502 ["HTML and Open" org-export-as-html-and-open t] 12964 ["HTML and Open" org-export-as-html-and-open t]
12503; ["OPML" org-export-as-opml nil] 12965 ["XML (XOXO)" org-export-as-xml t]
12504 "--" 12966 "--"
12505 ["iCalendar this file" org-export-icalendar-this-file t] 12967 ["iCalendar this file" org-export-icalendar-this-file t]
12506 ["iCalendar all agenda files" org-export-icalendar-all-agenda-files 12968 ["iCalendar all agenda files" org-export-icalendar-all-agenda-files
@@ -12516,7 +12978,7 @@ See the individual commands for more information."
12516 ("Customize" 12978 ("Customize"
12517 ["Browse Org Group" org-customize t] 12979 ["Browse Org Group" org-customize t]
12518 "--" 12980 "--"
12519 ["Build Full Customize Menu" org-create-customize-menu 12981 ["Expand This Menu" org-create-customize-menu
12520 (fboundp 'customize-menu-create)]) 12982 (fboundp 'customize-menu-create)])
12521 "--" 12983 "--"
12522 ["Refresh setup" org-mode-restart t] 12984 ["Refresh setup" org-mode-restart t]
@@ -12530,16 +12992,22 @@ With optional NODE, go directly to that node."
12530 (Info-goto-node (format "(org)%s" (or node "")))) 12992 (Info-goto-node (format "(org)%s" (or node ""))))
12531 12993
12532(defun org-install-agenda-files-menu () 12994(defun org-install-agenda-files-menu ()
12533 (easy-menu-change 12995 (let ((bl (buffer-list)))
12534 '("Org") "File List for Agenda" 12996 (save-excursion
12535 (append 12997 (while bl
12536 (list 12998 (set-buffer (pop bl))
12537 ["Edit File List" (customize-variable 'org-agenda-files) t] 12999 (if (eq major-mode 'org-mode) (setq bl nil)))
12538 ["Add/Move Current File to Front of List" org-agenda-file-to-front t] 13000 (when (eq major-mode 'org-mode)
12539 ["Remove Current File from List" org-remove-file t] 13001 (easy-menu-change
12540 ["Cycle through agenda files" org-cycle-agenda-files t] 13002 '("Org") "File List for Agenda"
12541 "--") 13003 (append
12542 (mapcar 'org-file-menu-entry org-agenda-files)))) 13004 (list
13005 ["Edit File List" (org-edit-agenda-file-list) t]
13006 ["Add/Move Current File to Front of List" org-agenda-file-to-front t]
13007 ["Remove Current File from List" org-remove-file t]
13008 ["Cycle through agenda files" org-cycle-agenda-files t]
13009 "--")
13010 (mapcar 'org-file-menu-entry (org-agenda-files t))))))))
12543 13011
12544;;; Documentation 13012;;; Documentation
12545 13013
@@ -12650,7 +13118,7 @@ work correctly."
12650 13118
12651(defun org-add-hook (hook function &optional append local) 13119(defun org-add-hook (hook function &optional append local)
12652 "Add-hook, compatible with both Emacsen." 13120 "Add-hook, compatible with both Emacsen."
12653 (if (and local org-xemacs-p) 13121 (if (and local (featurep 'xemacs))
12654 (add-local-hook hook function append) 13122 (add-local-hook hook function append)
12655 (add-hook hook function append local))) 13123 (add-hook hook function append local)))
12656 13124
@@ -12659,7 +13127,7 @@ work correctly."
12659Works on both Emacs and XEmacs." 13127Works on both Emacs and XEmacs."
12660 (if org-ignore-region 13128 (if org-ignore-region
12661 nil 13129 nil
12662 (if org-xemacs-p 13130 (if (featurep 'xemacs)
12663 (and zmacs-regions (region-active-p)) 13131 (and zmacs-regions (region-active-p))
12664 (and transient-mark-mode mark-active)))) 13132 (and transient-mark-mode mark-active))))
12665 13133
@@ -12795,10 +13263,10 @@ If INVISIBLE-OK is non-nil, an invisible heading line is ok too."
12795 (save-excursion 13263 (save-excursion
12796 (skip-chars-forward "<") 13264 (skip-chars-forward "<")
12797 (and (re-search-backward "<<" nil t) 13265 (and (re-search-backward "<<" nil t)
12798 (or (looking-at org-target-regexp) 13266 (or (looking-at org-radio-target-regexp)
12799 (looking-at org-radio-target-regexp)) 13267 (looking-at org-target-regexp))
12800 (<= (match-beginning 0) pos) 13268 (<= (match-beginning 0) pos)
12801 (>= (match-end 0) pos))))) 13269 (>= (1+ (match-end 0)) pos)))))
12802 13270
12803(defun org-up-heading-all (arg) 13271(defun org-up-heading-all (arg)
12804 "Move to the heading line of which the present line is a subheading. 13272 "Move to the heading line of which the present line is a subheading.
@@ -12934,5 +13402,114 @@ Show the heading too, if it is currently invisible."
12934 13402
12935(run-hooks 'org-load-hook) 13403(run-hooks 'org-load-hook)
12936 13404
13405;; Experimental code
13406;; FIXME: Move this code when it is ready.
13407
13408(defun org-upgrade-old-links (&optional query-description)
13409 "Transfer old <...> style links to new [[...]] style links.
13410With arg query-description, ask at each match for a description text to use
13411for this link."
13412 (interactive (list (y-or-n-p "Would you like to be queried for a description at each link?")))
13413 (save-excursion
13414 (goto-char (point-min))
13415 (let ((re (concat "\\([^[]\\)<\\("
13416 "\\(" (mapconcat 'identity org-link-types "\\|")
13417 "\\):"
13418 "[^" org-non-link-chars "]+\\)>"))
13419 l1 l2 (cnt 0))
13420 (while (re-search-forward re nil t)
13421 (setq cnt (1+ cnt)
13422 l1 (org-match-string-no-properties 2)
13423 l2 (save-match-data (org-link-escape l1)))
13424 (when query-description (setq l1 (read-string "Desc: " l1)))
13425 (if (equal l1 l2)
13426 (replace-match (concat (match-string 1) "[[" l1 "]]") t t)
13427 (replace-match (concat (match-string 1) "[[" l2 "][" l1 "]]") t t)))
13428 (message "%d matches have beed treated" cnt))))
13429
13430(defun org-export-as-xml ()
13431 "Export current buffer as XOXO XML buffer."
13432 (interactive)
13433 (cond ((eq org-export-xml-type 'xoxo)
13434 (org-export-as-xoxo (current-buffer)))))
13435
13436(defun org-export-as-xoxo-insert-into (buffer &rest output)
13437 (with-current-buffer buffer
13438 (apply 'insert output)))
13439
13440(defun org-export-as-xoxo (&optional buffer)
13441 "Export the org buffer as XOXO.
13442The XOXO buffer is named *xoxo-<source buffer name>*"
13443 (interactive (list (current-buffer)))
13444 ;; A quickie abstraction
13445
13446 ;; Output everything as XOXO
13447 (with-current-buffer (get-buffer buffer)
13448 (goto-char (point-min)) ;; CD: beginning-of-buffer is not allowed.
13449 (let* ((filename (concat (file-name-sans-extension buffer-file-name)
13450 ".xml"))
13451 (out (find-file-noselect filename))
13452 (last-level 1)
13453 (hanging-li nil))
13454 ;; Check the output buffer is empty.
13455 (with-current-buffer out (erase-buffer))
13456 ;; Kick off the output
13457 (org-export-as-xoxo-insert-into out "<ol class='xoxo'>\n")
13458 (while (re-search-forward "^\\(\\*+\\) \\(.+\\)" (point-max) 't)
13459 (let* ((hd (match-string-no-properties 1))
13460 (level (length hd))
13461 (text (concat
13462 (match-string-no-properties 2)
13463 (save-excursion
13464 (goto-char (match-end 0))
13465 (let ((str ""))
13466 (catch 'loop
13467 (while 't
13468 (forward-line)
13469 (if (looking-at "^[ \t]\\(.*\\)")
13470 (setq str (concat str (match-string-no-properties 1)))
13471 (throw 'loop str)))))))))
13472
13473 ;; Handle level rendering
13474 (cond
13475 ((> level last-level)
13476 (org-export-as-xoxo-insert-into out "\n<ol>\n"))
13477
13478 ((< level last-level)
13479 (dotimes (- (- last-level level) 1)
13480 (if hanging-li
13481 (org-export-as-xoxo-insert-into out "</li>\n"))
13482 (org-export-as-xoxo-insert-into out "</ol>\n"))
13483 (when hanging-li
13484 (org-export-as-xoxo-insert-into out "</li>\n")
13485 (setq hanging-li nil)))
13486
13487 ((equal level last-level)
13488 (if hanging-li
13489 (org-export-as-xoxo-insert-into out "</li>\n")))
13490 )
13491
13492 (setq last-level level)
13493
13494 ;; And output the new li
13495 (setq hanging-li 't)
13496 (if (equal ?+ (elt text 0))
13497 (org-export-as-xoxo-insert-into out "<li class='" (substring text 1) "'>")
13498 (org-export-as-xoxo-insert-into out "<li>" text))))
13499
13500 ;; Finally finish off the ol
13501 (dotimes (- last-level 1)
13502 (if hanging-li
13503 (org-export-as-xoxo-insert-into out "</li>\n"))
13504 (org-export-as-xoxo-insert-into out "</ol>\n"))
13505
13506 ;; Finish the buffer off and clean it up.
13507 (switch-to-buffer-other-window out)
13508 (indent-region (point-min) (point-max) nil)
13509 (save-buffer)
13510 (goto-char (point-min))
13511 )))
13512
12937;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd 13513;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd
12938;;; org.el ends here 13514;;; org.el ends here
13515
diff --git a/lisp/vc.el b/lisp/vc.el
index b130aadb085..19b2f0f4a72 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -584,9 +584,9 @@ See `run-hooks'."
584 :group 'vc 584 :group 'vc
585 :version "21.1") 585 :version "21.1")
586 586
587(defcustom vc-annotate-display-mode nil 587(defcustom vc-annotate-display-mode 'fullscale
588 "Which mode to color the output of \\[vc-annotate] with by default." 588 "Which mode to color the output of \\[vc-annotate] with by default."
589 :type '(choice (const :tag "Default" nil) 589 :type '(choice (const :tag "By Color Map Range" nil)
590 (const :tag "Scale to Oldest" scale) 590 (const :tag "Scale to Oldest" scale)
591 (const :tag "Scale Oldest->Newest" fullscale) 591 (const :tag "Scale Oldest->Newest" fullscale)
592 (number :tag "Specify Fractional Number of Days" 592 (number :tag "Specify Fractional Number of Days"
@@ -617,30 +617,64 @@ version control backend imposes itself."
617 617
618;; Annotate customization 618;; Annotate customization
619(defcustom vc-annotate-color-map 619(defcustom vc-annotate-color-map
620 '(( 20. . "#FFCC00") 620 (if (and (tty-display-color-p) (<= (display-color-cells) 8))
621 ( 40. . "#FF6666") 621 ;; A custom sorted TTY colormap
622 ( 60. . "#FF6600") 622 (let* ((colors
623 ( 80. . "#FF3300") 623 (sort
624 (100. . "#FF00FF") 624 (delq nil
625 (120. . "#FF0000") 625 (mapcar (lambda (x)
626 (140. . "#CCCC00") 626 (if (not (or
627 (160. . "#CC00CC") 627 (string-equal (car x) "white")
628 (180. . "#BC8F8F") 628 (string-equal (car x) "black") ))
629 (200. . "#99CC00") 629 (car x)))
630 (220. . "#999900") 630 (tty-color-alist)))
631 (240. . "#7AC5CD") 631 (lambda (a b)
632 (260. . "#66CC00") 632 (cond
633 (280. . "#33CC33") 633 ((or (string-equal a "red") (string-equal b "blue")) t)
634 (300. . "#00CCFF") 634 ((or (string-equal b "red") (string-equal a "blue")) nil)
635 (320. . "#00CC99") 635 ((string-equal a "yellow") t)
636 (340. . "#0099FF")) 636 ((string-equal b "yellow") nil)
637 ((string-equal a "cyan") t)
638 ((string-equal b "cyan") nil)
639 ((string-equal a "green") t)
640 ((string-equal b "green") nil)
641 ((string-equal a "magenta") t)
642 ((string-equal b "magenta") nil)
643 (t (string< a b))))))
644 (date 20.)
645 (delta (/ (- 360. date) (1- (length colors)))))
646 (mapcar (lambda (x)
647 (prog1
648 (cons date x)
649 (setq date (+ date delta)))) colors))
650 ;; Normal colormap: hue stepped from 0-240deg, value=1., saturation=0.75
651 '(( 20. . "#FF3F3F")
652 ( 40. . "#FF6C3F")
653 ( 60. . "#FF993F")
654 ( 80. . "#FFC63F")
655 (100. . "#FFF33F")
656 (120. . "#DDFF3F")
657 (140. . "#B0FF3F")
658 (160. . "#83FF3F")
659 (180. . "#56FF3F")
660 (200. . "#3FFF56")
661 (220. . "#3FFF83")
662 (240. . "#3FFFB0")
663 (260. . "#3FFFDD")
664 (280. . "#3FF3FF")
665 (300. . "#3FC6FF")
666 (320. . "#3F99FF")
667 (340. . "#3F6CFF")
668 (360. . "#3F3FFF")))
637 "Association list of age versus color, for \\[vc-annotate]. 669 "Association list of age versus color, for \\[vc-annotate].
638Ages are given in units of fractional days. Default is eighteen steps 670Ages are given in units of fractional days. Default is eighteen
639using a twenty day increment." 671steps using a twenty day increment, from red to blue. For TTY
672displays with 8 or fewer colors, the default is red to blue with
673all other colors between (excluding black and white)."
640 :type 'alist 674 :type 'alist
641 :group 'vc) 675 :group 'vc)
642 676
643(defcustom vc-annotate-very-old-color "#0046FF" 677(defcustom vc-annotate-very-old-color "#3F3FFF"
644 "Color for lines older than the current color range in \\[vc-annotate]]." 678 "Color for lines older than the current color range in \\[vc-annotate]]."
645 :type 'string 679 :type 'string
646 :group 'vc) 680 :group 'vc)
@@ -852,7 +886,7 @@ However, before executing BODY, find FILE, and after BODY, save buffer."
852 (if vc-dired-mode 886 (if vc-dired-mode
853 (set-buffer (find-file-noselect (dired-get-filename))) 887 (set-buffer (find-file-noselect (dired-get-filename)))
854 (while vc-parent-buffer 888 (while vc-parent-buffer
855 (pop-to-buffer vc-parent-buffer)) 889 (set-buffer vc-parent-buffer))
856 (if (not buffer-file-name) 890 (if (not buffer-file-name)
857 (error "Buffer %s is not associated with a file" (buffer-name)) 891 (error "Buffer %s is not associated with a file" (buffer-name))
858 (if (not (vc-backend buffer-file-name)) 892 (if (not (vc-backend buffer-file-name))
@@ -2971,7 +3005,7 @@ cover the range from the oldest annotation to the newest."
2971(easy-menu-define vc-annotate-mode-menu vc-annotate-mode-map 3005(easy-menu-define vc-annotate-mode-menu vc-annotate-mode-map
2972 "VC Annotate Display Menu" 3006 "VC Annotate Display Menu"
2973 `("VC-Annotate" 3007 `("VC-Annotate"
2974 ["Default" (unless (null vc-annotate-display-mode) 3008 ["By Color Map Range" (unless (null vc-annotate-display-mode)
2975 (setq vc-annotate-display-mode nil) 3009 (setq vc-annotate-display-mode nil)
2976 (vc-annotate-display-select)) 3010 (vc-annotate-display-select))
2977 :style toggle :selected (null vc-annotate-display-mode)] 3011 :style toggle :selected (null vc-annotate-display-mode)]
@@ -3013,11 +3047,7 @@ BUFFER. `vc-annotate-display-mode' specifies the highlighting mode to
3013use; you may override this using the second optional arg MODE." 3047use; you may override this using the second optional arg MODE."
3014 (interactive) 3048 (interactive)
3015 (if mode (setq vc-annotate-display-mode mode)) 3049 (if mode (setq vc-annotate-display-mode mode))
3016 (when buffer 3050 (pop-to-buffer (or buffer (current-buffer)))
3017 (set-buffer buffer)
3018 (display-buffer buffer))
3019 (if (not vc-annotate-parent-rev)
3020 (vc-annotate-mode))
3021 (cond ((null vc-annotate-display-mode) 3051 (cond ((null vc-annotate-display-mode)
3022 ;; The ratio is global, thus relative to the global color-map. 3052 ;; The ratio is global, thus relative to the global color-map.
3023 (kill-local-variable 'vc-annotate-color-map) 3053 (kill-local-variable 'vc-annotate-color-map)
@@ -3087,15 +3117,19 @@ colors. `vc-annotate-background' specifies the background color."
3087 ;; In case it had to be uniquified. 3117 ;; In case it had to be uniquified.
3088 (setq temp-buffer-name (buffer-name)))) 3118 (setq temp-buffer-name (buffer-name))))
3089 (with-output-to-temp-buffer temp-buffer-name 3119 (with-output-to-temp-buffer temp-buffer-name
3090 (vc-call annotate-command file (get-buffer temp-buffer-name) rev)) 3120 (vc-call annotate-command file (get-buffer temp-buffer-name) rev)
3091 (with-current-buffer temp-buffer-name 3121 ;; we must setup the mode first, and then set our local
3092 (set (make-local-variable 'vc-annotate-backend) (vc-backend file)) 3122 ;; variables before the show-function is called at the exit of
3093 (set (make-local-variable 'vc-annotate-parent-file) file) 3123 ;; with-output-to-temp-buffer
3094 (set (make-local-variable 'vc-annotate-parent-rev) rev) 3124 (with-current-buffer temp-buffer-name
3095 (set (make-local-variable 'vc-annotate-parent-display-mode) 3125 (if (not (equal major-mode 'vc-annotate-mode))
3096 display-mode)) 3126 (vc-annotate-mode))
3097 3127 (set (make-local-variable 'vc-annotate-backend) (vc-backend file))
3098 (message "Annotating... done"))) 3128 (set (make-local-variable 'vc-annotate-parent-file) file)
3129 (set (make-local-variable 'vc-annotate-parent-rev) rev)
3130 (set (make-local-variable 'vc-annotate-parent-display-mode)
3131 display-mode)))
3132 (message "Annotating... done")))
3099 3133
3100(defun vc-annotate-prev-version (prefix) 3134(defun vc-annotate-prev-version (prefix)
3101 "Visit the annotation of the version previous to this one. 3135 "Visit the annotation of the version previous to this one.
@@ -3191,7 +3225,8 @@ string, then it describes a revision number, so warp to that
3191revision." 3225revision."
3192 (if (not (equal major-mode 'vc-annotate-mode)) 3226 (if (not (equal major-mode 'vc-annotate-mode))
3193 (message "Cannot be invoked outside of a vc annotate buffer") 3227 (message "Cannot be invoked outside of a vc annotate buffer")
3194 (let* ((oldline (line-number-at-pos)) 3228 (let* ((buf (current-buffer))
3229 (oldline (line-number-at-pos))
3195 (revspeccopy revspec) 3230 (revspeccopy revspec)
3196 (newrev nil)) 3231 (newrev nil))
3197 (cond 3232 (cond
@@ -3218,10 +3253,10 @@ revision."
3218 (when newrev 3253 (when newrev
3219 (vc-annotate vc-annotate-parent-file newrev 3254 (vc-annotate vc-annotate-parent-file newrev
3220 vc-annotate-parent-display-mode 3255 vc-annotate-parent-display-mode
3221 (current-buffer)) 3256 buf)
3222 (goto-line (min oldline (progn (goto-char (point-max)) 3257 (goto-line (min oldline (progn (goto-char (point-max))
3223 (previous-line) 3258 (previous-line)
3224 (line-number-at-pos)))))))) 3259 (line-number-at-pos))) buf)))))
3225 3260
3226(defun vc-annotate-compcar (threshold a-list) 3261(defun vc-annotate-compcar (threshold a-list)
3227 "Test successive cons cells of A-LIST against THRESHOLD. 3262 "Test successive cons cells of A-LIST against THRESHOLD.
@@ -3275,7 +3310,11 @@ The annotations are relative to the current time, unless overridden by OFFSET."
3275 (let* ((color (or (vc-annotate-compcar difference vc-annotate-color-map) 3310 (let* ((color (or (vc-annotate-compcar difference vc-annotate-color-map)
3276 (cons nil vc-annotate-very-old-color))) 3311 (cons nil vc-annotate-very-old-color)))
3277 ;; substring from index 1 to remove any leading `#' in the name 3312 ;; substring from index 1 to remove any leading `#' in the name
3278 (face-name (concat "vc-annotate-face-" (substring (cdr color) 1))) 3313 (face-name (concat "vc-annotate-face-"
3314 (if (string-equal
3315 (substring (cdr color) 0 1) "#")
3316 (substring (cdr color) 1)
3317 (cdr color))))
3279 ;; Make the face if not done. 3318 ;; Make the face if not done.
3280 (face (or (intern-soft face-name) 3319 (face (or (intern-soft face-name)
3281 (let ((tmp-face (make-face (intern face-name)))) 3320 (let ((tmp-face (make-face (intern face-name))))
diff --git a/lispref/ChangeLog b/lispref/ChangeLog
index 43fcd1e406d..f4ad95fc04e 100644
--- a/lispref/ChangeLog
+++ b/lispref/ChangeLog
@@ -1,3 +1,7 @@
12006-04-10 Bill Wohler <wohler@newt.com>
2
3 * customize.texi (Common Keywords): Add :package-version.
4
12006-04-10 Kim F. Storm <storm@cua.dk> 52006-04-10 Kim F. Storm <storm@cua.dk>
2 6
3 * text.texi (Buffer Contents): Add NOPROPS arg to 7 * text.texi (Buffer Contents): Add NOPROPS arg to
diff --git a/lispref/customize.texi b/lispref/customize.texi
index 1ae3b5b5132..a13793ecb54 100644
--- a/lispref/customize.texi
+++ b/lispref/customize.texi
@@ -130,6 +130,25 @@ any effect unless the code which implements the mode is loaded.
130This option specifies that the item was first introduced in Emacs 130This option specifies that the item was first introduced in Emacs
131version @var{version}, or that its default value was changed in that 131version @var{version}, or that its default value was changed in that
132version. The value @var{version} must be a string. 132version. The value @var{version} must be a string.
133
134@item :package-version '(@var{package} @var{version})
135This option specifies that the item was first introduced in
136@var{package} version @var{version}, or that its default value was
137changed in that version. This keyword takes priority over :version.
138The @var{package} and @var{version} must appear in the alist
139@code{customize-package-emacs-version-alist}. This alist maps packages
140to alists that map all package versions used with the
141@code{:package-version} keyword to Emacs versions. Packages are
142symbols and versions are strings. For example, the MH-E package
143updates this alist with the following:
144
145@smallexample
146(add-to-list 'customize-package-emacs-version-alist
147 '(MH-E ("6.0" "22.1") ("6.1" "22.1") ("7.0" "22.1")
148 ("7.1" "22.1") ("7.2" "22.1") ("7.3" "22.1")
149 ("7.4" "22.1") ("8.0" "22.1")))
150@end smallexample
151
133@end table 152@end table
134 153
135@node Group Definitions 154@node Group Definitions
diff --git a/man/ChangeLog b/man/ChangeLog
index c6ad56970a6..e084c379762 100644
--- a/man/ChangeLog
+++ b/man/ChangeLog
@@ -1,3 +1,40 @@
12006-04-11 Richard Stallman <rms@gnu.org>
2
3 * custom.texi (Safe File Variables):
4 Document enable-local-variables = :safe.
5
62006-04-11 Karl Berry <karl@gnu.org>
7
8 * emacs-xtra.texi, emacs.texi (Dired under VC, VC Dired Commands,
9 Remote Repositories, Version Backups, Local Version Control,
10 Snapshots, Making and Using Snapshots, Snapshot Caveats,
11 Miscellaneous Commands and Features of VC, Change Logs and VC,
12 Renaming VC Work Files and Master Files,
13 Inserting Version Control Headers, Customizing VC, General Options,
14 Options for RCS and SCCS, Options specific for CVS): move all
15 these nodes to emacs-xtra.texi, for brevity.
16 * cmdargs.texi, files.texi: change cross-references.
17
182006-04-11 Reiner Steib <Reiner.Steib@gmx.de>
19
20 * gnus.texi, gnus-faq.texi, message.texi: Gnus v5.10.8 is released.
21
222006-04-10 Reiner Steib <Reiner.Steib@gmx.de>
23
24 * gnus.texi (Misc Group Stuff, Summary Buffer, Article Keymap)
25 (Server Commands): Key `v' is reserved for users.
26
272006-04-11 J.D. Smith <jdsmith@as.arizona.edu>
28
29 * files.texi (Old Versions): Update description of vc-annotate's
30 use of color to indicate date ranges.
31
322006-04-11 Carsten Dominik <dominik@science.uva.nl>
33
34 * org.texi (Link format): New section, emphasis on bracket links.
35 (External links): Document bracket links.
36 (FAQ): Expanded to cover shell links and the new link format.
37
12006-04-09 Kevin Ryde <user42@zip.com.au> 382006-04-09 Kevin Ryde <user42@zip.com.au>
2 39
3 * org.texi (Formula syntax): Typo in node name of calc-eval xref. 40 * org.texi (Formula syntax): Typo in node name of calc-eval xref.
diff --git a/man/cmdargs.texi b/man/cmdargs.texi
index f266913d266..f1e7c539f76 100644
--- a/man/cmdargs.texi
+++ b/man/cmdargs.texi
@@ -551,7 +551,7 @@ The name of an interpreter used to parse and execute programs run from
551inside Emacs. 551inside Emacs.
552@item SMTPSERVER 552@item SMTPSERVER
553The name of the outgoing mail server. Used by the SMTP library 553The name of the outgoing mail server. Used by the SMTP library
554(@pxref{Top,,Sending mail via SMTP,smtpmail}). 554(@pxref{Top,,,Sending mail via SMTP,smtpmail}).
555@cindex background mode, on @command{xterm} 555@cindex background mode, on @command{xterm}
556@item TERM 556@item TERM
557The type of the terminal that Emacs is using. This variable must be 557The type of the terminal that Emacs is using. This variable must be
diff --git a/man/custom.texi b/man/custom.texi
index 8429ddaae74..f133e890b0a 100644
--- a/man/custom.texi
+++ b/man/custom.texi
@@ -1227,9 +1227,10 @@ values for these variables, do it directly by customizing
1227 The variable @code{enable-local-variables} allows you to change the 1227 The variable @code{enable-local-variables} allows you to change the
1228way Emacs processes local variables. Its default value is @code{t}, 1228way Emacs processes local variables. Its default value is @code{t},
1229which specifies the behavior described above. If it is @code{nil}, 1229which specifies the behavior described above. If it is @code{nil},
1230Emacs simply ignores all file local variables. Any other value says 1230Emacs simply ignores all file local variables. @code{:safe} means use
1231to query you about each file that has local variables, without trying 1231only the safe values and ignore the rest. Any other value says to
1232to determine whether the values are known to be safe. 1232query you about each file that has local variables, without trying to
1233determine whether the values are known to be safe.
1233 1234
1234@vindex enable-local-eval 1235@vindex enable-local-eval
1235 The variable @code{enable-local-eval} controls whether Emacs 1236 The variable @code{enable-local-eval} controls whether Emacs
diff --git a/man/emacs-xtra.texi b/man/emacs-xtra.texi
index 7f7574d05e5..d4a1e5f000e 100644
--- a/man/emacs-xtra.texi
+++ b/man/emacs-xtra.texi
@@ -57,12 +57,14 @@ license to the document, as described in section 6 of the license.
57@menu 57@menu
58* Introduction:: What documentation belongs here? 58* Introduction:: What documentation belongs here?
59* Autorevert:: Auto Reverting non-file buffers. 59* Autorevert:: Auto Reverting non-file buffers.
60* Subdir switches:: Subdirectory switches in Dired. 60* Subdir Switches:: Subdirectory switches in Dired.
61* Advanced Calendar/Diary Usage:: Advanced Calendar/Diary customization. 61* Advanced Calendar/Diary Usage:: Advanced Calendar/Diary customization.
62* Emerge:: A convenient way of merging two versions 62* Emerge:: A convenient way of merging two versions
63 of a program. 63 of a program.
64* Picture Mode:: Editing pictures made up of characters 64* Picture Mode:: Editing pictures made up of characters
65 using the quarter-plane screen model. 65 using the quarter-plane screen model.
66
67* Advanced VC Usage:: Advanced VC (version control) features.
66* Fortran:: Fortran mode and its special features. 68* Fortran:: Fortran mode and its special features.
67* MS-DOG:: 69* MS-DOG::
68* Index:: 70* Index::
@@ -273,7 +275,7 @@ for the buffer reliably assures that all information in the buffer is
273completely up to date (or will be after @code{auto-revert-interval} 275completely up to date (or will be after @code{auto-revert-interval}
274seconds). 276seconds).
275 277
276@node Subdir switches 278@node Subdir Switches
277@chapter Subdirectory Switches in Dired 279@chapter Subdirectory Switches in Dired
278 280
279You can insert subdirectories with specified @code{ls} switches in 281You can insert subdirectories with specified @code{ls} switches in
@@ -1889,6 +1891,887 @@ other modes. @kbd{C-c C-y} (@code{picture-yank-rectangle}) inserts
1889@kbd{C-c C-x} (@code{picture-yank-rectangle-from-register}) does 1891@kbd{C-c C-x} (@code{picture-yank-rectangle-from-register}) does
1890likewise for the rectangle found in a specified register. 1892likewise for the rectangle found in a specified register.
1891 1893
1894@node Advanced VC Usage
1895@chapter Advanced VC Usage
1896
1897 Commonly used features of Emacs' version control (VC) support are
1898described in the main Emacs manual (@pxref{Version Control,,,emacs,
1899the Emacs Manual}). This chapter describes more advanced VC usage.
1900
1901@menu
1902* VC Dired Mode:: Listing files managed by version control.
1903* VC Dired Commands:: Commands to use in a VC Dired buffer.
1904* Remote Repositories:: Efficient access to remote CVS servers.
1905* Snapshots:: Sets of file versions treated as a unit.
1906* Miscellaneous VC:: Various other commands and features of VC.
1907* Customizing VC:: Variables that change VC's behavior.
1908@end menu
1909
1910@node VC Dired Mode
1911@section Dired under VC
1912
1913@cindex PCL-CVS
1914@pindex cvs
1915@cindex CVS Dired Mode
1916 The VC Dired Mode described here works with all the version control
1917systems that VC supports. Another more powerful facility, designed
1918specifically for CVS, is called PCL-CVS. @xref{Top, , About PCL-CVS,
1919pcl-cvs, PCL-CVS --- The Emacs Front-End to CVS}.
1920
1921@kindex C-x v d
1922@findex vc-directory
1923 When you are working on a large program, it is often useful to find
1924out which files have changed within an entire directory tree, or to view
1925the status of all files under version control at once, and to perform
1926version control operations on collections of files. You can use the
1927command @kbd{C-x v d} (@code{vc-directory}) to make a directory listing
1928that includes only files relevant for version control.
1929
1930@vindex vc-dired-terse-display
1931 @kbd{C-x v d} creates a buffer which uses VC Dired Mode. This looks
1932much like an ordinary Dired buffer (@pxref{Dired,,,emacs, the
1933Emacs Manual}); however, normally it shows only the noteworthy files
1934(those locked or not up-to-date). This is called @dfn{terse display}.
1935If you set the variable @code{vc-dired-terse-display} to @code{nil},
1936then VC Dired shows all relevant files---those managed under version
1937control, plus all subdirectories (@dfn{full display}). The command
1938@kbd{v t} in a VC Dired buffer toggles between terse display and full
1939display (@pxref{VC Dired Commands}).
1940
1941@vindex vc-dired-recurse
1942 By default, VC Dired produces a recursive listing of noteworthy or
1943relevant files at or below the given directory. You can change this by
1944setting the variable @code{vc-dired-recurse} to @code{nil}; then VC
1945Dired shows only the files in the given directory.
1946
1947 The line for an individual file shows the version control state in the
1948place of the hard link count, owner, group, and size of the file. If
1949the file is unmodified, in sync with the master file, the version
1950control state shown is blank. Otherwise it consists of text in
1951parentheses. Under RCS and SCCS, the name of the user locking the file
1952is shown; under CVS, an abbreviated version of the @samp{cvs status}
1953output is used. Here is an example using RCS:
1954
1955@smallexample
1956@group
1957 /home/jim/project:
1958
1959 -rw-r--r-- (jim) Apr 2 23:39 file1
1960 -r--r--r-- Apr 5 20:21 file2
1961@end group
1962@end smallexample
1963
1964@noindent
1965The files @samp{file1} and @samp{file2} are under version control,
1966@samp{file1} is locked by user jim, and @samp{file2} is unlocked.
1967
1968 Here is an example using CVS:
1969
1970@smallexample
1971@group
1972 /home/joe/develop:
1973
1974 -rw-r--r-- (modified) Aug 2 1997 file1.c
1975 -rw-r--r-- Apr 4 20:09 file2.c
1976 -rw-r--r-- (merge) Sep 13 1996 file3.c
1977@end group
1978@end smallexample
1979
1980 Here @samp{file1.c} is modified with respect to the repository, and
1981@samp{file2.c} is not. @samp{file3.c} is modified, but other changes
1982have also been checked in to the repository---you need to merge them
1983with the work file before you can check it in.
1984
1985@vindex vc-stay-local
1986@vindex vc-cvs-stay-local
1987 In the above, if the repository were on a remote machine, VC would
1988only contact it when the variable @code{vc-stay-local} (or
1989@code{vc-cvs-stay-local}) is nil (@pxref{CVS Options}). This is
1990because access to the repository may be slow, or you may be working
1991offline and not have access to the repository at all. As a
1992consequence, VC would not be able to tell you that @samp{file3.c} is
1993in the ``merge'' state; you would learn that only when you try to
1994check-in your modified copy of the file, or use a command such as
1995@kbd{C-x v m}.
1996
1997 In practice, this is not a problem because CVS handles this case
1998consistently whenever it arises. In VC, you'll simply get prompted to
1999merge the remote changes into your work file first. The benefits of
2000less network communication usually outweigh the disadvantage of not
2001seeing remote changes immediately.
2002
2003@vindex vc-directory-exclusion-list
2004 When VC Dired displays subdirectories (in the ``full'' display mode),
2005it omits some that should never contain any files under version control.
2006By default, this includes Version Control subdirectories such as
2007@samp{RCS} and @samp{CVS}; you can customize this by setting the
2008variable @code{vc-directory-exclusion-list}.
2009
2010 You can fine-tune VC Dired's format by typing @kbd{C-u C-x v d}---as in
2011ordinary Dired, that allows you to specify additional switches for the
2012@samp{ls} command.
2013
2014@node VC Dired Commands
2015@section VC Dired Commands
2016
2017 All the usual Dired commands work normally in VC Dired mode, except
2018for @kbd{v}, which is redefined as the version control prefix. You can
2019invoke VC commands such as @code{vc-diff} and @code{vc-print-log} by
2020typing @kbd{v =}, or @kbd{v l}, and so on. Most of these commands apply
2021to the file name on the current line.
2022
2023 The command @kbd{v v} (@code{vc-next-action}) operates on all the
2024marked files, so that you can lock or check in several files at once.
2025If it operates on more than one file, it handles each file according to
2026its current state; thus, it might lock one file, but check in another
2027file. This could be confusing; it is up to you to avoid confusing
2028behavior by marking a set of files that are in a similar state. If no
2029files are marked, @kbd{v v} operates on the file in the current line.
2030
2031 If any files call for check-in, @kbd{v v} reads a single log entry,
2032then uses it for all the files being checked in. This is convenient for
2033registering or checking in several files at once, as part of the same
2034change.
2035
2036@findex vc-dired-toggle-terse-mode
2037@findex vc-dired-mark-locked
2038 You can toggle between terse display (only locked files, or files not
2039up-to-date) and full display at any time by typing @kbd{v t}
2040(@code{vc-dired-toggle-terse-mode}). There is also a special command
2041@kbd{* l} (@code{vc-dired-mark-locked}), which marks all files currently
2042locked (or, with CVS, all files not up-to-date). Thus, typing @kbd{* l
2043t k} is another way to delete from the buffer all files except those
2044currently locked.
2045
2046@node Remote Repositories
2047@section Remote Repositories
2048@cindex remote repositories (CVS)
2049
2050 A common way of using CVS is to set up a central CVS repository on
2051some Internet host, then have each developer check out a personal
2052working copy of the files on his local machine. Committing changes to
2053the repository, and picking up changes from other users into one's own
2054working area, then works by direct interactions with the CVS server.
2055
2056 One difficulty is that access to the CVS server is often slow, and
2057that developers might need to work off-line as well. VC is designed
2058to reduce the amount of network interaction necessary.
2059
2060@menu
2061* Version Backups:: Keeping local copies of repository versions.
2062* Local Version Control:: Using another version system for local editing.
2063@end menu
2064
2065@node Version Backups
2066@subsection Version Backups
2067@cindex version backups
2068
2069@cindex automatic version backups
2070 When VC sees that the CVS repository for a file is on a remote
2071machine, it automatically makes local backups of unmodified versions
2072of the file---@dfn{automatic version backups}. This means that you
2073can compare the file to the repository version (@kbd{C-x v =}), or
2074revert to that version (@kbd{C-x v u}), without any network
2075interactions.
2076
2077 The local copy of the unmodified file is called a @dfn{version
2078backup} to indicate that it corresponds exactly to a version that is
2079stored in the repository. Note that version backups are not the same
2080as ordinary Emacs backup files (@pxref{Backup,,,emacs, the Emacs
2081Manual}). But they follow a similar naming convention.
2082
2083 For a file that comes from a remote CVS repository, VC makes a
2084version backup whenever you save the first changes to the file, and
2085removes it after you have committed your modified version to the
2086repository. You can disable the making of automatic version backups by
2087setting @code{vc-cvs-stay-local} to @code{nil} (@pxref{CVS Options}).
2088
2089@cindex manual version backups
2090 The name of the automatic version backup for version @var{version}
2091of file @var{file} is @code{@var{file}.~@var{version}.~}. This is
2092almost the same as the name used by @kbd{C-x v ~} (@pxref{Old
2093Versions,,,emacs, the Emacs Manual}), the only difference being
2094the additional dot (@samp{.}) after the version number. This
2095similarity is intentional, because both kinds of files store the same
2096kind of information. The file made by @kbd{C-x v ~} acts as a
2097@dfn{manual version backup}.
2098
2099 All the VC commands that operate on old versions of a file can use
2100both kinds of version backups. For instance, @kbd{C-x v ~} uses
2101either an automatic or a manual version backup, if possible, to get
2102the contents of the version you request. Likewise, @kbd{C-x v =} and
2103@kbd{C-x v u} use either an automatic or a manual version backup, if
2104one of them exists, to get the contents of a version to compare or
2105revert to. If you changed a file outside of Emacs, so that no
2106automatic version backup was created for the previous text, you can
2107create a manual backup of that version using @kbd{C-x v ~}, and thus
2108obtain the benefit of the local copy for Emacs commands.
2109
2110 The only difference in Emacs's handling of manual and automatic
2111version backups, once they exist, is that Emacs deletes automatic
2112version backups when you commit to the repository. By contrast,
2113manual version backups remain until you delete them.
2114
2115@node Local Version Control
2116@subsection Local Version Control
2117@cindex local version control
2118@cindex local back end (version control)
2119
2120When you make many changes to a file that comes from a remote
2121repository, it can be convenient to have version control on your local
2122machine as well. You can then record intermediate versions, revert to
2123a previous state, etc., before you actually commit your changes to the
2124remote server.
2125
2126VC lets you do this by putting a file under a second, local version
2127control system, so that the file is effectively registered in two
2128systems at the same time. For the description here, we will assume
2129that the remote system is CVS, and you use RCS locally, although the
2130mechanism works with any combination of version control systems
2131(@dfn{back ends}).
2132
2133To make it work with other back ends, you must make sure that the
2134``more local'' back end comes before the ``more remote'' back end in
2135the setting of @code{vc-handled-backends} (@pxref{Customizing VC}). By
2136default, this variable is set up so that you can use remote CVS and
2137local RCS as described here.
2138
2139To start using local RCS for a file that comes from a remote CVS
2140server, you must @emph{register the file in RCS}, by typing @kbd{C-u
2141C-x v v rcs @key{RET}}. (In other words, use @code{vc-next-action} with a
2142prefix argument, and specify RCS as the back end.)
2143
2144You can do this at any time; it does not matter whether you have
2145already modified the file with respect to the version in the CVS
2146repository. If possible, VC tries to make the RCS master start with
2147the unmodified repository version, then checks in any local changes
2148as a new version. This works if you have not made any changes yet, or
2149if the unmodified repository version exists locally as a version
2150backup (@pxref{Version Backups}). If the unmodified version is not
2151available locally, the RCS master starts with the modified version;
2152the only drawback to this is that you cannot compare your changes
2153locally to what is stored in the repository.
2154
2155The version number of the RCS master is derived from the current CVS
2156version, starting a branch from it. For example, if the current CVS
2157version is 1.23, the local RCS branch will be 1.23.1. Version 1.23 in
2158the RCS master will be identical to version 1.23 under CVS; your first
2159changes are checked in as 1.23.1.1. (If the unmodified file is not
2160available locally, VC will check in the modified file twice, both as
21611.23 and 1.23.1.1, to make the revision numbers consistent.)
2162
2163If you do not use locking under CVS (the default), locking is also
2164disabled for RCS, so that editing under RCS works exactly as under
2165CVS.
2166
2167When you are done with local editing, you can commit the final version
2168back to the CVS repository by typing @kbd{C-u C-x v v cvs @key{RET}}.
2169This initializes the log entry buffer (@pxref{Log Buffer,,,emacs, the
2170Emacs Manual}) to contain all the log entries you have recorded in the
2171RCS master; you can edit them as you wish, and then commit in CVS by
2172typing @kbd{C-c C-c}. If the commit is successful, VC removes the RCS
2173master, so that the file is once again registered under CVS only.
2174(The RCS master is not actually deleted, just renamed by appending
2175@samp{~} to the name, so that you can refer to it later if you wish.)
2176
2177While using local RCS, you can pick up recent changes from the CVS
2178repository into your local file, or commit some of your changes back
2179to CVS, without terminating local RCS version control. To do this,
2180switch to the CVS back end temporarily, with the @kbd{C-x v b} command:
2181
2182@table @kbd
2183@item C-x v b
2184Switch to another back end that the current file is registered
2185under (@code{vc-switch-backend}).
2186
2187@item C-u C-x v b @var{backend} @key{RET}
2188Switch to @var{backend} for the current file.
2189@end table
2190
2191@kindex C-x v b
2192@findex vc-switch-backend
2193@kbd{C-x v b} does not change the buffer contents, or any files; it
2194only changes VC's perspective on how to handle the file. Any
2195subsequent VC commands for that file will operate on the back end that
2196is currently selected.
2197
2198If the current file is registered in more than one back end, typing
2199@kbd{C-x v b} ``cycles'' through all of these back ends. With a
2200prefix argument, it asks for the back end to use in the minibuffer.
2201
2202Thus, if you are using local RCS, and you want to pick up some recent
2203changes in the file from remote CVS, first visit the file, then type
2204@kbd{C-x v b} to switch to CVS, and finally use @kbd{C-x v m
2205@key{RET}} to merge the news (@pxref{Merging,,,emacs, the Emacs
2206Manual}). You can then switch back to RCS by typing @kbd{C-x v b}
2207again, and continue to edit locally.
2208
2209But if you do this, the revision numbers in the RCS master no longer
2210correspond to those of CVS. Technically, this is not a problem, but
2211it can become difficult to keep track of what is in the CVS repository
2212and what is not. So we suggest that you return from time to time to
2213CVS-only operation, by committing your local changes back to the
2214repository using @kbd{C-u C-x v v cvs @key{RET}}.
2215
2216@node Snapshots
2217@section Snapshots
2218@cindex snapshots and version control
2219
2220 A @dfn{snapshot} is a named set of file versions (one for each
2221registered file) that you can treat as a unit. One important kind of
2222snapshot is a @dfn{release}, a (theoretically) stable version of the
2223system that is ready for distribution to users.
2224
2225@menu
2226* Making Snapshots:: The snapshot facilities.
2227* Snapshot Caveats:: Things to be careful of when using snapshots.
2228@end menu
2229
2230@node Making Snapshots
2231@subsection Making and Using Snapshots
2232
2233 There are two basic commands for snapshots; one makes a
2234snapshot with a given name, the other retrieves a named snapshot.
2235
2236@table @code
2237@kindex C-x v s
2238@findex vc-create-snapshot
2239@item C-x v s @var{name} @key{RET}
2240Define the last saved versions of every registered file in or under the
2241current directory as a snapshot named @var{name}
2242(@code{vc-create-snapshot}).
2243
2244@kindex C-x v r
2245@findex vc-retrieve-snapshot
2246@item C-x v r @var{name} @key{RET}
2247For all registered files at or below the current directory level, select
2248whatever versions correspond to the snapshot @var{name}
2249(@code{vc-retrieve-snapshot}).
2250
2251This command reports an error if any files are locked at or below the
2252current directory, without changing anything; this is to avoid
2253overwriting work in progress.
2254@end table
2255
2256 A snapshot uses a very small amount of resources---just enough to record
2257the list of file names and which version belongs to the snapshot. Thus,
2258you need not hesitate to create snapshots whenever they are useful.
2259
2260 You can give a snapshot name as an argument to @kbd{C-x v =} or
2261@kbd{C-x v ~} (@pxref{Old Versions,,,emacs, the Emacs Manual}).
2262Thus, you can use it to compare a snapshot against the current files,
2263or two snapshots against each other, or a snapshot against a named
2264version.
2265
2266@node Snapshot Caveats
2267@subsection Snapshot Caveats
2268
2269@cindex named configurations (RCS)
2270 VC's snapshot facilities are modeled on RCS's named-configuration
2271support. They use RCS's native facilities for this, so
2272snapshots made using RCS through VC are visible even when you bypass VC.
2273
2274 With CVS, Meta-CVS, and Subversion, VC also uses the native
2275mechanism provided by that back end to make snapshots and retrieve them
2276(@dfn{tags} for CVS and Meta-CVS, @dfn{copies} for Subversion).
2277
2278@c worded verbosely to avoid overfull hbox.
2279 For SCCS, VC implements snapshots itself. The files it uses contain
2280name/file/version-number triples. These snapshots are visible only
2281through VC.
2282
2283 There is no support for VC snapshots using GNU Arch yet.
2284
2285 A snapshot is a set of checked-in versions. So make sure that all the
2286files are checked in and not locked when you make a snapshot.
2287
2288 File renaming and deletion can create some difficulties with snapshots.
2289This is not a VC-specific problem, but a general design issue in version
2290control systems that no one has solved very well yet.
2291
2292 If you rename a registered file, you need to rename its master along
2293with it (the command @code{vc-rename-file} does this automatically). If
2294you are using SCCS, you must also update the records of the snapshot, to
2295mention the file by its new name (@code{vc-rename-file} does this,
2296too). An old snapshot that refers to a master file that no longer
2297exists under the recorded name is invalid; VC can no longer retrieve
2298it. It would be beyond the scope of this manual to explain enough about
2299RCS and SCCS to explain how to update the snapshots by hand.
2300
2301 Using @code{vc-rename-file} makes the snapshot remain valid for
2302retrieval, but it does not solve all problems. For example, some of the
2303files in your program probably refer to others by name. At the very
2304least, the makefile probably mentions the file that you renamed. If you
2305retrieve an old snapshot, the renamed file is retrieved under its new
2306name, which is not the name that the makefile expects. So the program
2307won't really work as retrieved.
2308
2309@node Miscellaneous VC
2310@section Miscellaneous Commands and Features of VC
2311
2312 This section explains the less-frequently-used features of VC.
2313
2314@menu
2315* Change Logs and VC:: Generating a change log file from log entries.
2316* Renaming and VC:: A command to rename both the source and master
2317 file correctly.
2318* Version Headers:: Inserting version control headers into working files.
2319@end menu
2320
2321@node Change Logs and VC
2322@subsection Change Logs and VC
2323
2324 If you use RCS or CVS for a program and also maintain a change log
2325file for it (@pxref{Change Log,,,emacs, the Emacs Manual}), you
2326can generate change log entries automatically from the version control
2327log entries:
2328
2329@table @kbd
2330@item C-x v a
2331@kindex C-x v a
2332@findex vc-update-change-log
2333Visit the current directory's change log file and, for registered files
2334in that directory, create new entries for versions checked in since the
2335most recent entry in the change log file.
2336(@code{vc-update-change-log}).
2337
2338This command works with RCS or CVS only, not with any of the other
2339back ends.
2340
2341@item C-u C-x v a
2342As above, but only find entries for the current buffer's file.
2343
2344@item M-1 C-x v a
2345As above, but find entries for all the currently visited files that are
2346maintained with version control. This works only with RCS, and it puts
2347all entries in the log for the default directory, which may not be
2348appropriate.
2349@end table
2350
2351 For example, suppose the first line of @file{ChangeLog} is dated
23521999-04-10, and that the only check-in since then was by Nathaniel
2353Bowditch to @file{rcs2log} on 1999-05-22 with log text @samp{Ignore log
2354messages that start with `#'.}. Then @kbd{C-x v a} visits
2355@file{ChangeLog} and inserts text like this:
2356
2357@iftex
2358@medbreak
2359@end iftex
2360@smallexample
2361@group
23621999-05-22 Nathaniel Bowditch <nat@@apn.org>
2363
2364 * rcs2log: Ignore log messages that start with `#'.
2365@end group
2366@end smallexample
2367@iftex
2368@medbreak
2369@end iftex
2370
2371@noindent
2372You can then edit the new change log entry further as you wish.
2373
2374 Some of the new change log entries may duplicate what's already in
2375ChangeLog. You will have to remove these duplicates by hand.
2376
2377 Normally, the log entry for file @file{foo} is displayed as @samp{*
2378foo: @var{text of log entry}}. The @samp{:} after @file{foo} is omitted
2379if the text of the log entry starts with @w{@samp{(@var{functionname}):
2380}}. For example, if the log entry for @file{vc.el} is
2381@samp{(vc-do-command): Check call-process status.}, then the text in
2382@file{ChangeLog} looks like this:
2383
2384@iftex
2385@medbreak
2386@end iftex
2387@smallexample
2388@group
23891999-05-06 Nathaniel Bowditch <nat@@apn.org>
2390
2391 * vc.el (vc-do-command): Check call-process status.
2392@end group
2393@end smallexample
2394@iftex
2395@medbreak
2396@end iftex
2397
2398 When @kbd{C-x v a} adds several change log entries at once, it groups
2399related log entries together if they all are checked in by the same
2400author at nearly the same time. If the log entries for several such
2401files all have the same text, it coalesces them into a single entry.
2402For example, suppose the most recent check-ins have the following log
2403entries:
2404
2405@flushleft
2406@bullet{} For @file{vc.texinfo}: @samp{Fix expansion typos.}
2407@bullet{} For @file{vc.el}: @samp{Don't call expand-file-name.}
2408@bullet{} For @file{vc-hooks.el}: @samp{Don't call expand-file-name.}
2409@end flushleft
2410
2411@noindent
2412They appear like this in @file{ChangeLog}:
2413
2414@iftex
2415@medbreak
2416@end iftex
2417@smallexample
2418@group
24191999-04-01 Nathaniel Bowditch <nat@@apn.org>
2420
2421 * vc.texinfo: Fix expansion typos.
2422
2423 * vc.el, vc-hooks.el: Don't call expand-file-name.
2424@end group
2425@end smallexample
2426@iftex
2427@medbreak
2428@end iftex
2429
2430 Normally, @kbd{C-x v a} separates log entries by a blank line, but you
2431can mark several related log entries to be clumped together (without an
2432intervening blank line) by starting the text of each related log entry
2433with a label of the form @w{@samp{@{@var{clumpname}@} }}. The label
2434itself is not copied to @file{ChangeLog}. For example, suppose the log
2435entries are:
2436
2437@flushleft
2438@bullet{} For @file{vc.texinfo}: @samp{@{expand@} Fix expansion typos.}
2439@bullet{} For @file{vc.el}: @samp{@{expand@} Don't call expand-file-name.}
2440@bullet{} For @file{vc-hooks.el}: @samp{@{expand@} Don't call expand-file-name.}
2441@end flushleft
2442
2443@noindent
2444Then the text in @file{ChangeLog} looks like this:
2445
2446@iftex
2447@medbreak
2448@end iftex
2449@smallexample
2450@group
24511999-04-01 Nathaniel Bowditch <nat@@apn.org>
2452
2453 * vc.texinfo: Fix expansion typos.
2454 * vc.el, vc-hooks.el: Don't call expand-file-name.
2455@end group
2456@end smallexample
2457@iftex
2458@medbreak
2459@end iftex
2460
2461 A log entry whose text begins with @samp{#} is not copied to
2462@file{ChangeLog}. For example, if you merely fix some misspellings in
2463comments, you can log the change with an entry beginning with @samp{#}
2464to avoid putting such trivia into @file{ChangeLog}.
2465
2466@node Renaming and VC
2467@subsection Renaming VC Work Files and Master Files
2468
2469@findex vc-rename-file
2470 When you rename a registered file, you must also rename its master
2471file correspondingly to get proper results. Use @code{vc-rename-file}
2472to rename the source file as you specify, and rename its master file
2473accordingly. It also updates any snapshots (@pxref{Snapshots}) that
2474mention the file, so that they use the new name; despite this, the
2475snapshot thus modified may not completely work (@pxref{Snapshot
2476Caveats}).
2477
2478 Some back ends do not provide an explicit rename operation to their
2479repositories. After issuing @code{vc-rename-file}, use @kbd{C-x v v}
2480on the original and renamed buffers and provide the necessary edit
2481log.
2482
2483 You cannot use @code{vc-rename-file} on a file that is locked by
2484someone else.
2485
2486@node Version Headers
2487@subsection Inserting Version Control Headers
2488
2489 Sometimes it is convenient to put version identification strings
2490directly into working files. Certain special strings called
2491@dfn{version headers} are replaced in each successive version by the
2492number of that version, the name of the user who created it, and other
2493relevant information. All of the back ends that VC supports have such
2494a mechanism, except GNU Arch.
2495
2496 VC does not normally use the information contained in these headers.
2497The exception is RCS---with RCS, version headers are sometimes more
2498reliable than the master file to determine which version of the file
2499you are editing. Note that in a multi-branch environment, version
2500headers are necessary to make VC behave correctly (@pxref{Multi-User
2501Branching,,,emacs, the Emacs Manual}).
2502
2503 Searching for RCS version headers is controlled by the variable
2504@code{vc-consult-headers}. If it is non-@code{nil} (the default),
2505Emacs searches for headers to determine the version number you are
2506editing. Setting it to @code{nil} disables this feature.
2507
2508 Note that although CVS uses the same kind of version headers as RCS
2509does, VC never searches for these headers if you are using CVS,
2510regardless of the above setting.
2511
2512@kindex C-x v h
2513@findex vc-insert-headers
2514 You can use the @kbd{C-x v h} command (@code{vc-insert-headers}) to
2515insert a suitable header string.
2516
2517@table @kbd
2518@item C-x v h
2519Insert headers in a file for use with your version-control system.
2520@end table
2521
2522@vindex vc-@var{backend}-header
2523 The default header string is @samp{@w{$}Id$} for RCS and
2524@samp{@w{%}W%} for SCCS. You can specify other headers to insert by
2525setting the variables @code{vc-@var{backend}-header} where
2526@var{backend} is @code{rcs} or @code{sccs}.
2527
2528 Instead of a single string, you can specify a list of strings; then
2529each string in the list is inserted as a separate header on a line of
2530its own.
2531
2532 It may be necessary to use apparently-superfluous backslashes when
2533writing the strings that you put in this variable. For instance, you
2534might write @code{"$Id\$"} rather than @code{"$Id@w{$}"}. The extra
2535backslash prevents the string constant from being interpreted as a
2536header, if the Emacs Lisp file containing it is maintained with
2537version control.
2538
2539@vindex vc-comment-alist
2540 Each header is inserted surrounded by tabs, inside comment delimiters,
2541on a new line at point. Normally the ordinary comment
2542start and comment end strings of the current mode are used, but for
2543certain modes, there are special comment delimiters for this purpose;
2544the variable @code{vc-comment-alist} specifies them. Each element of
2545this list has the form @code{(@var{mode} @var{starter} @var{ender})}.
2546
2547@vindex vc-static-header-alist
2548 The variable @code{vc-static-header-alist} specifies further strings
2549to add based on the name of the buffer. Its value should be a list of
2550elements of the form @code{(@var{regexp} . @var{format})}. Whenever
2551@var{regexp} matches the buffer name, @var{format} is inserted as part
2552of the header. A header line is inserted for each element that matches
2553the buffer name, and for each string specified by
2554@code{vc-@var{backend}-header}. The header line is made by processing the
2555string from @code{vc-@var{backend}-header} with the format taken from the
2556element. The default value for @code{vc-static-header-alist} is as follows:
2557
2558@example
2559@group
2560(("\\.c$" .
2561 "\n#ifndef lint\nstatic char vcid[] = \"\%s\";\n\
2562#endif /* lint */\n"))
2563@end group
2564@end example
2565
2566@noindent
2567It specifies insertion of text of this form:
2568
2569@example
2570@group
2571
2572#ifndef lint
2573static char vcid[] = "@var{string}";
2574#endif /* lint */
2575@end group
2576@end example
2577
2578@noindent
2579Note that the text above starts with a blank line.
2580
2581 If you use more than one version header in a file, put them close
2582together in the file. The mechanism in @code{revert-buffer} that
2583preserves markers may not handle markers positioned between two version
2584headers.
2585
2586@node Customizing VC
2587@section Customizing VC
2588
2589@vindex vc-handled-backends
2590The variable @code{vc-handled-backends} determines which version
2591control systems VC should handle. The default value is @code{(RCS CVS
2592SVN SCCS Arch MCVS)}, so it contains all six version systems that are
2593currently supported. If you want VC to ignore one or more of these
2594systems, exclude its name from the list. To disable VC entirely, set
2595this variable to @code{nil}.
2596
2597The order of systems in the list is significant: when you visit a file
2598registered in more than one system (@pxref{Local Version Control}), VC
2599uses the system that comes first in @code{vc-handled-backends} by
2600default. The order is also significant when you register a file for
2601the first time, @pxref{Registering,,,emacs, the Emacs Manual} for
2602details.
2603
2604@menu
2605* General VC Options:: Options that apply to multiple back ends.
2606* RCS and SCCS:: Options for RCS and SCCS.
2607* CVS Options:: Options for CVS.
2608@end menu
2609
2610@node General VC Options
2611@subsection General Options
2612
2613@vindex vc-make-backup-files
2614 Emacs normally does not save backup files for source files that are
2615maintained with version control. If you want to make backup files even
2616for files that use version control, set the variable
2617@code{vc-make-backup-files} to a non-@code{nil} value.
2618
2619@vindex vc-keep-workfiles
2620 Normally the work file exists all the time, whether it is locked or
2621not. If you set @code{vc-keep-workfiles} to @code{nil}, then checking
2622in a new version with @kbd{C-x v v} deletes the work file; but any
2623attempt to visit the file with Emacs creates it again. (With CVS, work
2624files are always kept.)
2625
2626@vindex vc-follow-symlinks
2627 Editing a version-controlled file through a symbolic link can be
2628dangerous. It bypasses the version control system---you can edit the
2629file without locking it, and fail to check your changes in. Also,
2630your changes might overwrite those of another user. To protect against
2631this, VC checks each symbolic link that you visit, to see if it points
2632to a file under version control.
2633
2634 The variable @code{vc-follow-symlinks} controls what to do when a
2635symbolic link points to a version-controlled file. If it is @code{nil},
2636VC only displays a warning message. If it is @code{t}, VC automatically
2637follows the link, and visits the real file instead, telling you about
2638this in the echo area. If the value is @code{ask} (the default), VC
2639asks you each time whether to follow the link.
2640
2641@vindex vc-suppress-confirm
2642 If @code{vc-suppress-confirm} is non-@code{nil}, then @kbd{C-x v v}
2643and @kbd{C-x v i} can save the current buffer without asking, and
2644@kbd{C-x v u} also operates without asking for confirmation. (This
2645variable does not affect @kbd{C-x v c}; that operation is so drastic
2646that it should always ask for confirmation.)
2647
2648@vindex vc-command-messages
2649 VC mode does much of its work by running the shell commands for RCS,
2650CVS and SCCS. If @code{vc-command-messages} is non-@code{nil}, VC
2651displays messages to indicate which shell commands it runs, and
2652additional messages when the commands finish.
2653
2654@vindex vc-path
2655 You can specify additional directories to search for version control
2656programs by setting the variable @code{vc-path}. These directories
2657are searched before the usual search path. It is rarely necessary to
2658set this variable, because VC normally finds the proper files
2659automatically.
2660
2661@node RCS and SCCS
2662@subsection Options for RCS and SCCS
2663
2664@cindex non-strict locking (RCS)
2665@cindex locking, non-strict (RCS)
2666 By default, RCS uses locking to coordinate the activities of several
2667users, but there is a mode called @dfn{non-strict locking} in which
2668you can check-in changes without locking the file first. Use
2669@samp{rcs -U} to switch to non-strict locking for a particular file,
2670see the @code{rcs} manual page for details.
2671
2672 When deducing the version control state of an RCS file, VC first
2673looks for an RCS version header string in the file (@pxref{Version
2674Headers}). If there is no header string, VC normally looks at the
2675file permissions of the work file; this is fast. But there might be
2676situations when the file permissions cannot be trusted. In this case
2677the master file has to be consulted, which is rather expensive. Also
2678the master file can only tell you @emph{if} there's any lock on the
2679file, but not whether your work file really contains that locked
2680version.
2681
2682@vindex vc-consult-headers
2683 You can tell VC not to use version headers to determine the file
2684status by setting @code{vc-consult-headers} to @code{nil}. VC then
2685always uses the file permissions (if it is supposed to trust them), or
2686else checks the master file.
2687
2688@vindex vc-mistrust-permissions
2689 You can specify the criterion for whether to trust the file
2690permissions by setting the variable @code{vc-mistrust-permissions}.
2691Its value can be @code{t} (always mistrust the file permissions and
2692check the master file), @code{nil} (always trust the file
2693permissions), or a function of one argument which makes the decision.
2694The argument is the directory name of the @file{RCS} subdirectory. A
2695non-@code{nil} value from the function says to mistrust the file
2696permissions. If you find that the file permissions of work files are
2697changed erroneously, set @code{vc-mistrust-permissions} to @code{t}.
2698Then VC always checks the master file to determine the file's status.
2699
2700 VC determines the version control state of files under SCCS much as
2701with RCS. It does not consider SCCS version headers, though. Thus,
2702the variable @code{vc-mistrust-permissions} affects SCCS use, but
2703@code{vc-consult-headers} does not.
2704
2705@node CVS Options
2706@subsection Options specific for CVS
2707
2708@cindex locking (CVS)
2709 By default, CVS does not use locking to coordinate the activities of
2710several users; anyone can change a work file at any time. However,
2711there are ways to restrict this, resulting in behavior that resembles
2712locking.
2713
2714@cindex CVSREAD environment variable (CVS)
2715 For one thing, you can set the @env{CVSREAD} environment variable
2716(the value you use makes no difference). If this variable is defined,
2717CVS makes your work files read-only by default. In Emacs, you must
2718type @kbd{C-x v v} to make the file writable, so that editing works
2719in fact similar as if locking was used. Note however, that no actual
2720locking is performed, so several users can make their files writable
2721at the same time. When setting @env{CVSREAD} for the first time, make
2722sure to check out all your modules anew, so that the file protections
2723are set correctly.
2724
2725@cindex cvs watch feature
2726@cindex watching files (CVS)
2727 Another way to achieve something similar to locking is to use the
2728@dfn{watch} feature of CVS. If a file is being watched, CVS makes it
2729read-only by default, and you must also use @kbd{C-x v v} in Emacs to
2730make it writable. VC calls @code{cvs edit} to make the file writable,
2731and CVS takes care to notify other developers of the fact that you
2732intend to change the file. See the CVS documentation for details on
2733using the watch feature.
2734
2735@vindex vc-stay-local
2736@vindex vc-cvs-stay-local
2737@cindex remote repositories (CVS)
2738 When a file's repository is on a remote machine, VC tries to keep
2739network interactions to a minimum. This is controlled by the variable
2740@code{vc-cvs-stay-local}. There is another variable,
2741@code{vc-stay-local}, which enables the feature also for other back
2742ends that support it, including CVS. In the following, we will talk
2743only about @code{vc-cvs-stay-local}, but everything applies to
2744@code{vc-stay-local} as well.
2745
2746If @code{vc-cvs-stay-local} is @code{t} (the default), then VC uses
2747only the entry in the local CVS subdirectory to determine the file's
2748state (and possibly information returned by previous CVS commands).
2749One consequence of this is that when you have modified a file, and
2750somebody else has already checked in other changes to the file, you
2751are not notified of it until you actually try to commit. (But you can
2752try to pick up any recent changes from the repository first, using
2753@kbd{C-x v m @key{RET}}, @pxref{Merging,,,emacs, the Emacs Manual}).
2754
2755 When @code{vc-cvs-stay-local} is @code{t}, VC also makes local
2756version backups, so that simple diff and revert operations are
2757completely local (@pxref{Version Backups}).
2758
2759 On the other hand, if you set @code{vc-cvs-stay-local} to @code{nil},
2760then VC queries the remote repository @emph{before} it decides what to
2761do in @code{vc-next-action} (@kbd{C-x v v}), just as it does for local
2762repositories. It also does not make any version backups.
2763
2764 You can also set @code{vc-cvs-stay-local} to a regular expression
2765that is matched against the repository host name; VC then stays local
2766only for repositories from hosts that match the pattern.
2767
2768@vindex vc-cvs-global-switches
2769 You can specify additional command line options to pass to all CVS
2770operations in the variable @code{vc-cvs-global-switches}. These
2771switches are inserted immediately after the @code{cvs} command, before
2772the name of the operation to invoke.
2773
2774
1892@node Fortran 2775@node Fortran
1893@chapter Fortran Mode 2776@chapter Fortran Mode
1894@cindex Fortran mode 2777@cindex Fortran mode
diff --git a/man/emacs.texi b/man/emacs.texi
index dd020b1cb2b..662d591a28e 100644
--- a/man/emacs.texi
+++ b/man/emacs.texi
@@ -399,10 +399,6 @@ Version Control
399* Old Versions:: Examining and comparing old versions. 399* Old Versions:: Examining and comparing old versions.
400* Secondary VC Commands:: The commands used a little less frequently. 400* Secondary VC Commands:: The commands used a little less frequently.
401* Branches:: Multiple lines of development. 401* Branches:: Multiple lines of development.
402* Remote Repositories:: Efficient access to remote CVS servers.
403* Snapshots:: Sets of file versions treated as a unit.
404* Miscellaneous VC:: Various other commands and features of VC.
405* Customizing VC:: Variables that change VC's behavior.
406 402
407Using Multiple Buffers 403Using Multiple Buffers
408 404
diff --git a/man/files.texi b/man/files.texi
index 8ed89ac75e1..ab3fe7bb583 100644
--- a/man/files.texi
+++ b/man/files.texi
@@ -517,7 +517,8 @@ value is @code{t}, so that Emacs does write backup files.
517Control}), the variable @code{vc-make-backup-files} determines whether 517Control}), the variable @code{vc-make-backup-files} determines whether
518to make backup files. By default it is @code{nil}, since backup files 518to make backup files. By default it is @code{nil}, since backup files
519are redundant when you store all the previous versions in a version 519are redundant when you store all the previous versions in a version
520control system. @xref{General VC Options}. 520control system. @xref{General VC Options,,,emacs-xtra, Specialized
521Emacs Features}.
521 522
522 At your option, Emacs can keep either a single backup for each file, 523 At your option, Emacs can keep either a single backup for each file,
523or make a series of numbered backup files for each file that you edit. 524or make a series of numbered backup files for each file that you edit.
@@ -1200,7 +1201,7 @@ RCS or CVS, you can switch to CSSC.
1200 1201
1201 VC is enabled by default in Emacs. To disable it, set the 1202 VC is enabled by default in Emacs. To disable it, set the
1202customizable variable @code{vc-handled-backends} to @code{nil} 1203customizable variable @code{vc-handled-backends} to @code{nil}
1203(@pxref{Customizing VC}). 1204(@pxref{Customizing VC,,,emacs-xtra, Specialized Emacs Features}).
1204 1205
1205@menu 1206@menu
1206* Introduction to VC:: How version control works in general. 1207* Introduction to VC:: How version control works in general.
@@ -1209,10 +1210,6 @@ customizable variable @code{vc-handled-backends} to @code{nil}
1209* Old Versions:: Examining and comparing old versions. 1210* Old Versions:: Examining and comparing old versions.
1210* Secondary VC Commands:: The commands used a little less frequently. 1211* Secondary VC Commands:: The commands used a little less frequently.
1211* Branches:: Multiple lines of development. 1212* Branches:: Multiple lines of development.
1212* Remote Repositories:: Efficient access to remote CVS servers.
1213* Snapshots:: Sets of file versions treated as a unit.
1214* Miscellaneous VC:: Various other commands and features of VC.
1215* Customizing VC:: Variables that change VC's behavior.
1216@end menu 1213@end menu
1217 1214
1218@node Introduction to VC 1215@node Introduction to VC
@@ -1350,7 +1347,7 @@ permitted; check-in is still the way to record a new version.
1350 CVS normally allows each user to modify his own copy of the work file 1347 CVS normally allows each user to modify his own copy of the work file
1351at any time, but requires merging with changes from other users at 1348at any time, but requires merging with changes from other users at
1352check-in time. However, CVS can also be set up to require locking. 1349check-in time. However, CVS can also be set up to require locking.
1353(@pxref{CVS Options}). 1350(@pxref{CVS Options,,,emacs-xtra, Specialized Emacs Features}).
1354 1351
1355@node Types of Log File 1352@node Types of Log File
1356@subsubsection Types of Log File 1353@subsubsection Types of Log File
@@ -1382,7 +1379,8 @@ for each change just once, then put it into both logs. You can write
1382the entry in @file{ChangeLog}, then copy it to the log buffer when you 1379the entry in @file{ChangeLog}, then copy it to the log buffer when you
1383check in the change. Or you can write the entry in the log buffer 1380check in the change. Or you can write the entry in the log buffer
1384while checking in the change, and later use the @kbd{C-x v a} command 1381while checking in the change, and later use the @kbd{C-x v a} command
1385to copy it to @file{ChangeLog} (@pxref{Change Logs and VC}). 1382to copy it to @file{ChangeLog} (@pxref{Change Logs and
1383VC,,,emacs-xtra, Specialized Emacs Features}).
1386 1384
1387@node VC Mode Line 1385@node VC Mode Line
1388@subsection Version Control and the Mode Line 1386@subsection Version Control and the Mode Line
@@ -1547,7 +1545,7 @@ the repository.
1547Instead of the version number, you can also specify the name of a 1545Instead of the version number, you can also specify the name of a
1548version control system. This is useful when one file is being managed 1546version control system. This is useful when one file is being managed
1549with two version control systems at the same time (@pxref{Local 1547with two version control systems at the same time (@pxref{Local
1550Version Control}). 1548Version Control,,,emacs-xtra, Specialized Emacs Features}).
1551@end itemize 1549@end itemize
1552 1550
1553@node Log Buffer 1551@node Log Buffer
@@ -1569,14 +1567,16 @@ control, you can generate the Log Edit text from the ChangeLog using
1569entries for the file(s) concerned in the top entry in the ChangeLog 1567entries for the file(s) concerned in the top entry in the ChangeLog
1570and uses those paragraphs as the log text. This text is only inserted 1568and uses those paragraphs as the log text. This text is only inserted
1571if the top entry was made under your user name on the current date. 1569if the top entry was made under your user name on the current date.
1572@xref{Change Logs and VC}, for the opposite way of 1570@xref{Change Logs and VC,,,emacs-xtra, Specialized Emacs Features},
1573working---generating ChangeLog entries from the revision control log. 1571for the opposite way of working---generating ChangeLog entries from
1572the revision control log.
1574 1573
1575 In the @samp{*VC-Log*} buffer, @kbd{C-c C-f} (@kbd{M-x log-edit-show-files}) 1574 In the @samp{*VC-Log*} buffer, @kbd{C-c C-f} (@kbd{M-x
1576shows the list of files to be committed in case you need to check 1575log-edit-show-files}) shows the list of files to be committed in case
1577that. (This can be a list of more than one file if you use VC Dired 1576you need to check that. (This can be a list of more than one file if
1578mode or PCL-CVS. @xref{VC Dired Mode}, and @ref{Top, , About PCL-CVS, 1577you use VC Dired mode or PCL-CVS. @xref{VC Dired Mode,,,emacs-xtra,
1579pcl-cvs, PCL-CVS --- The Emacs Front-End to CVS}.) 1578Specialized Emacs Features}, and @ref{Top, , About PCL-CVS, pcl-cvs,
1579PCL-CVS --- The Emacs Front-End to CVS}.)
1580 1580
1581 When you have finished editing the log message, type @kbd{C-c C-c} to 1581 When you have finished editing the log message, type @kbd{C-c C-c} to
1582exit the buffer and commit the change. 1582exit the buffer and commit the change.
@@ -1644,7 +1644,7 @@ Both forms display the output in a special buffer in another window.
1644 You can specify a checked-in version by its number; an empty input 1644 You can specify a checked-in version by its number; an empty input
1645specifies the current contents of the work file (which may be different 1645specifies the current contents of the work file (which may be different
1646from all the checked-in versions). You can also specify a snapshot name 1646from all the checked-in versions). You can also specify a snapshot name
1647(@pxref{Snapshots}) instead of one or both version numbers. 1647(@pxref{Snapshots,,,emacs-xtra, Specialized Emacs Features}) instead of one or both version numbers.
1648 1648
1649 If you supply a directory name instead of the name of a registered 1649 If you supply a directory name instead of the name of a registered
1650file, this command compares the two specified versions of all registered 1650file, this command compares the two specified versions of all registered
@@ -1672,23 +1672,22 @@ versions are not, in general, present as files on your disk.)
1672@kindex C-x v g 1672@kindex C-x v g
1673 For some back ends, you can display the file @dfn{annotated} with 1673 For some back ends, you can display the file @dfn{annotated} with
1674per-line version information and using colors to enhance the visual 1674per-line version information and using colors to enhance the visual
1675appearance, with the command @kbd{M-x vc-annotate}. 1675appearance, with the command @kbd{M-x vc-annotate}. It creates a new
1676It creates a new buffer (the ``annotate buffer'') displaying the 1676buffer (the ``annotate buffer'') displaying the file's text, with each
1677file's text, with each part colored to show how old it is. Text 1677part colored to show how old it is. Text colored red is new, blue means
1678colored red is new, blue means old, and intermediate colors indicate 1678old, and intermediate colors indicate intermediate ages. By default,
1679intermediate ages. By default, the time scale is 360 days, so that 1679the color is scaled over the full range of ages, such that the oldest
1680everything more than one year old is shown in blue. 1680changes are blue, and the newest changes are red.
1681 1681
1682 When you give a prefix argument to this command, it uses the 1682 When you give a prefix argument to this command, it uses the
1683minibuffer to read two arguments: which version number to display and 1683minibuffer to read two arguments: which version number to display and
1684annotate (instead of the current file contents), and a stretch factor 1684annotate (instead of the current file contents), and the time span in
1685for the time scale. A stretch factor of 0.1 means that the color 1685days the color range should cover.
1686range from red to blue spans the past 36 days instead of 360 days. A
1687stretch factor greater than 1 means the color range spans more than a
1688year.
1689 1686
1690 From the annotate buffer, you can use the following keys to browse the 1687 From the annotate buffer, these and other color scaling options are
1691annotations of past revisions, view diffs, or view log entries: 1688available from the @samp{VC-Annotate} menu. In this buffer, you can
1689also use the following keys to browse the annotations of past revisions,
1690view diffs, or view log entries:
1692 1691
1693@table @kbd 1692@table @kbd
1694@item P 1693@item P
@@ -1734,8 +1733,6 @@ use once a day.
1734* Registering:: Putting a file under version control. 1733* Registering:: Putting a file under version control.
1735* VC Status:: Viewing the VC status of files. 1734* VC Status:: Viewing the VC status of files.
1736* VC Undo:: Canceling changes before or after check-in. 1735* VC Undo:: Canceling changes before or after check-in.
1737* VC Dired Mode:: Listing files managed by version control.
1738* VC Dired Commands:: Commands to use in a VC Dired buffer.
1739@end menu 1736@end menu
1740 1737
1741@node Registering 1738@node Registering
@@ -1754,14 +1751,15 @@ Register the visited file for version control.
1754 To register the file, Emacs must choose which version control system 1751 To register the file, Emacs must choose which version control system
1755to use for it. If the file's directory already contains files 1752to use for it. If the file's directory already contains files
1756registered in a version control system, Emacs uses that system. If 1753registered in a version control system, Emacs uses that system. If
1757there is more than one system in use for a directory, Emacs uses the one 1754there is more than one system in use for a directory, Emacs uses the
1758that appears first in @code{vc-handled-backends} (@pxref{Customizing VC}). 1755one that appears first in @code{vc-handled-backends}
1759On the other hand, if there are no files already registered, 1756(@pxref{Customizing VC,,,emacs-xtra, Specialized Emacs Features}). On
1760Emacs uses the first system from @code{vc-handled-backends} that could 1757the other hand, if there are no files already registered, Emacs uses
1761register the file (for example, you cannot register a file under CVS if 1758the first system from @code{vc-handled-backends} that could register
1762its directory is not already part of a CVS tree); with the default 1759the file (for example, you cannot register a file under CVS if its
1763value of @code{vc-handled-backends}, this means that Emacs uses RCS in 1760directory is not already part of a CVS tree); with the default value
1764this situation. 1761of @code{vc-handled-backends}, this means that Emacs uses RCS in this
1762situation.
1765 1763
1766 If locking is in use, @kbd{C-x v i} leaves the file unlocked and 1764 If locking is in use, @kbd{C-x v i} leaves the file unlocked and
1767read-only. Type @kbd{C-x v v} if you wish to start editing it. After 1765read-only. Type @kbd{C-x v v} if you wish to start editing it. After
@@ -1816,14 +1814,16 @@ count.
1816 1814
1817@item P 1815@item P
1818Move to the log of the previous file, when the logs of multiple files 1816Move to the log of the previous file, when the logs of multiple files
1819are in the log buffer (@pxref{VC Dired Mode}). Otherwise, just move 1817are in the log buffer (@pxref{VC Dired Mode,,,emacs-xtra, Specialized
1820to the beginning of the log. A numeric prefix argument is a repeat 1818Emacs Features}). Otherwise, just move to the beginning of the log. A
1821count, so @kbd{C-u 10 P} would move backward 10 files. 1819numeric prefix argument is a repeat count, so @kbd{C-u 10 P} would
1820move backward 10 files.
1822 1821
1823@item N 1822@item N
1824Move to the log of the next file, when the logs of multiple files are 1823Move to the log of the next file, when the logs of multiple files are
1825in the log buffer (@pxref{VC Dired Mode}). It also takes a numeric 1824in the log buffer (@pxref{VC Dired Mode,,,emacs-xtra, Specialized
1826prefix argument as a repeat count. 1825Emacs Features}). It also takes a numeric prefix argument as a repeat
1826count.
1827 1827
1828@item f 1828@item f
1829Visit the revision indicated at the current line, like typing @kbd{C-x 1829Visit the revision indicated at the current line, like typing @kbd{C-x
@@ -1877,10 +1877,11 @@ change and then discover a trivial error in it; you can cancel the
1877erroneous check-in, fix the error, and check the file in again. 1877erroneous check-in, fix the error, and check the file in again.
1878 1878
1879 When @kbd{C-x v c} does not revert the buffer, it unexpands all 1879 When @kbd{C-x v c} does not revert the buffer, it unexpands all
1880version control headers in the buffer instead (@pxref{Version Headers}). 1880version control headers in the buffer instead (@pxref{Version
1881This is because the buffer no longer corresponds to any existing 1881Headers,,,emacs-xtra, Specialized Emacs Features}). This is because
1882version. If you check it in again, the check-in process will expand the 1882the buffer no longer corresponds to any existing version. If you
1883headers properly for the new version number. 1883check it in again, the check-in process will expand the headers
1884properly for the new version number.
1884 1885
1885 However, it is impossible to unexpand the RCS @samp{@w{$}Log$} header 1886 However, it is impossible to unexpand the RCS @samp{@w{$}Log$} header
1886automatically. If you use that header feature, you have to unexpand it 1887automatically. If you use that header feature, you have to unexpand it
@@ -1892,142 +1893,6 @@ confirmation with @kbd{yes}. Note also that this command is disabled
1892under CVS, because canceling versions is very dangerous and discouraged 1893under CVS, because canceling versions is very dangerous and discouraged
1893with CVS. 1894with CVS.
1894 1895
1895@node VC Dired Mode
1896@subsubsection Dired under VC
1897
1898@cindex PCL-CVS
1899@pindex cvs
1900@cindex CVS Dired Mode
1901 The VC Dired Mode described here works with all the version control
1902systems that VC supports. Another more powerful facility, designed
1903specifically for CVS, is called PCL-CVS. @xref{Top, , About PCL-CVS,
1904pcl-cvs, PCL-CVS --- The Emacs Front-End to CVS}.
1905
1906@kindex C-x v d
1907@findex vc-directory
1908 When you are working on a large program, it is often useful to find
1909out which files have changed within an entire directory tree, or to view
1910the status of all files under version control at once, and to perform
1911version control operations on collections of files. You can use the
1912command @kbd{C-x v d} (@code{vc-directory}) to make a directory listing
1913that includes only files relevant for version control.
1914
1915@vindex vc-dired-terse-display
1916 @kbd{C-x v d} creates a buffer which uses VC Dired Mode. This looks
1917much like an ordinary Dired buffer (@pxref{Dired}); however, normally it
1918shows only the noteworthy files (those locked or not up-to-date). This
1919is called @dfn{terse display}. If you set the variable
1920@code{vc-dired-terse-display} to @code{nil}, then VC Dired shows all
1921relevant files---those managed under version control, plus all
1922subdirectories (@dfn{full display}). The command @kbd{v t} in a VC
1923Dired buffer toggles between terse display and full display (@pxref{VC
1924Dired Commands}).
1925
1926@vindex vc-dired-recurse
1927 By default, VC Dired produces a recursive listing of noteworthy or
1928relevant files at or below the given directory. You can change this by
1929setting the variable @code{vc-dired-recurse} to @code{nil}; then VC
1930Dired shows only the files in the given directory.
1931
1932 The line for an individual file shows the version control state in the
1933place of the hard link count, owner, group, and size of the file. If
1934the file is unmodified, in sync with the master file, the version
1935control state shown is blank. Otherwise it consists of text in
1936parentheses. Under RCS and SCCS, the name of the user locking the file
1937is shown; under CVS, an abbreviated version of the @samp{cvs status}
1938output is used. Here is an example using RCS:
1939
1940@smallexample
1941@group
1942 /home/jim/project:
1943
1944 -rw-r--r-- (jim) Apr 2 23:39 file1
1945 -r--r--r-- Apr 5 20:21 file2
1946@end group
1947@end smallexample
1948
1949@noindent
1950The files @samp{file1} and @samp{file2} are under version control,
1951@samp{file1} is locked by user jim, and @samp{file2} is unlocked.
1952
1953 Here is an example using CVS:
1954
1955@smallexample
1956@group
1957 /home/joe/develop:
1958
1959 -rw-r--r-- (modified) Aug 2 1997 file1.c
1960 -rw-r--r-- Apr 4 20:09 file2.c
1961 -rw-r--r-- (merge) Sep 13 1996 file3.c
1962@end group
1963@end smallexample
1964
1965 Here @samp{file1.c} is modified with respect to the repository, and
1966@samp{file2.c} is not. @samp{file3.c} is modified, but other changes
1967have also been checked in to the repository---you need to merge them
1968with the work file before you can check it in.
1969
1970@vindex vc-stay-local
1971@vindex vc-cvs-stay-local
1972 In the above, if the repository were on a remote machine, VC would
1973only contact it when the variable @code{vc-stay-local} (or
1974@code{vc-cvs-stay-local}) is nil (@pxref{CVS Options}). This is
1975because access to the repository may be slow, or you may be working
1976offline and not have access to the repository at all. As a
1977consequence, VC would not be able to tell you that @samp{file3.c} is
1978in the ``merge'' state; you would learn that only when you try to
1979check-in your modified copy of the file, or use a command such as
1980@kbd{C-x v m}.
1981
1982 In practice, this is not a problem because CVS handles this case
1983consistently whenever it arises. In VC, you'll simply get prompted to
1984merge the remote changes into your work file first. The benefits of
1985less network communication usually outweigh the disadvantage of not
1986seeing remote changes immediately.
1987
1988@vindex vc-directory-exclusion-list
1989 When VC Dired displays subdirectories (in the ``full'' display mode),
1990it omits some that should never contain any files under version control.
1991By default, this includes Version Control subdirectories such as
1992@samp{RCS} and @samp{CVS}; you can customize this by setting the
1993variable @code{vc-directory-exclusion-list}.
1994
1995 You can fine-tune VC Dired's format by typing @kbd{C-u C-x v d}---as in
1996ordinary Dired, that allows you to specify additional switches for the
1997@samp{ls} command.
1998
1999@node VC Dired Commands
2000@subsubsection VC Dired Commands
2001
2002 All the usual Dired commands work normally in VC Dired mode, except
2003for @kbd{v}, which is redefined as the version control prefix. You can
2004invoke VC commands such as @code{vc-diff} and @code{vc-print-log} by
2005typing @kbd{v =}, or @kbd{v l}, and so on. Most of these commands apply
2006to the file name on the current line.
2007
2008 The command @kbd{v v} (@code{vc-next-action}) operates on all the
2009marked files, so that you can lock or check in several files at once.
2010If it operates on more than one file, it handles each file according to
2011its current state; thus, it might lock one file, but check in another
2012file. This could be confusing; it is up to you to avoid confusing
2013behavior by marking a set of files that are in a similar state. If no
2014files are marked, @kbd{v v} operates on the file in the current line.
2015
2016 If any files call for check-in, @kbd{v v} reads a single log entry,
2017then uses it for all the files being checked in. This is convenient for
2018registering or checking in several files at once, as part of the same
2019change.
2020
2021@findex vc-dired-toggle-terse-mode
2022@findex vc-dired-mark-locked
2023 You can toggle between terse display (only locked files, or files not
2024up-to-date) and full display at any time by typing @kbd{v t}
2025(@code{vc-dired-toggle-terse-mode}). There is also a special command
2026@kbd{* l} (@code{vc-dired-mark-locked}), which marks all files currently
2027locked (or, with CVS, all files not up-to-date). Thus, typing @kbd{* l
2028t k} is another way to delete from the buffer all files except those
2029currently locked.
2030
2031@node Branches 1896@node Branches
2032@subsection Multiple Branches of a File 1897@subsection Multiple Branches of a File
2033@cindex branch (version control) 1898@cindex branch (version control)
@@ -2206,9 +2071,10 @@ own choice of selected versions, but all share the same common RCS
2206records. 2071records.
2207 2072
2208 This technique works reliably and automatically, provided that the 2073 This technique works reliably and automatically, provided that the
2209source files contain RCS version headers (@pxref{Version Headers}). The 2074source files contain RCS version headers (@pxref{Version
2210headers enable Emacs to be sure, at all times, which version number is 2075Headers,,,emacs-xtra, Specialized Emacs Features}). The headers enable
2211present in the work file. 2076Emacs to be sure, at all times, which version number is present in the
2077work file.
2212 2078
2213 If the files do not have version headers, you must instead tell Emacs 2079 If the files do not have version headers, you must instead tell Emacs
2214explicitly in each session which branch you are working on. To do this, 2080explicitly in each session which branch you are working on. To do this,
@@ -2216,730 +2082,6 @@ first find the file, then type @kbd{C-u C-x v v} and specify the correct
2216branch number. This ensures that Emacs knows which branch it is using 2082branch number. This ensures that Emacs knows which branch it is using
2217during this particular editing session. 2083during this particular editing session.
2218 2084
2219@node Remote Repositories
2220@subsection Remote Repositories
2221@cindex remote repositories (CVS)
2222
2223 A common way of using CVS is to set up a central CVS repository on
2224some Internet host, then have each developer check out a personal
2225working copy of the files on his local machine. Committing changes to
2226the repository, and picking up changes from other users into one's own
2227working area, then works by direct interactions with the CVS server.
2228
2229 One difficulty is that access to the CVS server is often slow, and
2230that developers might need to work off-line as well. VC is designed
2231to reduce the amount of network interaction necessary.
2232
2233@menu
2234* Version Backups:: Keeping local copies of repository versions.
2235* Local Version Control:: Using another version system for local editing.
2236@end menu
2237
2238@node Version Backups
2239@subsubsection Version Backups
2240@cindex version backups
2241
2242@cindex automatic version backups
2243 When VC sees that the CVS repository for a file is on a remote
2244machine, it automatically makes local backups of unmodified versions
2245of the file---@dfn{automatic version backups}. This means that you
2246can compare the file to the repository version (@kbd{C-x v =}), or
2247revert to that version (@kbd{C-x v u}), without any network
2248interactions.
2249
2250 The local copy of the unmodified file is called a @dfn{version
2251backup} to indicate that it corresponds exactly to a version that is
2252stored in the repository. Note that version backups are not the same
2253as ordinary Emacs backup files (@pxref{Backup}). But they follow a
2254similar naming convention.
2255
2256 For a file that comes from a remote CVS repository, VC makes a
2257version backup whenever you save the first changes to the file, and
2258removes it after you have committed your modified version to the
2259repository. You can disable the making of automatic version backups by
2260setting @code{vc-cvs-stay-local} to @code{nil} (@pxref{CVS Options}).
2261
2262@cindex manual version backups
2263 The name of the automatic version backup for version @var{version}
2264of file @var{file} is @code{@var{file}.~@var{version}.~}. This is
2265almost the same as the name used by @kbd{C-x v ~} (@pxref{Old
2266Versions}), the only difference being the additional dot (@samp{.})
2267after the version number. This similarity is intentional, because
2268both kinds of files store the same kind of information. The file made
2269by @kbd{C-x v ~} acts as a @dfn{manual version backup}.
2270
2271 All the VC commands that operate on old versions of a file can use
2272both kinds of version backups. For instance, @kbd{C-x v ~} uses
2273either an automatic or a manual version backup, if possible, to get
2274the contents of the version you request. Likewise, @kbd{C-x v =} and
2275@kbd{C-x v u} use either an automatic or a manual version backup, if
2276one of them exists, to get the contents of a version to compare or
2277revert to. If you changed a file outside of Emacs, so that no
2278automatic version backup was created for the previous text, you can
2279create a manual backup of that version using @kbd{C-x v ~}, and thus
2280obtain the benefit of the local copy for Emacs commands.
2281
2282 The only difference in Emacs's handling of manual and automatic
2283version backups, once they exist, is that Emacs deletes automatic
2284version backups when you commit to the repository. By contrast,
2285manual version backups remain until you delete them.
2286
2287@node Local Version Control
2288@subsubsection Local Version Control
2289@cindex local version control
2290@cindex local back end (version control)
2291
2292When you make many changes to a file that comes from a remote
2293repository, it can be convenient to have version control on your local
2294machine as well. You can then record intermediate versions, revert to
2295a previous state, etc., before you actually commit your changes to the
2296remote server.
2297
2298VC lets you do this by putting a file under a second, local version
2299control system, so that the file is effectively registered in two
2300systems at the same time. For the description here, we will assume
2301that the remote system is CVS, and you use RCS locally, although the
2302mechanism works with any combination of version control systems
2303(@dfn{back ends}).
2304
2305To make it work with other back ends, you must make sure that the
2306``more local'' back end comes before the ``more remote'' back end in
2307the setting of @code{vc-handled-backends} (@pxref{Customizing VC}). By
2308default, this variable is set up so that you can use remote CVS and
2309local RCS as described here.
2310
2311To start using local RCS for a file that comes from a remote CVS
2312server, you must @emph{register the file in RCS}, by typing @kbd{C-u
2313C-x v v rcs @key{RET}}. (In other words, use @code{vc-next-action} with a
2314prefix argument, and specify RCS as the back end.)
2315
2316You can do this at any time; it does not matter whether you have
2317already modified the file with respect to the version in the CVS
2318repository. If possible, VC tries to make the RCS master start with
2319the unmodified repository version, then checks in any local changes
2320as a new version. This works if you have not made any changes yet, or
2321if the unmodified repository version exists locally as a version
2322backup (@pxref{Version Backups}). If the unmodified version is not
2323available locally, the RCS master starts with the modified version;
2324the only drawback to this is that you cannot compare your changes
2325locally to what is stored in the repository.
2326
2327The version number of the RCS master is derived from the current CVS
2328version, starting a branch from it. For example, if the current CVS
2329version is 1.23, the local RCS branch will be 1.23.1. Version 1.23 in
2330the RCS master will be identical to version 1.23 under CVS; your first
2331changes are checked in as 1.23.1.1. (If the unmodified file is not
2332available locally, VC will check in the modified file twice, both as
23331.23 and 1.23.1.1, to make the revision numbers consistent.)
2334
2335If you do not use locking under CVS (the default), locking is also
2336disabled for RCS, so that editing under RCS works exactly as under
2337CVS.
2338
2339When you are done with local editing, you can commit the final version
2340back to the CVS repository by typing @kbd{C-u C-x v v cvs @key{RET}}.
2341This initializes the log entry buffer (@pxref{Log Buffer}) to contain
2342all the log entries you have recorded in the RCS master; you can edit
2343them as you wish, and then commit in CVS by typing @kbd{C-c C-c}. If
2344the commit is successful, VC removes the RCS master, so that the file
2345is once again registered under CVS only. (The RCS master is not
2346actually deleted, just renamed by appending @samp{~} to the name, so
2347that you can refer to it later if you wish.)
2348
2349While using local RCS, you can pick up recent changes from the CVS
2350repository into your local file, or commit some of your changes back
2351to CVS, without terminating local RCS version control. To do this,
2352switch to the CVS back end temporarily, with the @kbd{C-x v b} command:
2353
2354@table @kbd
2355@item C-x v b
2356Switch to another back end that the current file is registered
2357under (@code{vc-switch-backend}).
2358
2359@item C-u C-x v b @var{backend} @key{RET}
2360Switch to @var{backend} for the current file.
2361@end table
2362
2363@kindex C-x v b
2364@findex vc-switch-backend
2365@kbd{C-x v b} does not change the buffer contents, or any files; it
2366only changes VC's perspective on how to handle the file. Any
2367subsequent VC commands for that file will operate on the back end that
2368is currently selected.
2369
2370If the current file is registered in more than one back end, typing
2371@kbd{C-x v b} ``cycles'' through all of these back ends. With a
2372prefix argument, it asks for the back end to use in the minibuffer.
2373
2374Thus, if you are using local RCS, and you want to pick up some recent
2375changes in the file from remote CVS, first visit the file, then type
2376@kbd{C-x v b} to switch to CVS, and finally use @kbd{C-x v m
2377@key{RET}} to merge the news (@pxref{Merging}). You can then switch
2378back to RCS by typing @kbd{C-x v b} again, and continue to edit
2379locally.
2380
2381But if you do this, the revision numbers in the RCS master no longer
2382correspond to those of CVS. Technically, this is not a problem, but
2383it can become difficult to keep track of what is in the CVS repository
2384and what is not. So we suggest that you return from time to time to
2385CVS-only operation, by committing your local changes back to the
2386repository using @kbd{C-u C-x v v cvs @key{RET}}.
2387
2388@node Snapshots
2389@subsection Snapshots
2390@cindex snapshots and version control
2391
2392 A @dfn{snapshot} is a named set of file versions (one for each
2393registered file) that you can treat as a unit. One important kind of
2394snapshot is a @dfn{release}, a (theoretically) stable version of the
2395system that is ready for distribution to users.
2396
2397@menu
2398* Making Snapshots:: The snapshot facilities.
2399* Snapshot Caveats:: Things to be careful of when using snapshots.
2400@end menu
2401
2402@node Making Snapshots
2403@subsubsection Making and Using Snapshots
2404
2405 There are two basic commands for snapshots; one makes a
2406snapshot with a given name, the other retrieves a named snapshot.
2407
2408@table @code
2409@kindex C-x v s
2410@findex vc-create-snapshot
2411@item C-x v s @var{name} @key{RET}
2412Define the last saved versions of every registered file in or under the
2413current directory as a snapshot named @var{name}
2414(@code{vc-create-snapshot}).
2415
2416@kindex C-x v r
2417@findex vc-retrieve-snapshot
2418@item C-x v r @var{name} @key{RET}
2419For all registered files at or below the current directory level, select
2420whatever versions correspond to the snapshot @var{name}
2421(@code{vc-retrieve-snapshot}).
2422
2423This command reports an error if any files are locked at or below the
2424current directory, without changing anything; this is to avoid
2425overwriting work in progress.
2426@end table
2427
2428 A snapshot uses a very small amount of resources---just enough to record
2429the list of file names and which version belongs to the snapshot. Thus,
2430you need not hesitate to create snapshots whenever they are useful.
2431
2432 You can give a snapshot name as an argument to @kbd{C-x v =} or
2433@kbd{C-x v ~} (@pxref{Old Versions}). Thus, you can use it to compare a
2434snapshot against the current files, or two snapshots against each other,
2435or a snapshot against a named version.
2436
2437@node Snapshot Caveats
2438@subsubsection Snapshot Caveats
2439
2440@cindex named configurations (RCS)
2441 VC's snapshot facilities are modeled on RCS's named-configuration
2442support. They use RCS's native facilities for this, so
2443snapshots made using RCS through VC are visible even when you bypass VC.
2444
2445 With CVS, Meta-CVS, and Subversion, VC also uses the native
2446mechanism provided by that back end to make snapshots and retrieve them
2447(@dfn{tags} for CVS and Meta-CVS, @dfn{copies} for Subversion).
2448
2449@c worded verbosely to avoid overfull hbox.
2450 For SCCS, VC implements snapshots itself. The files it uses contain
2451name/file/version-number triples. These snapshots are visible only
2452through VC.
2453
2454 There is no support for VC snapshots using GNU Arch yet.
2455
2456 A snapshot is a set of checked-in versions. So make sure that all the
2457files are checked in and not locked when you make a snapshot.
2458
2459 File renaming and deletion can create some difficulties with snapshots.
2460This is not a VC-specific problem, but a general design issue in version
2461control systems that no one has solved very well yet.
2462
2463 If you rename a registered file, you need to rename its master along
2464with it (the command @code{vc-rename-file} does this automatically). If
2465you are using SCCS, you must also update the records of the snapshot, to
2466mention the file by its new name (@code{vc-rename-file} does this,
2467too). An old snapshot that refers to a master file that no longer
2468exists under the recorded name is invalid; VC can no longer retrieve
2469it. It would be beyond the scope of this manual to explain enough about
2470RCS and SCCS to explain how to update the snapshots by hand.
2471
2472 Using @code{vc-rename-file} makes the snapshot remain valid for
2473retrieval, but it does not solve all problems. For example, some of the
2474files in your program probably refer to others by name. At the very
2475least, the makefile probably mentions the file that you renamed. If you
2476retrieve an old snapshot, the renamed file is retrieved under its new
2477name, which is not the name that the makefile expects. So the program
2478won't really work as retrieved.
2479
2480@node Miscellaneous VC
2481@subsection Miscellaneous Commands and Features of VC
2482
2483 This section explains the less-frequently-used features of VC.
2484
2485@menu
2486* Change Logs and VC:: Generating a change log file from log entries.
2487* Renaming and VC:: A command to rename both the source and master
2488 file correctly.
2489* Version Headers:: Inserting version control headers into working files.
2490@end menu
2491
2492@node Change Logs and VC
2493@subsubsection Change Logs and VC
2494
2495 If you use RCS or CVS for a program and also maintain a change log
2496file for it (@pxref{Change Log}), you can generate change log entries
2497automatically from the version control log entries:
2498
2499@table @kbd
2500@item C-x v a
2501@kindex C-x v a
2502@findex vc-update-change-log
2503Visit the current directory's change log file and, for registered files
2504in that directory, create new entries for versions checked in since the
2505most recent entry in the change log file.
2506(@code{vc-update-change-log}).
2507
2508This command works with RCS or CVS only, not with any of the other
2509back ends.
2510
2511@item C-u C-x v a
2512As above, but only find entries for the current buffer's file.
2513
2514@item M-1 C-x v a
2515As above, but find entries for all the currently visited files that are
2516maintained with version control. This works only with RCS, and it puts
2517all entries in the log for the default directory, which may not be
2518appropriate.
2519@end table
2520
2521 For example, suppose the first line of @file{ChangeLog} is dated
25221999-04-10, and that the only check-in since then was by Nathaniel
2523Bowditch to @file{rcs2log} on 1999-05-22 with log text @samp{Ignore log
2524messages that start with `#'.}. Then @kbd{C-x v a} visits
2525@file{ChangeLog} and inserts text like this:
2526
2527@iftex
2528@medbreak
2529@end iftex
2530@smallexample
2531@group
25321999-05-22 Nathaniel Bowditch <nat@@apn.org>
2533
2534 * rcs2log: Ignore log messages that start with `#'.
2535@end group
2536@end smallexample
2537@iftex
2538@medbreak
2539@end iftex
2540
2541@noindent
2542You can then edit the new change log entry further as you wish.
2543
2544 Some of the new change log entries may duplicate what's already in
2545ChangeLog. You will have to remove these duplicates by hand.
2546
2547 Normally, the log entry for file @file{foo} is displayed as @samp{*
2548foo: @var{text of log entry}}. The @samp{:} after @file{foo} is omitted
2549if the text of the log entry starts with @w{@samp{(@var{functionname}):
2550}}. For example, if the log entry for @file{vc.el} is
2551@samp{(vc-do-command): Check call-process status.}, then the text in
2552@file{ChangeLog} looks like this:
2553
2554@iftex
2555@medbreak
2556@end iftex
2557@smallexample
2558@group
25591999-05-06 Nathaniel Bowditch <nat@@apn.org>
2560
2561 * vc.el (vc-do-command): Check call-process status.
2562@end group
2563@end smallexample
2564@iftex
2565@medbreak
2566@end iftex
2567
2568 When @kbd{C-x v a} adds several change log entries at once, it groups
2569related log entries together if they all are checked in by the same
2570author at nearly the same time. If the log entries for several such
2571files all have the same text, it coalesces them into a single entry.
2572For example, suppose the most recent check-ins have the following log
2573entries:
2574
2575@flushleft
2576@bullet{} For @file{vc.texinfo}: @samp{Fix expansion typos.}
2577@bullet{} For @file{vc.el}: @samp{Don't call expand-file-name.}
2578@bullet{} For @file{vc-hooks.el}: @samp{Don't call expand-file-name.}
2579@end flushleft
2580
2581@noindent
2582They appear like this in @file{ChangeLog}:
2583
2584@iftex
2585@medbreak
2586@end iftex
2587@smallexample
2588@group
25891999-04-01 Nathaniel Bowditch <nat@@apn.org>
2590
2591 * vc.texinfo: Fix expansion typos.
2592
2593 * vc.el, vc-hooks.el: Don't call expand-file-name.
2594@end group
2595@end smallexample
2596@iftex
2597@medbreak
2598@end iftex
2599
2600 Normally, @kbd{C-x v a} separates log entries by a blank line, but you
2601can mark several related log entries to be clumped together (without an
2602intervening blank line) by starting the text of each related log entry
2603with a label of the form @w{@samp{@{@var{clumpname}@} }}. The label
2604itself is not copied to @file{ChangeLog}. For example, suppose the log
2605entries are:
2606
2607@flushleft
2608@bullet{} For @file{vc.texinfo}: @samp{@{expand@} Fix expansion typos.}
2609@bullet{} For @file{vc.el}: @samp{@{expand@} Don't call expand-file-name.}
2610@bullet{} For @file{vc-hooks.el}: @samp{@{expand@} Don't call expand-file-name.}
2611@end flushleft
2612
2613@noindent
2614Then the text in @file{ChangeLog} looks like this:
2615
2616@iftex
2617@medbreak
2618@end iftex
2619@smallexample
2620@group
26211999-04-01 Nathaniel Bowditch <nat@@apn.org>
2622
2623 * vc.texinfo: Fix expansion typos.
2624 * vc.el, vc-hooks.el: Don't call expand-file-name.
2625@end group
2626@end smallexample
2627@iftex
2628@medbreak
2629@end iftex
2630
2631 A log entry whose text begins with @samp{#} is not copied to
2632@file{ChangeLog}. For example, if you merely fix some misspellings in
2633comments, you can log the change with an entry beginning with @samp{#}
2634to avoid putting such trivia into @file{ChangeLog}.
2635
2636@node Renaming and VC
2637@subsubsection Renaming VC Work Files and Master Files
2638
2639@findex vc-rename-file
2640 When you rename a registered file, you must also rename its master
2641file correspondingly to get proper results. Use @code{vc-rename-file}
2642to rename the source file as you specify, and rename its master file
2643accordingly. It also updates any snapshots (@pxref{Snapshots}) that
2644mention the file, so that they use the new name; despite this, the
2645snapshot thus modified may not completely work (@pxref{Snapshot
2646Caveats}).
2647
2648 Some back ends do not provide an explicit rename operation to their
2649repositories. After issuing @code{vc-rename-file}, use @kbd{C-x v v}
2650on the original and renamed buffers and provide the necessary edit
2651log.
2652
2653 You cannot use @code{vc-rename-file} on a file that is locked by
2654someone else.
2655
2656@node Version Headers
2657@subsubsection Inserting Version Control Headers
2658
2659 Sometimes it is convenient to put version identification strings
2660directly into working files. Certain special strings called
2661@dfn{version headers} are replaced in each successive version by the
2662number of that version, the name of the user who created it, and other
2663relevant information. All of the back ends that VC supports have such
2664a mechanism, except GNU Arch.
2665
2666 VC does not normally use the information contained in these headers.
2667The exception is RCS---with RCS, version headers are sometimes more
2668reliable than the master file to determine which version of the file
2669you are editing. Note that in a multi-branch environment, version
2670headers are necessary to make VC behave correctly (@pxref{Multi-User
2671Branching}).
2672
2673 Searching for RCS version headers is controlled by the variable
2674@code{vc-consult-headers}. If it is non-@code{nil} (the default),
2675Emacs searches for headers to determine the version number you are
2676editing. Setting it to @code{nil} disables this feature.
2677
2678 Note that although CVS uses the same kind of version headers as RCS
2679does, VC never searches for these headers if you are using CVS,
2680regardless of the above setting.
2681
2682@kindex C-x v h
2683@findex vc-insert-headers
2684 You can use the @kbd{C-x v h} command (@code{vc-insert-headers}) to
2685insert a suitable header string.
2686
2687@table @kbd
2688@item C-x v h
2689Insert headers in a file for use with your version-control system.
2690@end table
2691
2692@vindex vc-@var{backend}-header
2693 The default header string is @samp{@w{$}Id$} for RCS and
2694@samp{@w{%}W%} for SCCS. You can specify other headers to insert by
2695setting the variables @code{vc-@var{backend}-header} where
2696@var{backend} is @code{rcs} or @code{sccs}.
2697
2698 Instead of a single string, you can specify a list of strings; then
2699each string in the list is inserted as a separate header on a line of
2700its own.
2701
2702 It may be necessary to use apparently-superfluous backslashes when
2703writing the strings that you put in this variable. For instance, you
2704might write @code{"$Id\$"} rather than @code{"$Id@w{$}"}. The extra
2705backslash prevents the string constant from being interpreted as a
2706header, if the Emacs Lisp file containing it is maintained with
2707version control.
2708
2709@vindex vc-comment-alist
2710 Each header is inserted surrounded by tabs, inside comment delimiters,
2711on a new line at point. Normally the ordinary comment
2712start and comment end strings of the current mode are used, but for
2713certain modes, there are special comment delimiters for this purpose;
2714the variable @code{vc-comment-alist} specifies them. Each element of
2715this list has the form @code{(@var{mode} @var{starter} @var{ender})}.
2716
2717@vindex vc-static-header-alist
2718 The variable @code{vc-static-header-alist} specifies further strings
2719to add based on the name of the buffer. Its value should be a list of
2720elements of the form @code{(@var{regexp} . @var{format})}. Whenever
2721@var{regexp} matches the buffer name, @var{format} is inserted as part
2722of the header. A header line is inserted for each element that matches
2723the buffer name, and for each string specified by
2724@code{vc-@var{backend}-header}. The header line is made by processing the
2725string from @code{vc-@var{backend}-header} with the format taken from the
2726element. The default value for @code{vc-static-header-alist} is as follows:
2727
2728@example
2729@group
2730(("\\.c$" .
2731 "\n#ifndef lint\nstatic char vcid[] = \"\%s\";\n\
2732#endif /* lint */\n"))
2733@end group
2734@end example
2735
2736@noindent
2737It specifies insertion of text of this form:
2738
2739@example
2740@group
2741
2742#ifndef lint
2743static char vcid[] = "@var{string}";
2744#endif /* lint */
2745@end group
2746@end example
2747
2748@noindent
2749Note that the text above starts with a blank line.
2750
2751 If you use more than one version header in a file, put them close
2752together in the file. The mechanism in @code{revert-buffer} that
2753preserves markers may not handle markers positioned between two version
2754headers.
2755
2756@node Customizing VC
2757@subsection Customizing VC
2758
2759@vindex vc-handled-backends
2760The variable @code{vc-handled-backends} determines which version
2761control systems VC should handle. The default value is @code{(RCS CVS
2762SVN SCCS Arch MCVS)}, so it contains all six version systems that are
2763currently supported. If you want VC to ignore one or more of these
2764systems, exclude its name from the list. To disable VC entirely, set
2765this variable to @code{nil}.
2766
2767The order of systems in the list is significant: when you visit a file
2768registered in more than one system (@pxref{Local Version Control}),
2769VC uses the system that comes first in @code{vc-handled-backends} by
2770default. The order is also significant when you register a file for
2771the first time, @pxref{Registering} for details.
2772
2773@menu
2774* General VC Options:: Options that apply to multiple back ends.
2775* RCS and SCCS:: Options for RCS and SCCS.
2776* CVS Options:: Options for CVS.
2777@end menu
2778
2779@node General VC Options
2780@subsubsection General Options
2781
2782@vindex vc-make-backup-files
2783 Emacs normally does not save backup files for source files that are
2784maintained with version control. If you want to make backup files even
2785for files that use version control, set the variable
2786@code{vc-make-backup-files} to a non-@code{nil} value.
2787
2788@vindex vc-keep-workfiles
2789 Normally the work file exists all the time, whether it is locked or
2790not. If you set @code{vc-keep-workfiles} to @code{nil}, then checking
2791in a new version with @kbd{C-x v v} deletes the work file; but any
2792attempt to visit the file with Emacs creates it again. (With CVS, work
2793files are always kept.)
2794
2795@vindex vc-follow-symlinks
2796 Editing a version-controlled file through a symbolic link can be
2797dangerous. It bypasses the version control system---you can edit the
2798file without locking it, and fail to check your changes in. Also,
2799your changes might overwrite those of another user. To protect against
2800this, VC checks each symbolic link that you visit, to see if it points
2801to a file under version control.
2802
2803 The variable @code{vc-follow-symlinks} controls what to do when a
2804symbolic link points to a version-controlled file. If it is @code{nil},
2805VC only displays a warning message. If it is @code{t}, VC automatically
2806follows the link, and visits the real file instead, telling you about
2807this in the echo area. If the value is @code{ask} (the default), VC
2808asks you each time whether to follow the link.
2809
2810@vindex vc-suppress-confirm
2811 If @code{vc-suppress-confirm} is non-@code{nil}, then @kbd{C-x v v}
2812and @kbd{C-x v i} can save the current buffer without asking, and
2813@kbd{C-x v u} also operates without asking for confirmation. (This
2814variable does not affect @kbd{C-x v c}; that operation is so drastic
2815that it should always ask for confirmation.)
2816
2817@vindex vc-command-messages
2818 VC mode does much of its work by running the shell commands for RCS,
2819CVS and SCCS. If @code{vc-command-messages} is non-@code{nil}, VC
2820displays messages to indicate which shell commands it runs, and
2821additional messages when the commands finish.
2822
2823@vindex vc-path
2824 You can specify additional directories to search for version control
2825programs by setting the variable @code{vc-path}. These directories
2826are searched before the usual search path. It is rarely necessary to
2827set this variable, because VC normally finds the proper files
2828automatically.
2829
2830@node RCS and SCCS
2831@subsubsection Options for RCS and SCCS
2832
2833@cindex non-strict locking (RCS)
2834@cindex locking, non-strict (RCS)
2835 By default, RCS uses locking to coordinate the activities of several
2836users, but there is a mode called @dfn{non-strict locking} in which
2837you can check-in changes without locking the file first. Use
2838@samp{rcs -U} to switch to non-strict locking for a particular file,
2839see the @code{rcs} manual page for details.
2840
2841 When deducing the version control state of an RCS file, VC first
2842looks for an RCS version header string in the file (@pxref{Version
2843Headers}). If there is no header string, VC normally looks at the
2844file permissions of the work file; this is fast. But there might be
2845situations when the file permissions cannot be trusted. In this case
2846the master file has to be consulted, which is rather expensive. Also
2847the master file can only tell you @emph{if} there's any lock on the
2848file, but not whether your work file really contains that locked
2849version.
2850
2851@vindex vc-consult-headers
2852 You can tell VC not to use version headers to determine the file
2853status by setting @code{vc-consult-headers} to @code{nil}. VC then
2854always uses the file permissions (if it is supposed to trust them), or
2855else checks the master file.
2856
2857@vindex vc-mistrust-permissions
2858 You can specify the criterion for whether to trust the file
2859permissions by setting the variable @code{vc-mistrust-permissions}.
2860Its value can be @code{t} (always mistrust the file permissions and
2861check the master file), @code{nil} (always trust the file
2862permissions), or a function of one argument which makes the decision.
2863The argument is the directory name of the @file{RCS} subdirectory. A
2864non-@code{nil} value from the function says to mistrust the file
2865permissions. If you find that the file permissions of work files are
2866changed erroneously, set @code{vc-mistrust-permissions} to @code{t}.
2867Then VC always checks the master file to determine the file's status.
2868
2869 VC determines the version control state of files under SCCS much as
2870with RCS. It does not consider SCCS version headers, though. Thus,
2871the variable @code{vc-mistrust-permissions} affects SCCS use, but
2872@code{vc-consult-headers} does not.
2873
2874@node CVS Options
2875@subsubsection Options specific for CVS
2876
2877@cindex locking (CVS)
2878 By default, CVS does not use locking to coordinate the activities of
2879several users; anyone can change a work file at any time. However,
2880there are ways to restrict this, resulting in behavior that resembles
2881locking.
2882
2883@cindex CVSREAD environment variable (CVS)
2884 For one thing, you can set the @env{CVSREAD} environment variable
2885(the value you use makes no difference). If this variable is defined,
2886CVS makes your work files read-only by default. In Emacs, you must
2887type @kbd{C-x v v} to make the file writable, so that editing works
2888in fact similar as if locking was used. Note however, that no actual
2889locking is performed, so several users can make their files writable
2890at the same time. When setting @env{CVSREAD} for the first time, make
2891sure to check out all your modules anew, so that the file protections
2892are set correctly.
2893
2894@cindex cvs watch feature
2895@cindex watching files (CVS)
2896 Another way to achieve something similar to locking is to use the
2897@dfn{watch} feature of CVS. If a file is being watched, CVS makes it
2898read-only by default, and you must also use @kbd{C-x v v} in Emacs to
2899make it writable. VC calls @code{cvs edit} to make the file writable,
2900and CVS takes care to notify other developers of the fact that you
2901intend to change the file. See the CVS documentation for details on
2902using the watch feature.
2903
2904@vindex vc-stay-local
2905@vindex vc-cvs-stay-local
2906@cindex remote repositories (CVS)
2907 When a file's repository is on a remote machine, VC tries to keep
2908network interactions to a minimum. This is controlled by the variable
2909@code{vc-cvs-stay-local}. There is another variable,
2910@code{vc-stay-local}, which enables the feature also for other back
2911ends that support it, including CVS. In the following, we will talk
2912only about @code{vc-cvs-stay-local}, but everything applies to
2913@code{vc-stay-local} as well.
2914
2915If @code{vc-cvs-stay-local} is @code{t} (the default), then VC uses
2916only the entry in the local CVS subdirectory to determine the file's
2917state (and possibly information returned by previous CVS commands).
2918One consequence of this is that when you have modified a file, and
2919somebody else has already checked in other changes to the file, you
2920are not notified of it until you actually try to commit. (But you can
2921try to pick up any recent changes from the repository first, using
2922@kbd{C-x v m @key{RET}}, @pxref{Merging}).
2923
2924 When @code{vc-cvs-stay-local} is @code{t}, VC also makes local
2925version backups, so that simple diff and revert operations are
2926completely local (@pxref{Version Backups}).
2927
2928 On the other hand, if you set @code{vc-cvs-stay-local} to @code{nil},
2929then VC queries the remote repository @emph{before} it decides what to
2930do in @code{vc-next-action} (@kbd{C-x v v}), just as it does for local
2931repositories. It also does not make any version backups.
2932
2933 You can also set @code{vc-cvs-stay-local} to a regular expression
2934that is matched against the repository host name; VC then stays local
2935only for repositories from hosts that match the pattern.
2936
2937@vindex vc-cvs-global-switches
2938 You can specify additional command line options to pass to all CVS
2939operations in the variable @code{vc-cvs-global-switches}. These
2940switches are inserted immediately after the @code{cvs} command, before
2941the name of the operation to invoke.
2942
2943@node Directories 2085@node Directories
2944@section File Directories 2086@section File Directories
2945 2087
diff --git a/man/gnus-faq.texi b/man/gnus-faq.texi
index 7fa00c37403..a85a36c2d22 100644
--- a/man/gnus-faq.texi
+++ b/man/gnus-faq.texi
@@ -128,7 +128,7 @@ What is the latest version of Gnus?
128Jingle please: Gnus 5.10 is released, get it while it's 128Jingle please: Gnus 5.10 is released, get it while it's
129hot! As well as the step in version number is rather 129hot! As well as the step in version number is rather
130small, Gnus 5.10 has tons of new features which you 130small, Gnus 5.10 has tons of new features which you
131shouldn't miss. The current release (5.10.6) should be at 131shouldn't miss. The current release (5.10.8) should be at
132least as stable as the latest release of the 5.8 series. 132least as stable as the latest release of the 5.8 series.
133 133
134@node [1.2] 134@node [1.2]
diff --git a/man/gnus.texi b/man/gnus.texi
index 6493911afcf..c5857f40ab4 100644
--- a/man/gnus.texi
+++ b/man/gnus.texi
@@ -4043,6 +4043,22 @@ happens. You just have to be careful if you do stuff like that.
4043 4043
4044@table @kbd 4044@table @kbd
4045 4045
4046@item v
4047@kindex v (Group)
4048@cindex keys, reserved for users (Group)
4049The key @kbd{v} is reserved for users. You can bind it key to some
4050function or better use it as a prefix key. For example:
4051
4052@lisp
4053(define-key gnus-group-mode-map (kbd "v j d")
4054 (lambda ()
4055 (interactive)
4056 (gnus-group-jump-to-group "nndraft:drafts")))
4057@end lisp
4058
4059On keys reserved for users in Emacs and on keybindings in general
4060@xref{Keymaps, Keymaps, , emacs, The Emacs Editor}.
4061
4046@item ^ 4062@item ^
4047@kindex ^ (Group) 4063@kindex ^ (Group)
4048@findex gnus-group-enter-server-mode 4064@findex gnus-group-enter-server-mode
@@ -4438,6 +4454,14 @@ group buffer (@pxref{Selecting a Group}).
4438 4454
4439You can have as many summary buffers open as you wish. 4455You can have as many summary buffers open as you wish.
4440 4456
4457@kindex v (Summary)
4458@cindex keys, reserved for users (Summary)
4459The key @kbd{v} is reserved for users. You can bind it key to some
4460function or better use it as a prefix key. For example:
4461@lisp
4462(define-key gnus-summary-mode-map (kbd "v -") "LrS") ;; lower subthread
4463@end lisp
4464
4441@menu 4465@menu
4442* Summary Buffer Format:: Deciding how the summary buffer is to look. 4466* Summary Buffer Format:: Deciding how the summary buffer is to look.
4443* Summary Maneuvering:: Moving around the summary buffer. 4467* Summary Maneuvering:: Moving around the summary buffer.
@@ -11242,6 +11266,11 @@ buffer, which means that you don't actually have to have a summary
11242buffer displayed while reading. You can do it all from the article 11266buffer displayed while reading. You can do it all from the article
11243buffer. 11267buffer.
11244 11268
11269@kindex v (Article)
11270@cindex keys, reserved for users (Article)
11271The key @kbd{v} is reserved for users. You can bind it key to some
11272function or better use it as a prefix key.
11273
11245A few additional keystrokes are available: 11274A few additional keystrokes are available:
11246 11275
11247@table @kbd 11276@table @kbd
@@ -12272,6 +12301,12 @@ Also @pxref{Formatting Variables}.
12272 12301
12273@table @kbd 12302@table @kbd
12274 12303
12304@item v
12305@kindex v (Server)
12306@cindex keys, reserved for users (Server)
12307The key @kbd{v} is reserved for users. You can bind it key to some
12308function or better use it as a prefix key.
12309
12275@item a 12310@item a
12276@kindex a (Server) 12311@kindex a (Server)
12277@findex gnus-server-add-server 12312@findex gnus-server-add-server
diff --git a/man/org.texi b/man/org.texi
index 2c7a4ef8289..19c0f222c57 100644
--- a/man/org.texi
+++ b/man/org.texi
@@ -4,8 +4,8 @@
4@setfilename ../info/org 4@setfilename ../info/org
5@settitle Org Mode Manual 5@settitle Org Mode Manual
6 6
7@set VERSION 4.10 7@set VERSION 4.21
8@set DATE March 2006 8@set DATE April 2006
9 9
10@dircategory Emacs 10@dircategory Emacs
11@direntry 11@direntry
@@ -82,6 +82,7 @@ Software Foundation raise funds for GNU development.''
82* Hyperlinks:: Notes in context 82* Hyperlinks:: Notes in context
83* TODO items:: Every tree branch can be a TODO item 83* TODO items:: Every tree branch can be a TODO item
84* Timestamps:: Assign date and time to items 84* Timestamps:: Assign date and time to items
85* Tags:: Tagging headlines and matching sets of tags
85* Agenda Views:: Collecting information into views 86* Agenda Views:: Collecting information into views
86* Exporting:: Sharing and publishing of notes 87* Exporting:: Sharing and publishing of notes
87* Miscellaneous:: All the rest which did not fit elsewhere 88* Miscellaneous:: All the rest which did not fit elsewhere
@@ -94,7 +95,7 @@ Software Foundation raise funds for GNU development.''
94Introduction 95Introduction
95 96
96* Summary:: Brief summary of what Org-mode does 97* Summary:: Brief summary of what Org-mode does
97* Installation and Activation:: How to install Org-mode 98* Installation and activation:: How to install Org-mode
98* Feedback:: Bug reports, ideas, patches etc. 99* Feedback:: Bug reports, ideas, patches etc.
99 100
100Document Structure 101Document Structure
@@ -106,12 +107,12 @@ Document Structure
106* Structure editing:: Changing sequence and level of headlines 107* Structure editing:: Changing sequence and level of headlines
107* Archiving:: Move done task trees to a different place 108* Archiving:: Move done task trees to a different place
108* Sparse trees:: Matches embedded in context 109* Sparse trees:: Matches embedded in context
109* Tags:: Tagging headlines and matching sets of tags
110* Plain Lists:: Editing hand-formatted lists 110* Plain Lists:: Editing hand-formatted lists
111 111
112Tables 112Tables
113 113
114* Built-in table editor:: Simple tables 114* Built-in table editor:: Simple tables
115* Narrow columns:: Stop wasting space in tables
115* Table calculations:: Compute a field from other fields 116* Table calculations:: Compute a field from other fields
116* orgtbl-mode:: The table editor as minor mode 117* orgtbl-mode:: The table editor as minor mode
117* table.el:: Complex tables 118* table.el:: Complex tables
@@ -127,13 +128,14 @@ Calculations in tables
127 128
128Hyperlinks 129Hyperlinks
129 130
130* Internal Links:: Links to other places in the current file 131* Link format:: How links in Org-mode are formatted
131* External Links:: URL-like links to the world 132* Internal links:: Links to other places in the current file
133* External links:: URL-like links to the world
132* Managing links:: Creating, inserting and following 134* Managing links:: Creating, inserting and following
133* Search Options:: Linking to a specific location 135* Search Options:: Linking to a specific location
134* Remember:: Org-trees store quick notes 136* Remember:: Org-trees store quick notes
135 137
136Internal Links 138Internal links
137 139
138* Radio targets:: Make targets trigger links in plain text. 140* Radio targets:: Make targets trigger links in plain text.
139* CamelCase links:: Activating CamelCase words as links 141* CamelCase links:: Activating CamelCase words as links
@@ -141,7 +143,7 @@ Internal Links
141TODO items 143TODO items
142 144
143* TODO basics:: Marking and displaying TODO entries 145* TODO basics:: Marking and displaying TODO entries
144* Progress Logging:: Document your productivity 146* Progress logging:: Document your productivity
145* TODO extensions:: Workflow and assignments 147* TODO extensions:: Workflow and assignments
146* Priorities:: Some things are more important than others 148* Priorities:: Some things are more important than others
147 149
@@ -156,6 +158,12 @@ Timestamps
156* Time stamps:: Assigning a time to a tree entry 158* Time stamps:: Assigning a time to a tree entry
157* Creating timestamps:: Commands which insert timestamps 159* Creating timestamps:: Commands which insert timestamps
158 160
161Tags
162
163* Tag inheritance:: Tags use the tree structure of the outline
164* Setting tags:: How to assign tags to a headline
165* Tag searches:: Searching for combinations of tags
166
159Agenda Views 167Agenda Views
160 168
161* Agenda files:: Files being searched for agenda information 169* Agenda files:: Files being searched for agenda information
@@ -189,6 +197,7 @@ Miscellaneous
189 197
190* Completion:: M-TAB knows what you need 198* Completion:: M-TAB knows what you need
191* Customization:: Adapting Org-mode to your taste 199* Customization:: Adapting Org-mode to your taste
200* Updating settings:: How to tell Org-mode that settings have changed
192* Clean view:: Getting rid of leading stars in the outline 201* Clean view:: Getting rid of leading stars in the outline
193* TTY keys:: Using Org-mode on a tty 202* TTY keys:: Using Org-mode on a tty
194* FAQ:: Frequently asked questions 203* FAQ:: Frequently asked questions
@@ -205,11 +214,11 @@ Miscellaneous
205 214
206@menu 215@menu
207* Summary:: Brief summary of what Org-mode does 216* Summary:: Brief summary of what Org-mode does
208* Installation and Activation:: How to install Org-mode 217* Installation and activation:: How to install Org-mode
209* Feedback:: Bug reports, ideas, patches etc. 218* Feedback:: Bug reports, ideas, patches etc.
210@end menu 219@end menu
211 220
212@node Summary, Installation and Activation, Introduction, Introduction 221@node Summary, Installation and activation, Introduction, Introduction
213@section Summary 222@section Summary
214@cindex summary 223@cindex summary
215 224
@@ -234,7 +243,7 @@ Org-mode keeps simple things simple. When first fired up, it should
234feel like a simple but easy to use outliner. Complexity is not 243feel like a simple but easy to use outliner. Complexity is not
235imposed, but a large amount of functionality is available when you 244imposed, but a large amount of functionality is available when you
236need it. Org-mode can be used on different levels and in different 245need it. Org-mode can be used on different levels and in different
237ways, for example 246ways, for example:
238 247
239@example 248@example
240@r{@bullet{} as an outline extension with visibility cycling and structure editing} 249@r{@bullet{} as an outline extension with visibility cycling and structure editing}
@@ -255,7 +264,7 @@ and example files. This page is located at
255 264
256@page 265@page
257 266
258@node Installation and Activation, Feedback, Summary, Introduction 267@node Installation and activation, Feedback, Summary, Introduction
259@section Installation and Activation 268@section Installation and Activation
260@cindex installation 269@cindex installation
261@cindex autoload 270@cindex autoload
@@ -301,9 +310,9 @@ MY PROJECTS -*- mode: org; -*-
301 310
302@noindent which will select Org-mode for this buffer no matter what 311@noindent which will select Org-mode for this buffer no matter what
303the file's name is. See also the variable 312the file's name is. See also the variable
304@code{org-insert-mode-line-in-empty-file'}. 313@code{org-insert-mode-line-in-empty-file}.
305 314
306@node Feedback, , Installation and Activation, Introduction 315@node Feedback, , Installation and activation, Introduction
307@section Feedback 316@section Feedback
308@cindex feedback 317@cindex feedback
309@cindex bug reports 318@cindex bug reports
@@ -316,16 +325,17 @@ or ideas about it, please contact the maintainer Carsten Dominik at
316 325
317For bug reports, please provide as much information as possible, 326For bug reports, please provide as much information as possible,
318including the version information of Emacs (@kbd{C-h v emacs-version 327including the version information of Emacs (@kbd{C-h v emacs-version
319@key{RET}}) and Org-mode (@kbd{M-x org-version}), as well as the 328@key{RET}}) and Org-mode (@kbd{C-h v org-version @key{RET}}), as well as
320Org-mode related setup in @file{.emacs}. If an error occurs, a 329the Org-mode related setup in @file{.emacs}. If an error occurs, a
321traceback can be very useful. Often a small example file helps, along 330traceback can be very useful. Often a small example file helps, along
322with clear information about: 331with clear information about:
332
323@enumerate 333@enumerate
324@item What exactly did you do? 334@item What exactly did you do?
325@item What did you expect to happen? 335@item What did you expect to happen?
326@item What happened instead? 336@item What happened instead?
327@end enumerate 337@end enumerate
328@noindent Thanks for helping to improve this mode. 338@noindent Thank you for helping to improve this mode.
329 339
330@node Document Structure, Tables, Introduction, Top 340@node Document Structure, Tables, Introduction, Top
331@chapter Document Structure 341@chapter Document Structure
@@ -343,7 +353,6 @@ edit the structure of the document.
343* Structure editing:: Changing sequence and level of headlines 353* Structure editing:: Changing sequence and level of headlines
344* Archiving:: Move done task trees to a different place 354* Archiving:: Move done task trees to a different place
345* Sparse trees:: Matches embedded in context 355* Sparse trees:: Matches embedded in context
346* Tags:: Tagging headlines and matching sets of tags
347* Plain Lists:: Editing hand-formatted lists 356* Plain Lists:: Editing hand-formatted lists
348@end menu 357@end menu
349 358
@@ -367,9 +376,9 @@ key.
367@cindex headlines 376@cindex headlines
368@cindex outline tree 377@cindex outline tree
369 378
370Headlines define the structure of an outline tree. The Headlines in 379Headlines define the structure of an outline tree. The headlines in
371Org-mode start with one or more stars, on the left margin. For 380Org-mode start with one or more stars, on the left margin. For
372example 381example:
373 382
374@example 383@example
375* Top level headline 384* Top level headline
@@ -380,6 +389,7 @@ example
380 more text 389 more text
381* Another top level headline 390* Another top level headline
382@end example 391@end example
392
383@noindent Some people find the many stars too noisy and would prefer an 393@noindent Some people find the many stars too noisy and would prefer an
384outline that has whitespace followed by a single star as headline 394outline that has whitespace followed by a single star as headline
385starters. @ref{Clean view} describes a setup to realize this. 395starters. @ref{Clean view} describes a setup to realize this.
@@ -404,10 +414,12 @@ the visibility in the buffer.
404@kindex @key{TAB} 414@kindex @key{TAB}
405@item @key{TAB} 415@item @key{TAB}
406Rotate current subtree between the states 416Rotate current subtree between the states
417
407@example 418@example
408,-> FOLDED -> CHILDREN -> SUBTREE --. 419,-> FOLDED -> CHILDREN -> SUBTREE --.
409'-----------------------------------' 420'-----------------------------------'
410@end example 421@end example
422
411At the beginning of the buffer (or when called with @kbd{C-u}), this does 423At the beginning of the buffer (or when called with @kbd{C-u}), this does
412the same as the command @kbd{S-@key{TAB}} below. 424the same as the command @kbd{S-@key{TAB}} below.
413 425
@@ -418,10 +430,12 @@ the same as the command @kbd{S-@key{TAB}} below.
418@kindex S-@key{TAB} 430@kindex S-@key{TAB}
419@item S-@key{TAB} 431@item S-@key{TAB}
420Rotate the entire buffer between the states 432Rotate the entire buffer between the states
433
421@example 434@example
422,-> OVERVIEW -> CONTENTS -> SHOW ALL --. 435,-> OVERVIEW -> CONTENTS -> SHOW ALL --.
423'--------------------------------------' 436'--------------------------------------'
424@end example 437@end example
438
425Note that inside tables, @kbd{S-@key{TAB}} jumps to the previous field. 439Note that inside tables, @kbd{S-@key{TAB}} jumps to the previous field.
426 440
427@cindex show all, command 441@cindex show all, command
@@ -499,23 +513,23 @@ beginning of the next line.
499Insert new TODO entry with same level as current heading. 513Insert new TODO entry with same level as current heading.
500@kindex M-@key{left} 514@kindex M-@key{left}
501@item M-@key{left} 515@item M-@key{left}
502Promote current heading by one level 516Promote current heading by one level.
503@kindex M-@key{right} 517@kindex M-@key{right}
504@item M-@key{right} 518@item M-@key{right}
505Demote current heading by one level 519Demote current heading by one level.
506@kindex M-S-@key{left} 520@kindex M-S-@key{left}
507@item M-S-@key{left} 521@item M-S-@key{left}
508Promote the current subtree by one level 522Promote the current subtree by one level.
509@kindex M-S-@key{right} 523@kindex M-S-@key{right}
510@item M-S-@key{right} 524@item M-S-@key{right}
511Demote the current subtree by one level 525Demote the current subtree by one level.
512@kindex M-S-@key{up} 526@kindex M-S-@key{up}
513@item M-S-@key{up} 527@item M-S-@key{up}
514Move subtree up (swap with previous subtree of same 528Move subtree up (swap with previous subtree of same
515level) 529level).
516@kindex M-S-@key{down} 530@kindex M-S-@key{down}
517@item M-S-@key{down} 531@item M-S-@key{down}
518Move subtree down (swap with next subtree of same level) 532Move subtree down (swap with next subtree of same level).
519@kindex C-c C-x C-w 533@kindex C-c C-x C-w
520@kindex C-c C-x C-k 534@kindex C-c C-x C-k
521@item C-c C-x C-w 535@item C-c C-x C-w
@@ -567,7 +581,7 @@ this, see the documentation string of the variable
567agenda, archiving to a different file is a good way to keep archived 581agenda, archiving to a different file is a good way to keep archived
568trees from contributing agenda items. 582trees from contributing agenda items.
569 583
570@node Sparse trees, Tags, Archiving, Document Structure 584@node Sparse trees, Plain Lists, Archiving, Document Structure
571@section Sparse trees 585@section Sparse trees
572@cindex sparse trees 586@cindex sparse trees
573@cindex trees, sparse 587@cindex trees, sparse
@@ -602,11 +616,13 @@ For frequently used sparse trees of specific search strings, you can
602use the variable @code{org-agenda-custom-commands} to define fast 616use the variable @code{org-agenda-custom-commands} to define fast
603keyboard access to specific sparse trees. These commands will then be 617keyboard access to specific sparse trees. These commands will then be
604accessible through the agenda dispatcher (@pxref{Agenda dispatcher}). 618accessible through the agenda dispatcher (@pxref{Agenda dispatcher}).
605For example 619For example:
620
606@lisp 621@lisp
607(setq org-agenda-custom-commands 622(setq org-agenda-custom-commands
608 '(("f" occur-tree "FIXME"))) 623 '(("f" occur-tree "FIXME")))
609@end lisp 624@end lisp
625
610@noindent will define the key @kbd{C-c a f} as a shortcut for creating 626@noindent will define the key @kbd{C-c a f} as a shortcut for creating
611a sparse tree matching the string @samp{FIXME}. 627a sparse tree matching the string @samp{FIXME}.
612 628
@@ -621,97 +637,20 @@ To print a sparse tree, you can use the Emacs command
621of the document @footnote{This does not work under XEmacs, because 637of the document @footnote{This does not work under XEmacs, because
622XEmacs uses selective display for outlining, not text properties}. 638XEmacs uses selective display for outlining, not text properties}.
623Or you can use the command @kbd{C-c C-x v} to copy the visible part of 639Or you can use the command @kbd{C-c C-x v} to copy the visible part of
624the document to another file (extension @file{.txt}) which then can be 640the document to another file (extension @file{.txt}) which can then be
625printed in any desired way. 641printed in any desired way.
626 642
627@node Tags, Plain Lists, Sparse trees, Document Structure
628@section Tags
629@cindex tags
630@cindex headline tagging
631@cindex matching, tags
632@cindex sparse tree, tag based
633
634If you wish to implement a tag system to cross-correlate information,
635this can be done as well in Org-mode. Every headline can contain a
636list of tags, at the end of the headline. Tags are normal words
637containing letters, numbers, @samp{_}, and @samp{@@}. Tags must be
638preceded and followed by a single colon; like @samp{:WORK:}. Several
639tags can be specified like @samp{:WORK:URGENT:}.
640
641@cindex inheritance, of tags
642Tags make use of the hierarchical structure of outline trees. If a
643heading has a certain tag, all subheadings will inherit the tag as
644well. For example, in the list
645
646@example
647* Meeting with the French group :WORK:
648** Summary by Frank :BOSS:NOTES:
649*** TODO Prepare slides for him :ACTION:
650@end example
651@noindent
652the final heading will have the tags @samp{:WORK:}, @samp{:BOSS:},
653@samp{:NOTES:}, and @samp{:ACTION:}. When executing tag searches and
654Org-mode finds that a certain headline matches the search criterion,
655it will not check any sublevel headline, assuming that these likely
656also match, and that the list of matches can become very long. You
657can influence inheritance and searching using the variables
658@code{org-use-tag-inheritance} and
659@code{org-tags-match-list-sublevels}.
660
661@kindex M-@key{TAB}
662Tags can simply be typed into the buffer. After a colon,
663@kbd{M-@key{TAB}} offers completion on all tags being used in the
664current buffer. There are also special commands for inserting tags,
665and for executing searches based on tags.
666
667@table @kbd
668@kindex C-c C-c
669@item C-c C-c
670@cindex completion, of tags
671Enter new tags for the current headline. The minibuffer will prompt
672for a list of tags and offer completion with respect to all other tags
673used in the current buffer. Several tags, separated by colons, may be
674specified at the prompt. After pressing @key{RET}, the tags will
675be inserted and aligned to @code{org-tags-column}. When called with a
676@kbd{C-u} prefix, align all tags in the current buffer to that column,
677just to make things look nice. TAGS are automatically realigned after
678promotion, demotion, and TODO state changes (@pxref{TODO basics}).
679@kindex C-c \
680@item C-c \
681Create a sparse tree with all headlines matching a tags search.
682@kindex C-c a m
683@item C-c a m
684Create a global list of tag matches from all agenda files.
685@xref{Matching headline tags}.
686@kindex C-c a M
687@item C-c a M
688Create a global list of tag matches from all agenda files, but check
689only TODO items and force checking subitems (see variable
690@code{org-tags-match-list-sublevels}).
691@end table
692
693A tags search string can use Boolean operators @samp{&} for AND and
694@samp{|} for OR. @samp{&} binds more strongly than
695@samp{|}. Parenthesis are currently no implemented. A tag may also be
696preceded by @samp{-}, to select against it, and @samp{+} is syntactic
697sugar for positive selection. The AND operator @samp{&} is optional
698when @samp{+} or @samp{-} is present. For example, @samp{+WORK-BOSS}
699would select all headlines that are tagged @samp{:WORK:}, but discard
700those also tagged @samp{:BOSS:}. The search string @samp{WORK|LAPTOP}
701selects all lines tagged @samp{:WORK:} or @samp{:LAPTOP:}. The string
702@samp{WORK|LAPTOP&NIGHT} requires that the @samp{:LAPTOP:} lines are
703also tagged @samp{NIGHT}.
704 643
705@node Plain Lists, , Tags, Document Structure 644@node Plain Lists, , Sparse trees, Document Structure
706@section Plain Lists 645@section Plain Lists
707@cindex plain lists 646@cindex plain lists
708@cindex lists, plain 647@cindex lists, plain
709@cindex lists, ordered 648@cindex lists, ordered
710@cindex ordered lists 649@cindex ordered lists
711 650
712Headlines define the structure of the Org-mode file, and also lists 651Headlines define both the structure of the Org-mode file, and also lists
713(for example TODO items (@pxref{TODO items}) should be created using 652(for example, TODO items (@pxref{TODO items}) should be created using
714headline levels. However, when taking notes, the plain text is 653headline levels). However, when taking notes, the plain text is
715sometimes easier to read with hand-formatted lists. Org-mode supports 654sometimes easier to read with hand-formatted lists. Org-mode supports
716editing such lists, and the HTML exporter (@pxref{Exporting}) does 655editing such lists, and the HTML exporter (@pxref{Exporting}) does
717parse and format them. 656parse and format them.
@@ -721,11 +660,11 @@ with @samp{-}, @samp{+}, or @samp{*}@footnote{When using @samp{*} as a
721bullet, lines must be indented or they will be seen as top-level 660bullet, lines must be indented or they will be seen as top-level
722headlines. Also, when you are hiding leading stars to get a clean 661headlines. Also, when you are hiding leading stars to get a clean
723outline view, plain list items starting with a star are visually 662outline view, plain list items starting with a star are visually
724indistinguishable from true headlines. In short: Even though @samp{*} 663indistinguishable from true headlines. In short: even though @samp{*}
725is supported, it may be better to not use it for plain list items} as 664is supported, it may be better to not use it for plain list items} as
726bullets. Ordered list items start with @samp{1.} or @samp{1)}. Items 665bullets. Ordered list items start with @samp{1.} or @samp{1)}. Items
727belonging to the same list must have the same indentation on the first 666belonging to the same list must have the same indentation on the first
728line. In particular, if an ordered list reaches number @samp{10.}, also 667line. In particular, if an ordered list reaches number @samp{10.}, then
729the 2--digit numbers must be written left-aligned with the other numbers 668the 2--digit numbers must be written left-aligned with the other numbers
730in the list. Indentation also determines the end of a list item. It 669in the list. Indentation also determines the end of a list item. It
731ends before the next line that is indented like the bullet/number, or 670ends before the next line that is indented like the bullet/number, or
@@ -792,12 +731,13 @@ Emacs @file{calc} package.
792 731
793@menu 732@menu
794* Built-in table editor:: Simple tables 733* Built-in table editor:: Simple tables
734* Narrow columns:: Stop wasting space in tables
795* Table calculations:: Compute a field from other fields 735* Table calculations:: Compute a field from other fields
796* orgtbl-mode:: The table editor as minor mode 736* orgtbl-mode:: The table editor as minor mode
797* table.el:: Complex tables 737* table.el:: Complex tables
798@end menu 738@end menu
799 739
800@node Built-in table editor, Table calculations, Tables, Tables 740@node Built-in table editor, Narrow columns, Tables, Tables
801@section The built-in table editor 741@section The built-in table editor
802@cindex table editor, builtin 742@cindex table editor, builtin
803 743
@@ -826,6 +766,7 @@ create the above table, you would only type
826|Name|Phone|Age 766|Name|Phone|Age
827|- 767|-
828@end example 768@end example
769
829@noindent and then press @key{TAB} to align the table and start filling in 770@noindent and then press @key{TAB} to align the table and start filling in
830fields. 771fields.
831 772
@@ -840,18 +781,16 @@ unpredictable for you, configure the variables
840 781
841@table @kbd 782@table @kbd
842@tsubheading{Creation and conversion} 783@tsubheading{Creation and conversion}
843@item M-x org-table-create 784@kindex C-c |
844Creates an empty Org-mode table. However, it is much easier to just 785@item C-c |
845start typing, like @kbd{|Name|Phone|Age @key{RET} |- @key{TAB}} 786Convert the active region to table. If every line contains at least one
846 787TAB character, the function assumes that the material is tab separated.
847@kindex C-c C-c 788If not, lines are split at whitespace into fields. You can use a prefix
848@item C-c C-c 789argument to indicate the minimum number of consequtive spaces required
849Convert region to table. Works when the cursor is not in an existing 790to indentify a field separator (default: just one).@*
850table, and when there is a region defined. If every line contains at 791If there is no active region, this command creates an empty Org-mode
851least one TAB character, the function assumes that the material is tab 792table. However, it's easier to just start typing, like
852separated. If not, lines are split at whitespace into fields. You 793@kbd{|Name|Phone|Age @key{RET} |- @key{TAB}}.
853can use a prefix argument to indicate how many consecutive spaces are
854at least required to indicate a field separator (default: just one).
855 794
856@tsubheading{Re-aligning and field motion} 795@tsubheading{Re-aligning and field motion}
857@kindex C-c C-c 796@kindex C-c C-c
@@ -878,7 +817,7 @@ NEWLINE, so it can be used to split a table.
878@kindex M-@key{right} 817@kindex M-@key{right}
879@item M-@key{left} 818@item M-@key{left}
880@itemx M-@key{right} 819@itemx M-@key{right}
881Move the current column left/right 820Move the current column left/right.
882 821
883@kindex M-S-@key{left} 822@kindex M-S-@key{left}
884@item M-S-@key{left} 823@item M-S-@key{left}
@@ -892,7 +831,7 @@ Insert a new column to the left of the cursor position.
892@kindex M-@key{down} 831@kindex M-@key{down}
893@item M-@key{up} 832@item M-@key{up}
894@itemx M-@key{down} 833@itemx M-@key{down}
895Move the current row up/down 834Move the current row up/down.
896 835
897@kindex M-S-@key{up} 836@kindex M-S-@key{up}
898@item M-S-@key{up} 837@item M-S-@key{up}
@@ -940,7 +879,7 @@ prefix ARG may be used to change the number of desired lines. If there
940is no region, the current field is split at the cursor position and the 879is no region, the current field is split at the cursor position and the
941text fragment to the right of the cursor is prepended to the field one 880text fragment to the right of the cursor is prepended to the field one
942line down. If there is no region, but you specify a prefix ARG, the 881line down. If there is no region, but you specify a prefix ARG, the
943current field gets blank, and the content is appended to the field 882current field is made blank, and the content is appended to the field
944above. 883above.
945 884
946@tsubheading{Calculations} 885@tsubheading{Calculations}
@@ -1000,36 +939,87 @@ incremented during copy. This key is also used by CUA-mode
1000(@pxref{Interaction}). 939(@pxref{Interaction}).
1001 940
1002@tsubheading{Miscellaneous} 941@tsubheading{Miscellaneous}
1003@kindex C-c | 942@kindex C-c `
1004@item C-c | 943@item C-c `
1005Toggle the visibility of vertical lines in tables. The lines are 944Edit the current field in a separate window. This is useful for fields
1006still there, only made invisible with a text property. Any @samp{|} 945that are not fully visible (@pxref{Narrow columns}). When called with a
1007added by hand will become invisible on the next align. 946@kbd{C-u} prefix, just make the full field visible, so that it can be
947edited in place.
948
949@kindex C-c @key{TAB}
950@item C-c @key{TAB}
951This is an alias for @kbd{C-u C-c `} to make the current field fully
952visible.
1008 953
1009@item M-x org-table-import 954@item M-x org-table-import
1010Import a file as a table. The table should be TAB- or whitespace 955Import a file as a table. The table should be TAB- or whitespace
1011separated. Useful for example to import an Excel table or data from a 956separated. Useful, for example, to import an Excel table or data from a
1012database, because these programs generally can write TAB-separated text 957database, because these programs generally can write TAB-separated text
1013files. This command works by inserting the file into the buffer and 958files. This command works by inserting the file into the buffer and
1014then converting the region to a table. Any prefix argument is passed on 959then converting the region to a table. Any prefix argument is passed on
1015to the converter, which uses it to determine the separator. 960to the converter, which uses it to determine the separator.
1016 961
1017@item M-x org-table-export 962@item M-x org-table-export
1018Export the table as a TAB-separated file. Useful for data exchange with 963Export the table as a TAB-separated file. Useful for data exchange with,
1019for example Excel or database programs. 964for example, Excel or database programs.
1020 965
1021@end table 966@end table
1022 967
1023If you don't like the automatic table editor because it gets into your 968If you don't like the automatic table editor because it gets in your
1024way in lines which you would like to start with @samp{|}, you can turn 969way on lines which you would like to start with @samp{|}, you can turn
1025it off with 970it off with
971
1026@lisp 972@lisp
1027(setq org-enable-table-editor nil) 973(setq org-enable-table-editor nil)
1028@end lisp 974@end lisp
975
1029@noindent The only table command which then still works is 976@noindent The only table command which then still works is
1030@kbd{C-c C-c} to do a manual re-align. 977@kbd{C-c C-c} to do a manual re-align.
1031 978
1032@node Table calculations, orgtbl-mode, Built-in table editor, Tables 979@node Narrow columns, Table calculations, Built-in table editor, Tables
980@section Narrow columns
981@cindex narrow columns in tables
982
983The width of columns is automatically determined by the table editor.
984Sometimes a single field or a few fields need to carry more text,
985leading to unconveniently wide columns. To limit@footnote{This feature
986does not work on XEmacs.} the width of a column, one field anywhere in
987the column must carry the string @samp{<N>} where @samp{N} is an integer
988specifying the width of the column in characters. The next re-align
989will then set the width of this column to no more than this value.
990
991@example
992|---+------------------------------| |---+--------|
993| | | | | <6> |
994| 1 | one | | 1 | one |
995| 2 | two | ----\ | 2 | two |
996| 3 | This is a long chunk of text | ----/ | 3 | This=> |
997| 4 | four | | 4 | four |
998|---+------------------------------| |---+--------|
999@end example
1000
1001@noindent
1002Fields that are wider become clipped and end in the string @samp{=>}.
1003Note that the full text is still in the buffer, it is only invisible.
1004To see the full text, hold the mouse over the field - a tooltip window
1005will show the full content. To edit such a field, use the command
1006@kbd{C-c `} (that is @kbd{C-c} followed by the backquote). This will
1007open a new window with the full field. Edit it and finish with @kbd{C-c
1008C-c}.
1009
1010When visiting a file containing a table with narrowed columns, the
1011necessary character hiding has not yet happened, and the table needs to
1012be aligned before it looks nice. Setting the option
1013@code{org-startup-align-all-tables} will realign all tables in a file
1014upon visiting, but also slow down startup. You can also set this option
1015on a per-file basis with:
1016
1017@example
1018#+STARTUP: align
1019#+STARTUP: noalign
1020@end example
1021
1022@node Table calculations, orgtbl-mode, Narrow columns, Tables
1033@section Calculations in tables 1023@section Calculations in tables
1034@cindex calculations, in tables 1024@cindex calculations, in tables
1035@cindex spreadsheet capabilities 1025@cindex spreadsheet capabilities
@@ -1062,9 +1052,9 @@ recalculation can be automated.
1062 1052
1063A formula can be any algebraic expression understood by the Emacs 1053A formula can be any algebraic expression understood by the Emacs
1064@file{calc} package. Note that @file{calc} has the slightly 1054@file{calc} package. Note that @file{calc} has the slightly
1065non-standard conversion that @samp{/} has lower precedence than 1055non-standard convention that @samp{/} has lower precedence than
1066@samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}. Before 1056@samp{*}, so that @samp{a/b*c} is interpreted as @samp{a/(b*c)}. Before
1067evaluation by @code{calc-eval} (@pxref{Calling Calc from Your 1057evaluation by @code{calc-eval} (@pxref{Calling Calc from Your Lisp
1068Programs,calc-eval,Calling calc from Your Lisp Programs,calc,GNU Emacs 1058Programs,calc-eval,Calling calc from Your Lisp Programs,calc,GNU Emacs
1069Calc Manual}), variable substitution takes place: 1059Calc Manual}), variable substitution takes place:
1070 1060
@@ -1091,7 +1081,7 @@ constant. Constants are defined globally through the variable
1091@code{org-table-formula-constants}. If you have the 1081@code{org-table-formula-constants}. If you have the
1092@file{constants.el} package, it will also be used to resolve 1082@file{constants.el} package, it will also be used to resolve
1093constants, including natural constants like @samp{$h} for Planck's 1083constants, including natural constants like @samp{$h} for Planck's
1094constant, units like @samp{$km} for kilometers. Column names and 1084constant, and units like @samp{$km} for kilometers. Column names and
1095parameters can be specified in special table lines. These are 1085parameters can be specified in special table lines. These are
1096described below, see @ref{Advanced features}. 1086described below, see @ref{Advanced features}.
1097 1087
@@ -1106,10 +1096,11 @@ The default settings can be configured using the variable
1106@code{org-calc-default-modes}.} during execution, e.g. @samp{p20} to 1096@code{org-calc-default-modes}.} during execution, e.g. @samp{p20} to
1107switch the internal precision to 20 digits, @samp{n3}, @samp{s3}, 1097switch the internal precision to 20 digits, @samp{n3}, @samp{s3},
1108@samp{e2} or @samp{f4} to switch to normal, scientific, engineering, 1098@samp{e2} or @samp{f4} to switch to normal, scientific, engineering,
1109or fix display format, respectively, and @samp{D}, @samp{R}, @samp{F}, 1099or fixed display format, respectively, and @samp{D}, @samp{R}, @samp{F},
1110and @samp{S} to turn on degrees, radians, fraction and symbolic modes, 1100and @samp{S} to turn on degrees, radians, fraction and symbolic modes,
1111respectively. In addition, you may provide a @code{printf} format 1101respectively. In addition, you may provide a @code{printf} format
1112specifier to reformat the final result. A few examples: 1102specifier to reformat the final result. A few examples:
1103
1113@example 1104@example
1114 $1+$2 @r{Sum of first and second field} 1105 $1+$2 @r{Sum of first and second field}
1115 $1+$2;%.2f @r{Same, format result to two decimals} 1106 $1+$2;%.2f @r{Same, format result to two decimals}
@@ -1120,7 +1111,7 @@ specifier to reformat the final result. A few examples:
1120 tan($1);Dp3s1 @r{Compute in degrees, precision 3, display SCI 1} 1111 tan($1);Dp3s1 @r{Compute in degrees, precision 3, display SCI 1}
1121 sin($1);Dp3%.1e @r{Same, but use printf specifier for display} 1112 sin($1);Dp3%.1e @r{Same, but use printf specifier for display}
1122 vmean($2..$7) @r{Compute column range mean, using vector function} 1113 vmean($2..$7) @r{Compute column range mean, using vector function}
1123 vsum(&III) @r{Sum numbers from 3rd hline above to here} 1114 vsum(&III) @r{Sum numbers from 3rd hline above, up to here}
1124 taylor($3,x=7,2) @r{taylor series of $3, at x=7, second degree} 1115 taylor($3,x=7,2) @r{taylor series of $3, at x=7, second degree}
1125@end example 1116@end example
1126 1117
@@ -1164,12 +1155,13 @@ header.
1164@node Advanced features, Named-field formulas, Column formulas, Table calculations 1155@node Advanced features, Named-field formulas, Column formulas, Table calculations
1165@subsection Advanced features 1156@subsection Advanced features
1166 1157
1167If you want want the recalculation of fields to happen automatically, 1158If you want the recalculation of fields to happen automatically,
1168or if you want to be able to assign a formula to an individual field 1159or if you want to be able to assign a formula to an individual field
1169(instead of an entire column) you need to reserve the first column of 1160(instead of an entire column) you need to reserve the first column of
1170the table for special marking characters. Here is an example of a 1161the table for special marking characters. Here is an example of a
1171table that collects exam results of students and makes use of these 1162table that collects exam results of students and makes use of these
1172features: 1163features:
1164
1173@example 1165@example
1174@group 1166@group
1175|---+---------+--------+--------+--------+-------+------| 1167|---+---------+--------+--------+--------+-------+------|
@@ -1192,7 +1184,7 @@ features:
1192@end example 1184@end example
1193 1185
1194@noindent @b{Important}: Please note that for these special tables, 1186@noindent @b{Important}: Please note that for these special tables,
1195recalculating the table with @kbd{C-u C-c *} does only affect rows 1187recalculating the table with @kbd{C-u C-c *} will only affect rows
1196which are marked @samp{#} or @samp{*}, and named fields. The column 1188which are marked @samp{#} or @samp{*}, and named fields. The column
1197formulas are not applied in rows with empty first field. 1189formulas are not applied in rows with empty first field.
1198 1190
@@ -1209,7 +1201,7 @@ the value @samp{10}. Also, named fields can have their own formula
1209associated with them. 1201associated with them.
1210@item _ 1202@item _
1211Similar to @samp{^}, but defines names for the fields in the row 1203Similar to @samp{^}, but defines names for the fields in the row
1212@emph{below}. 1204@emph{below}.
1213@item $ 1205@item $
1214Fields in this row can define @emph{parameters} for formulas. For 1206Fields in this row can define @emph{parameters} for formulas. For
1215example, if a field in a @samp{$} row contains @samp{max=50}, then 1207example, if a field in a @samp{$} row contains @samp{max=50}, then
@@ -1226,8 +1218,8 @@ lines will be left alone by this command.
1226Selects this line for global recalculation with @kbd{C-u C-c *}, but 1218Selects this line for global recalculation with @kbd{C-u C-c *}, but
1227not for automatic recalculation. Use this when automatic 1219not for automatic recalculation. Use this when automatic
1228recalculation slows down editing too much. 1220recalculation slows down editing too much.
1229@item 1221@item
1230Unmarked lines are exempted from recalculation with @kbd{C-u C-c *}. 1222Unmarked lines are exempt from recalculation with @kbd{C-u C-c *}.
1231All lines that should be recalculated should be marked with @samp{#} 1223All lines that should be recalculated should be marked with @samp{#}
1232or @samp{*}. 1224or @samp{*}.
1233@end table 1225@end table
@@ -1240,7 +1232,7 @@ or @samp{*}.
1240A named field can have its own formula associated with it. In the 1232A named field can have its own formula associated with it. In the
1241example above, this is used for the @samp{at} field that contains 1233example above, this is used for the @samp{at} field that contains
1242the average result of the students. To enter a formula for a named 1234the average result of the students. To enter a formula for a named
1243field, just type it onto the buffer, preceded by @samp{:=}. Or use 1235field, just type it into the buffer, preceded by @samp{:=}. Or use
1244@kbd{C-u C-c =}. This equation will be stored below the table like 1236@kbd{C-u C-c =}. This equation will be stored below the table like
1245@samp{$name=...}. Any recalculation in the table (even if only 1237@samp{$name=...}. Any recalculation in the table (even if only
1246requested for the current line) will also update all named field 1238requested for the current line) will also update all named field
@@ -1251,9 +1243,9 @@ formulas.
1251@cindex formula editing 1243@cindex formula editing
1252@cindex editing, of table formulas 1244@cindex editing, of table formulas
1253 1245
1254To edit a column or field formula, you can use the commands @kbd{C-c 1246To edit a column or field formula, use the commands @kbd{C-c
1255=} and @kbd{C-u C-c =}, respectively. The currently active expression 1247=} and @kbd{C-u C-c =}, respectively. The currently active expression
1256is then presented as default in the minibuffer, were it may be edited. 1248is then presented as default in the minibuffer, where it may be edited.
1257 1249
1258Note that making a table field blank does not remove the formula 1250Note that making a table field blank does not remove the formula
1259associated with the field - during the next recalculation the field 1251associated with the field - during the next recalculation the field
@@ -1264,7 +1256,7 @@ give an empty reply when prompted for the formula, or to edit the
1264@kindex C-c C-c 1256@kindex C-c C-c
1265You may edit the @samp{#+TBLFM} directly and re-apply 1257You may edit the @samp{#+TBLFM} directly and re-apply
1266the changed equations with @kbd{C-c C-c} in that line, or with the 1258the changed equations with @kbd{C-c C-c} in that line, or with the
1267normal recalculation commands in the table. 1259normal recalculation commands in the table.
1268 1260
1269@kindex C-c ' 1261@kindex C-c '
1270@kindex C-c C-c 1262@kindex C-c C-c
@@ -1283,8 +1275,8 @@ installing the changes.
1283When the evaluation of a formula leads to an error, the field content 1275When the evaluation of a formula leads to an error, the field content
1284becomes the string @samp{#ERROR}. If you would like see what is going 1276becomes the string @samp{#ERROR}. If you would like see what is going
1285on during variable substitution and calculation in order to find a 1277on during variable substitution and calculation in order to find a
1286bug, turn on formula debugging in the menu and repeat the calculation 1278bug, turn on formula debugging in the menu and repeat the calculation,
1287by pressing, for example by pressing @kbd{C-c = @key{RET}} in a field. 1279for example by pressing @kbd{C-c = @key{RET}} in a field.
1288Detailed information will be displayed. 1280Detailed information will be displayed.
1289 1281
1290@node Appetizer, , Editing/debugging formulas, Table calculations 1282@node Appetizer, , Editing/debugging formulas, Table calculations
@@ -1320,6 +1312,7 @@ might want to use it also in other modes like text-mode or mail-mode.
1320The minor mode Orgtbl-mode makes this possible. You can always toggle 1312The minor mode Orgtbl-mode makes this possible. You can always toggle
1321the mode with @kbd{M-x orgtbl-mode}. To turn it on by default, for 1313the mode with @kbd{M-x orgtbl-mode}. To turn it on by default, for
1322example in mail mode, use 1314example in mail mode, use
1315
1323@lisp 1316@lisp
1324(add-hook 'mail-mode-hook 'turn-on-orgtbl) 1317(add-hook 'mail-mode-hook 'turn-on-orgtbl)
1325@end lisp 1318@end lisp
@@ -1362,46 +1355,81 @@ Just like HMTL, Org-mode provides links inside a file, and external
1362links to other files, Usenet articles, emails and much more. 1355links to other files, Usenet articles, emails and much more.
1363 1356
1364@menu 1357@menu
1365* Internal Links:: Links to other places in the current file 1358* Link format:: How links in Org-mode are formatted
1366* External Links:: URL-like links to the world 1359* Internal links:: Links to other places in the current file
1360* External links:: URL-like links to the world
1367* Managing links:: Creating, inserting and following 1361* Managing links:: Creating, inserting and following
1368* Search Options:: Linking to a specific location 1362* Search Options:: Linking to a specific location
1369* Remember:: Org-trees store quick notes 1363* Remember:: Org-trees store quick notes
1370@end menu 1364@end menu
1371 1365
1372@node Internal Links, External Links, Hyperlinks, Hyperlinks 1366@node Link format, Internal links, Hyperlinks, Hyperlinks
1373@section Internal Links 1367@section Link format
1368@cindex link format
1369@cindex format, of links
1370
1371Org-mode will recognize plain URL-like links and activate them as
1372clickable links. However, the general link format looks like this:
1373
1374@example
1375[[link][description]] @r{or alternatively} [[link]]
1376@end example
1377
1378Once a link in the buffer is complete (all brackets present), Org-mode
1379will change the display so that @samp{description} is displayed instead
1380of @samp{[[link][description]]} and @samp{link} is displayed instead of
1381@samp{[[link]]}. Links will be highlighted in the face @code{org-link},
1382which by default is an underlined face. You can directly edit the
1383visible part of a link. Note that this can be either the @samp{link}
1384part (if there is not description) or the @samp{description} part. To
1385edit also the invisible @samp{link} part, use @kbd{C-c C-l} with the
1386cursor on the link.
1387
1388If you place the cursor at the beginning or just behind the end of the
1389displayed text and press @key{BACKSPACE}, you will remove the
1390(invisible) bracket at that location. This makes the link incomplete
1391and the internals are again displayed as plain text. Inserting the
1392missing bracket does hide the link internals again. To show the
1393internal structure of all links, use the menu entry
1394@code{Org->Hyperlinks->Literal links}.
1395
1396@node Internal links, External links, Link format, Hyperlinks
1397@section Internal links
1374@cindex internal links 1398@cindex internal links
1375@cindex links, internal 1399@cindex links, internal
1376@cindex CamelCase links 1400@cindex CamelCase links
1377 1401
1378Strings inside double brackets like @samp{[[My Target]]} are links 1402If the link text does not look like a URL, links are considered to be
1379that lead to a text search in the current file. The link can be 1403internal in the current file. Links such as @samp{[[My Target]]} or
1380followed with @kbd{C-c C-o} or with a mouse click (@pxref{Managing 1404@samp{[[My Target][Find my target]]} lead to a text search in the
1381links}). The preferred match for such a link is a dedicated target: 1405current file. The link can be followed with @kbd{C-c C-o} when the
1382The same string in double angular brackets. Targets may be located 1406cursor is on the link, or with a mouse click (@pxref{Managing links}).
1383anywhere, often it is convenient to put them into a comment line, for 1407The preferred match for such a link is a dedicated target: The same
1384example 1408string in double angular brackets. Targets may be located anywhere,
1409often it is convenient to put them into a comment line, for example
1410
1385@example 1411@example
1386# <<My Target>> 1412# <<My Target>>
1387@end example 1413@end example
1388 1414
1389If no dedicated target exists, Org-mode will search for the words in 1415If no dedicated target exists, Org-mode will search for the words in the
1390the link, in the above example for @samp{my target}. Links starting 1416link, often removing the need for a dedicated target. In the above
1391with a star like @samp{*My Target} restrict the search to headlines. 1417example the search would be for @samp{my target}. Links starting with a
1392When searching, Org-mode will first try an exact match, but then move 1418star like @samp{*My Target} restrict the search to headlines. When
1393on to more and more lenient searches. For example, the link 1419searching, Org-mode will first try an exact match, but then move on to
1394@samp{[[*My Targets]]} will find any of the following 1420more and more lenient searches. For example, the link @samp{[[*My
1421Targets]]} will find any of the following:
1422
1395@example 1423@example
1396** My targets 1424** My targets
1397** TODO my targets are bright 1425** TODO my targets are bright
1398** my 20 targets are 1426** my 20 targets are
1399@end example 1427@end example
1400It is therefore often not necessary to set a dedicated target. To 1428
1401insert a link targeting a headline, in-buffer completion can be used. 1429To insert a link targeting a headline, in-buffer completion can be used.
1402Just type a star followed by a few optional letters into the buffer 1430Just type a star followed by a few optional letters into the buffer and
1403and press @kbd{M-@key{TAB}}. All headlines in the current buffer will 1431press @kbd{M-@key{TAB}}. All headlines in the current buffer will be
1404be offered as completions. @xref{Managing links}, for more commands 1432offered as completions. @xref{Managing links}, for more commands
1405creating links. 1433creating links.
1406 1434
1407Following a link pushes a mark onto Org-mode's own mark ring. You can 1435Following a link pushes a mark onto Org-mode's own mark ring. You can
@@ -1414,7 +1442,7 @@ earlier.
1414* CamelCase links:: Activating CamelCase words as links 1442* CamelCase links:: Activating CamelCase words as links
1415@end menu 1443@end menu
1416 1444
1417@node Radio targets, CamelCase links, Internal Links, Internal Links 1445@node Radio targets, CamelCase links, Internal links, Internal links
1418@subsection Radio targets 1446@subsection Radio targets
1419 1447
1420You can configure Org-mode to link any occurrences of certain target 1448You can configure Org-mode to link any occurrences of certain target
@@ -1427,24 +1455,20 @@ scanned automatically for radio targets only when the file is first
1427loaded into Emacs. To update the target list during editing, press 1455loaded into Emacs. To update the target list during editing, press
1428@kbd{C-c C-c} with the cursor on or at a target. 1456@kbd{C-c C-c} with the cursor on or at a target.
1429 1457
1430@node CamelCase links, , Radio targets, Internal Links 1458@node CamelCase links, , Radio targets, Internal links
1431@subsection CamelCase words as links 1459@subsection CamelCase words as links
1432@cindex completion, of CamelCase links 1460@cindex completion, of CamelCase links
1433@cindex CamelCase links, completion of 1461@cindex CamelCase links, completion of
1434 1462
1435As an alternative to @samp{[[...]]} links, Org-mode also supports 1463Org-mode also supports CamelCase words as links. This feature is not
1436CamelCase words as links. This feature is not turned on by default 1464turned on by default because of the inconsistencies this system suffers
1437because of the occasional inconsistencies this system suffers from. 1465from. To activate CamelCase words as links, you need to customize
1438To activate CamelCase words as links, and to make headline completion 1466the option @code{org-activate-links}. A CamelCase word then leads to a
1439offer CamelCase version of headlines, the following customization is 1467text search such that @samp{CamelCaseLink} is equivalent to
1440needed: 1468@samp{[[camel case link]]}.
1441@lisp
1442(setq org-activate-camels t
1443 org-file-link-context-use-camel-case t)
1444@end lisp
1445 1469
1446@node External Links, Managing links, Internal Links, Hyperlinks 1470@node External links, Managing links, Internal links, Hyperlinks
1447@section External Links 1471@section External links
1448@cindex links, external 1472@cindex links, external
1449@cindex external links 1473@cindex external links
1450@cindex links, external 1474@cindex links, external
@@ -1460,39 +1484,46 @@ needed:
1460@cindex SHELL links 1484@cindex SHELL links
1461 1485
1462Org-mode supports links to files, websites, Usenet and email messages; 1486Org-mode supports links to files, websites, Usenet and email messages;
1463and BBDB database entries. Links are just plain-text URL-like 1487and BBDB database entries. External links are URL-like locators. The
1464locators, optionally enclosed by angular brackets. The following list 1488following list shows examples for each link type.
1465shows examples for each link type.
1466 1489
1467@example 1490@example
1468<http://www.astro.uva.nl/~dominik> @r{on the web} 1491http://www.astro.uva.nl/~dominik @r{on the web}
1469<file:/home/dominik/images/jupiter.jpg> @r{file, absolute path} 1492file:/home/dominik/images/jupiter.jpg @r{file, absolute path}
1470<file:papers/last.pdf> @r{file, relative path} 1493file:papers/last.pdf @r{file, relative path}
1471<news:comp.emacs> @r{Usenet link} 1494news:comp.emacs @r{Usenet link}
1472<mailto:adent@@galaxy.net> @r{Mail link} 1495mailto:adent@@galaxy.net @r{Mail link}
1473<vm:folder> @r{VM folder link} 1496vm:folder @r{VM folder link}
1474<vm:folder#id> @r{VM message link} 1497vm:folder#id @r{VM message link}
1475<vm://myself@@some.where.org/folder#id> @r{VM on remote machine} 1498vm://myself@@some.where.org/folder#id @r{VM on remote machine}
1476<wl:folder> @r{WANDERLUST folder link} 1499wl:folder @r{WANDERLUST folder link}
1477<wl:folder#id> @r{WANDERLUST message link} 1500wl:folder#id @r{WANDERLUST message link}
1478<mhe:folder> @r{MH-E folder link} 1501mhe:folder @r{MH-E folder link}
1479<mhe:folder#id> @r{MH-E message link} 1502mhe:folder#id @r{MH-E message link}
1480<rmail:folder> @r{RMAIL folder link} 1503rmail:folder @r{RMAIL folder link}
1481<rmail:folder#id> @r{RMAIL message link} 1504rmail:folder#id @r{RMAIL message link}
1482<gnus:group> @r{GNUS group link} 1505gnus:group @r{GNUS group link}
1483<gnus:group#id> @r{GNUS article link} 1506gnus:group#id @r{GNUS article link}
1484<bbdb:Richard Stallman> @r{BBDB link} 1507bbdb:Richard Stallman @r{BBDB link}
1485<shell:ls *.org>@footnote{Note that @samp{<} and @samp{>} cannot be part of a link, and therefore of a shell command. If you need redirection, use @@@{ and @@@} instead.} @r{A shell command} 1508shell:ls *.org @r{A shell command}
1486@end example 1509@end example
1487 1510
1488A link may contain space characters and is terminated by @samp{>} or by 1511A link should be enclosed in double brackets and may contain a
1489the end of a line. In tables, the end of a table field also terminates 1512descriptive text to be displayed instead of the url (@pxref{Link
1490a link. Angle brackets around a link are not required, but are 1513format}), for example:
1491recommended to avoid problems with punctuation and other text following 1514
1492the link. See also the variable @code{org-allow-space-in-links}. 1515@example
1516[[http://www.gnu.org/software/emacs/][GNU Emacs]]
1517@end example
1493 1518
1519@cindex angular brackets, around links
1520@cindex plain text external links
1521Org-mode also finds external links in the normal text and activates them
1522as links. If spaces must be part of the link (for example in
1523@samp{bbdb:Richard Stallman}) or to remove ambiguities about the end of
1524the link, enclose them in angular brackets.
1494 1525
1495@node Managing links, Search Options, External Links, Hyperlinks 1526@node Managing links, Search Options, External links, Hyperlinks
1496@section Managing links 1527@section Managing links
1497 1528
1498Org-mode provides methods to create a link in the correct syntax, to 1529Org-mode provides methods to create a link in the correct syntax, to
@@ -1504,53 +1535,63 @@ insert it into an org-mode file, and to follow the link.
1504@item C-c l 1535@item C-c l
1505Store a link to the current location. This is a @emph{global} command 1536Store a link to the current location. This is a @emph{global} command
1506which can be used in any buffer to create a link. The link will be 1537which can be used in any buffer to create a link. The link will be
1507stored for later insertion into an Org-mode buffer (see below). For 1538stored for later insertion into an Org-mode buffer (see below). For VM,
1508VM, RMAIL, WANDERLUST, GNUS and BBDB buffers, the link will point to 1539RMAIL, WANDERLUST, MH-E, GNUS and BBDB buffers, the link will point to
1509the current article/entry. For W3 and W3M buffer, the link goes to 1540the current article/entry. For W3 and W3M buffers, the link goes to the
1510the current URL. For Org-mode files, the current headline is 1541current URL. For Org-mode files, the current headline is targeted. For
1511targeted. For any other files, the link will point to the file, with 1542any other files, the link will point to the file, with a search string
1512a search string (@pxref{Search Options}) pointing to the 1543(@pxref{Search Options}) pointing to the contents of the current line.
1513contents of the current line. If there is an active region, the 1544If there is an active region, the selected words will form the basis of
1514selected words will form the basis of the search string. The key 1545the search string. The key binding @kbd{C-c l} is only a suggestion -
1515binding @kbd{C-c l} is only a suggestion - see @ref{Installation and 1546see @ref{Installation and activation}.
1516Activation}.
1517 1547
1518@kindex C-c C-l 1548@kindex C-c C-l
1519@cindex link completion 1549@cindex link completion
1520@cindex file name completion
1521@cindex completion, of links 1550@cindex completion, of links
1522@cindex completion, of file names
1523@cindex inserting links 1551@cindex inserting links
1524@item C-c C-l 1552@item C-c C-l
1525Insert a link. This prompts for a link to be inserted into the 1553Insert a link. This prompts for a link to be inserted into the buffer.
1526buffer. You can just type a link, using one of the link type prefixes 1554You can just type a link, using text for an internal link, or one of the
1527mentioned in the examples above. Through completion, all links stored 1555link type prefixes mentioned in the examples above. Through completion,
1528during the current session can be accessed. When called with prefix 1556all links stored during the current session can be accessed. The link
1529arg, you can use file name completion to enter a file link. The link
1530will be formatted as given in the variable @code{org-link-format} and 1557will be formatted as given in the variable @code{org-link-format} and
1531inserted into the buffer. Note that you don't have to use this 1558inserted into the buffer, along with a descriptive text. Note that you
1532command to insert a link. Links in Org-mode are plain text, and you 1559don't have to use this command to insert a link. Links in Org-mode are
1533can type or paste them straight into the buffer. 1560plain text, and you can type or paste them straight into the buffer.
1561By using this command, the links are automatically enclosed in double
1562brackets, and you will be asked for the optional descriptive text.
1563
1564@kindex C-u C-c C-l
1565@cindex file name completion
1566@cindex completion, of file names
1567@item C-u C-c C-l
1568When @kbd{C-c C-l} is called with a @kbd{C-u} prefix argument, a link to
1569a file will be inserted and you may use file name completion to select
1570the name of the file. The path to the file is inserted relative to the
1571directory of the current org file, if the linked file is in the current
1572directory or in a subdirectory of it. Otherwise an absolute path, if
1573possible with @samp{~/} for your home directory is used. You can force
1574an absolute path with two @kbd{C-u} prefixes.
1575
1576@item C-c C-l @r{with cursor on existing link}
1577When the cursor is on an existing link, @kbd{C-c C-l} allows to edit the
1578link and description parts of the link.
1534 1579
1535@cindex following links 1580@cindex following links
1536@kindex C-c C-o 1581@kindex C-c C-o
1537@item C-c C-o 1582@item C-c C-o
1538Open link at point. This will launch a web browser for URLs (using 1583Open link at point. This will launch a web browser for URLs (using
1539@command{browse-url-at-point}), run vm/gnus/bbdb for the corresponding 1584@command{browse-url-at-point}), run vm/mh-e/wanderlust/rmail/gnus/bbdb
1540links, and execute the command in a shell link. When the cursor is on 1585for the corresponding links, and execute the command in a shell link.
1541a CamelCase link, this commands runs the corresponding search. When 1586When the cursor is on an internal link, this commands runs the
1542the cursor is on a TAGS list in a headline, it creates the 1587corresponding search. When the cursor is on a TAGS list in a headline,
1543corresponding TAGS view. Furthermore, it will visit text files in 1588it creates the corresponding TAGS view. If the cursor is on a time
1544@samp{file:} links with Emacs and select a suitable application for 1589stamp, it compiles the agenda for that date. Furthermore, it will visit
1545non-text files. Classification of files is based on file extension 1590text files in @samp{file:} links with Emacs and select a suitable
1546only. See option @code{org-file-apps}. If there is no link at point, 1591application for non-text files. Classification of files is based on
1547the current subtree will be searched for one. If you want to override 1592file extension only. See option @code{org-file-apps}. If you want to
1548the default application and visit the file with Emacs, use a @kbd{C-u} 1593override the default application and visit the file with Emacs, use a
1549prefix. If the cursor is on a time stamp, compiles the agenda for 1594@kbd{C-u} prefix.
1550that date.
1551
1552@strong{IMPORTANT}: Be careful not to use any dangerous commands in a
1553shell link.
1554 1595
1555@kindex mouse-2 1596@kindex mouse-2
1556@kindex mouse-1 1597@kindex mouse-1
@@ -1589,12 +1630,14 @@ particular location in the file when following a link. This can be a
1589line number or a search option after a double@footnote{For backward 1630line number or a search option after a double@footnote{For backward
1590compatibility, line numbers can also follow a single colon.} colon. 1631compatibility, line numbers can also follow a single colon.} colon.
1591For example: 1632For example:
1633
1592@example 1634@example
1593<file:~/code/main.c::255> 1635[[file:~/code/main.c::255]]
1594<file:~/xx.org::My Target> 1636[[file:~/xx.org::My Target]]
1595<file:~/xx.org::*My Target> 1637[[file:~/xx.org::*My Target]]
1596<file:~/xx.org::/regexp/> 1638[[file:~/xx.org::/regexp/]]
1597@end example 1639@end example
1640
1598@noindent Here is what these options do. 1641@noindent Here is what these options do.
1599 1642
1600@table @code 1643@table @code
@@ -1603,7 +1646,7 @@ Jump to line 255.
1603@item My Target 1646@item My Target
1604Search for a link target @samp{<<My Target>>}, or do a text search for 1647Search for a link target @samp{<<My Target>>}, or do a text search for
1605@samp{my target}, similar to the search in internal links, see 1648@samp{my target}, similar to the search in internal links, see
1606@ref{Internal Links}. 1649@ref{Internal links}.
1607@item *My Target 1650@item *My Target
1608In an Org-mode file, restrict search to headlines. 1651In an Org-mode file, restrict search to headlines.
1609@item /regexp/ 1652@item /regexp/
@@ -1632,29 +1675,65 @@ information. The notes produced by @emph{Remember} can be stored in
1632different ways, and Org-mode files are a good target. Org-mode allows 1675different ways, and Org-mode files are a good target. Org-mode allows
1633to file away notes either to a default file, or directly to the 1676to file away notes either to a default file, or directly to the
1634correct location in your Org-mode outline tree. The following 1677correct location in your Org-mode outline tree. The following
1635customization@footnote{The two autoload forms are only necessary if 1678customization@footnote{The three autoload forms are only necessary if
1636@file{org.el} is not part of the Emacs distribution or an XEmacs 1679@file{org.el} is not part of the Emacs distribution or an XEmacs
1637package.} will tell @emph{Remember} to use org files as target, and to 1680package.} will tell @emph{Remember} to use org files as target, and to
1638create annotations compatible with Org-mode links. 1681create annotations compatible with Org-mode links.
1639 1682
1640@example 1683@example
1641(autoload 'org-remember-annotation "org")
1642(autoload 'org-remember-handler "org")
1643(setq org-directory "~/path/to/my/orgfiles/") 1684(setq org-directory "~/path/to/my/orgfiles/")
1644(setq org-default-notes-file "~/.notes") 1685(setq org-default-notes-file "~/.notes")
1686(autoload 'org-remember-annotation "org")
1687(autoload 'org-remember-apply-template "org")
1688(autoload 'org-remember-handler "org")
1645(setq remember-annotation-functions '(org-remember-annotation)) 1689(setq remember-annotation-functions '(org-remember-annotation))
1646(setq remember-handler-functions '(org-remember-handler)) 1690(setq remember-handler-functions '(org-remember-handler))
1691(add-hook 'remember-mode-hook 'org-remember-apply-template)
1692@end example
1693
1694@cindex templates, for remember
1695In combination with Org-mode, you can use templates to generate
1696different types of remember notes. For example, if you would like to
1697use one template to create general TODO entries, and another one for
1698journal entries, you could use:
1699
1700@example
1701(setq org-remember-templates
1702 '((?t "* TODO %?\n %i\n %a" "~/org/TODO.org")
1703 (?j "* %U %?\n\n %i\n %a" "~/org/JOURNAL.org")))
1647@end example 1704@end example
1648 1705
1649When you compose a note with remember, you have to press @kbd{C-c C-c} 1706@noindent In these entries, the character specifies how to select the
1650to exit remember-mode and to file away the note. The handler first 1707template, the first string specifies the template, and the (optional)
1651prompts for a target file - if you press @key{RET}, the value of 1708second string specifies a default file (overruling
1709@code{org-default-notes-file}) as a target for this note.
1710
1711When you call @kbd{M-x remember} to remember something, org will prompt
1712for a key to select the template and then prepare the buffer like
1713@example
1714* TODO
1715 <file:link to where you called remember>
1716@end example
1717
1718@noindent or
1719
1720@example
1721* [2006-03-21 Tue 15:37]
1722
1723 <file:link to where you called remember>
1724@end example
1725
1726@noindent See the variable @code{org-remember-templates} for more details.
1727
1728When you are finished composing a note with remember, you have to press
1729@kbd{C-c C-c} to file the note away. The handler first prompts for a
1730target file - if you press @key{RET}, the value of
1652@code{org-default-notes-file} is used. Then the command offers the 1731@code{org-default-notes-file} is used. Then the command offers the
1653headings tree of the selected file. You can either immediately press 1732headings tree of the selected file. You can either immediately press
1654@key{RET} to get the note appended to the file. Or you can use 1733@key{RET} to get the note appended to the file. Or you can use vertical
1655vertical cursor motion (@key{up} and @key{down}) and visibility 1734cursor motion (@key{up} and @key{down}) and visibility cycling
1656cycling (@key{TAB}) to find a better place. Pressing @key{RET} or 1735(@key{TAB}) to find a better place. Pressing @key{RET} or @key{left} or
1657@key{left} or @key{right} leads to the following result. 1736@key{right} leads to the following result.
1658 1737
1659@multitable @columnfractions 0.2 0.1 0.7 1738@multitable @columnfractions 0.2 0.1 0.7
1660@item @b{Cursor position} @tab @b{Key} @tab @b{Note gets inserted} 1739@item @b{Cursor position} @tab @b{Key} @tab @b{Note gets inserted}
@@ -1680,6 +1759,7 @@ additional data. If the variable @code{org-adapt-indentation} is
1680non-nil, the entire text is also indented so that it starts in the 1759non-nil, the entire text is also indented so that it starts in the
1681same column as the headline (after the asterisks). 1760same column as the headline (after the asterisks).
1682 1761
1762
1683@node TODO items, Timestamps, Hyperlinks, Top 1763@node TODO items, Timestamps, Hyperlinks, Top
1684@chapter TODO items 1764@chapter TODO items
1685@cindex TODO items 1765@cindex TODO items
@@ -1697,16 +1777,16 @@ things you have to do.
1697 1777
1698@menu 1778@menu
1699* TODO basics:: Marking and displaying TODO entries 1779* TODO basics:: Marking and displaying TODO entries
1700* Progress Logging:: Document your productivity 1780* Progress logging:: Document your productivity
1701* TODO extensions:: Workflow and assignments 1781* TODO extensions:: Workflow and assignments
1702* Priorities:: Some things are more important than others 1782* Priorities:: Some things are more important than others
1703@end menu 1783@end menu
1704 1784
1705@node TODO basics, Progress Logging, TODO items, TODO items 1785@node TODO basics, Progress logging, TODO items, TODO items
1706@section Basic TODO functionality 1786@section Basic TODO functionality
1707 1787
1708Any headline can become a TODO item by starting it with the word TODO, 1788Any headline can become a TODO item by starting it with the word TODO,
1709for example 1789for example:
1710 1790
1711@example 1791@example
1712*** TODO Write letter to Sam Fortune 1792*** TODO Write letter to Sam Fortune
@@ -1720,10 +1800,12 @@ The most important commands to work with TODO entries are:
1720@cindex cycling, of TODO states 1800@cindex cycling, of TODO states
1721@item C-c C-t 1801@item C-c C-t
1722Rotate the TODO state of the current item between 1802Rotate the TODO state of the current item between
1803
1723@example 1804@example
1724,-> (unmarked) -> TODO -> DONE --. 1805,-> (unmarked) -> TODO -> DONE --.
1725'--------------------------------' 1806'--------------------------------'
1726@end example 1807@end example
1808
1727The same rotation can also be done ``remotely'' from the timeline and 1809The same rotation can also be done ``remotely'' from the timeline and
1728agenda buffers with the @kbd{t} command key (@pxref{Agenda commands}). 1810agenda buffers with the @kbd{t} command key (@pxref{Agenda commands}).
1729@kindex C-c C-v 1811@kindex C-c C-v
@@ -1746,15 +1828,17 @@ If you would like to have all your TODO items listed as part of your
1746agenda, customize the variable @code{org-agenda-include-all-todo}. 1828agenda, customize the variable @code{org-agenda-include-all-todo}.
1747@end table 1829@end table
1748 1830
1749@node Progress Logging, TODO extensions, TODO basics, TODO items 1831@node Progress logging, TODO extensions, TODO basics, TODO items
1750@section Progress Logging 1832@section Progress Logging
1751@cindex progress logging 1833@cindex progress logging
1752@cindex logging, of progress 1834@cindex logging, of progress
1753If you want to keep track of @emph{when} a certain TODO item was 1835If you want to keep track of @emph{when} a certain TODO item was
1754finished, turn on logging with 1836finished, turn on logging with
1837
1755@lisp 1838@lisp
1756(setq org-log-done t) 1839(setq org-log-done t)
1757@end lisp 1840@end lisp
1841
1758@noindent 1842@noindent
1759Then each time you turn a TODO entry into DONE using either @kbd{C-c 1843Then each time you turn a TODO entry into DONE using either @kbd{C-c
1760C-t} in the Org-mode buffer or @kbd{t} in the agenda buffer, a line 1844C-t} in the Org-mode buffer or @kbd{t} in the agenda buffer, a line
@@ -1765,16 +1849,18 @@ state cycling, that line will be removed again. In the timeline
1765you can then use the @kbd{L} key to display the TODO items closed on 1849you can then use the @kbd{L} key to display the TODO items closed on
1766each day, giving you an overview of what has been done on a day. 1850each day, giving you an overview of what has been done on a day.
1767 1851
1768@node TODO extensions, Priorities, Progress Logging, TODO items 1852@node TODO extensions, Priorities, Progress logging, TODO items
1769@section Extended use of TODO keywords 1853@section Extended use of TODO keywords
1770@cindex extended TODO keywords 1854@cindex extended TODO keywords
1771 1855
1772The default implementation of TODO entries is just two states: TODO 1856The default implementation of TODO entries is just two states: TODO and
1773and DONE. You can, however, use the TODO feature for more 1857DONE. You can, however, use the TODO feature for more complicated
1774complicated things by configuring the variables 1858things by configuring the variables @code{org-todo-keywords} and
1775@code{org-todo-keywords} and @code{org-todo-interpretation}. Using 1859@code{org-todo-interpretation}. Using special setup, you can even use
1776special setup, you can even use TODO keywords in different ways in 1860TODO keywords in different ways in different org files.
1777different org files. 1861
1862Note that @i{tags} are another way to classify headlines in general and
1863TODO items in particular (@pxref{Tags}).
1778 1864
1779@menu 1865@menu
1780* Workflow states:: From TODO to DONE in steps 1866* Workflow states:: From TODO to DONE in steps
@@ -1788,7 +1874,7 @@ different org files.
1788@cindex workflow states as TODO keywords 1874@cindex workflow states as TODO keywords
1789 1875
1790You can use TODO keywords to indicate different states in the process 1876You can use TODO keywords to indicate different states in the process
1791of working on an item, for example 1877of working on an item, for example:
1792 1878
1793@lisp 1879@lisp
1794(setq org-todo-keywords '("TODO" "FEEDBACK" "VERIFY" "DONE") 1880(setq org-todo-keywords '("TODO" "FEEDBACK" "VERIFY" "DONE")
@@ -1836,7 +1922,7 @@ Use prefix arguments or completion to quickly select a specific name.
1836You can also review the items of a specific TODO type in a sparse tree 1922You can also review the items of a specific TODO type in a sparse tree
1837by using a numeric prefix to @kbd{C-c C-v}. For example, to see all 1923by using a numeric prefix to @kbd{C-c C-v}. For example, to see all
1838things Lucy has to do, you would use @kbd{C-3 C-c C-v}. To collect 1924things Lucy has to do, you would use @kbd{C-3 C-c C-v}. To collect
1839collect Lucy's items from all agenda files into a single buffer, you 1925Lucy's items from all agenda files into a single buffer, you
1840would use the prefix arg as well when creating the global todo list: 1926would use the prefix arg as well when creating the global todo list:
1841@kbd{C-3 C-c t}. 1927@kbd{C-3 C-c t}.
1842 1928
@@ -1922,7 +2008,7 @@ Furthermore, these keys are also used by CUA-mode
1922(@pxref{Interaction}). 2008(@pxref{Interaction}).
1923@end table 2009@end table
1924 2010
1925@node Timestamps, Agenda Views, TODO items, Top 2011@node Timestamps, Tags, TODO items, Top
1926@chapter Timestamps 2012@chapter Timestamps
1927 2013
1928Items can be labeled with timestamps to make them useful for project 2014Items can be labeled with timestamps to make them useful for project
@@ -1945,7 +2031,7 @@ planning.
1945A time stamp is a specification of a date (possibly with time) in a 2031A time stamp is a specification of a date (possibly with time) in a
1946special format, either @samp{<2003-09-16 Tue>} or @samp{<2003-09-16 2032special format, either @samp{<2003-09-16 Tue>} or @samp{<2003-09-16
1947Tue 09:39>}. A time stamp can appear anywhere in the headline or body 2033Tue 09:39>}. A time stamp can appear anywhere in the headline or body
1948of an org-tree entry. Its presence allows to show entries on specific 2034of an org-tree entry. Its presence allows entries to be shown on specific
1949dates in the agenda (@pxref{Weekly/Daily Agenda}). We distinguish: 2035dates in the agenda (@pxref{Weekly/Daily Agenda}). We distinguish:
1950 2036
1951@table @var 2037@table @var
@@ -2011,12 +2097,13 @@ this command is used twice in succession, a time range is inserted.
2011@kindex C-u C-c . 2097@kindex C-u C-c .
2012@item C-u C-c . 2098@item C-u C-c .
2013Like @kbd{C-c .}, but use the alternative format which contains date 2099Like @kbd{C-c .}, but use the alternative format which contains date
2014and time. 2100and time. The default time can be rounded to multiples of 5 minutes,
2101see the option @code{org-time-stamp-rounding-minutes}.
2015 2102
2016@kindex C-c ! 2103@kindex C-c !
2017@item C-c ! 2104@item C-c !
2018Like @kbd{C-c .}, but insert an inactive time stamp not triggering the 2105Like @kbd{C-c .}, but insert an inactive time stamp not triggering the
2019agenda. 2106agenda.
2020 2107
2021@kindex C-c < 2108@kindex C-c <
2022@item C-c < 2109@item C-c <
@@ -2118,18 +2205,123 @@ One month back.
2118Choose date in calendar (only if nothing typed into minibuffer). 2205Choose date in calendar (only if nothing typed into minibuffer).
2119@end table 2206@end table
2120 2207
2121@node Agenda Views, Exporting, Timestamps, Top 2208@node Tags, Agenda Views, Timestamps, Top
2209@chapter Tags
2210@cindex tags
2211@cindex headline tagging
2212@cindex matching, tags
2213@cindex sparse tree, tag based
2214
2215If you wish to implement a system to cross-correlate information, an
2216excellent way is to assign @i{tags} to headline. Org-mode has
2217extensive support for using tags.
2218
2219Every headline can contain a list of tags, at the end of the headline.
2220Tags are normal words containing letters, numbers, @samp{_}, and
2221@samp{@@}. Tags must be preceded and followed by a single colon; like
2222@samp{:WORK:}. Several tags can be specified like @samp{:WORK:URGENT:}.
2223
2224@menu
2225* Tag inheritance:: Tags use the tree structure of the outline
2226* Setting tags:: How to assign tags to a headline
2227* Tag searches:: Searching for combinations of tags
2228@end menu
2229
2230@node Tag inheritance, Setting tags, Tags, Tags
2231@section Tag inheritance
2232@cindex inheritance, of tags
2233
2234@i{Tags} make use of the hierarchical structure of outline trees. If a
2235heading has a certain tag, all subheadings will inherit the tag as
2236well. For example, in the list
2237
2238@example
2239* Meeting with the French group :WORK:
2240** Summary by Frank :BOSS:NOTES:
2241*** TODO Prepare slides for him :ACTION:
2242@end example
2243
2244@noindent
2245the final heading will have the tags @samp{:WORK:}, @samp{:BOSS:},
2246@samp{:NOTES:}, and @samp{:ACTION:}. When executing tag searches and
2247Org-mode finds that a certain headline matches the search criterion, it
2248will not check any sublevel headline, assuming that these likely also
2249match, and that the list of matches can become very long. However, this
2250may not be what you want, and you can influence inheritance and
2251searching using the variables @code{org-use-tag-inheritance} and
2252@code{org-tags-match-list-sublevels}.
2253
2254@node Setting tags, Tag searches, Tag inheritance, Tags
2255@section Setting tags
2256@cindex setting tags
2257
2258@kindex M-@key{TAB}
2259As Org-mode deals with plain text files, tags can simply be typed into
2260the buffer. After a colon, @kbd{M-@key{TAB}} offers completion on all
2261tags being used in the current buffer. There is also a special command
2262for inserting tags:
2263
2264@table @kbd
2265@kindex C-c C-c
2266@item C-c C-c
2267@cindex completion, of tags
2268Enter new tags for the current headline. The minibuffer will prompt for
2269a list of tags and offer completion with respect to all other tags used
2270in the current buffer. Several tags, separated by colons, may be
2271specified at the prompt. After pressing @key{RET}, the tags will be
2272inserted and aligned to @code{org-tags-column}. When called with a
2273@kbd{C-u} prefix, all tags in the current buffer will be aligned to that
2274column, just to make things look nice. TAGS are automatically realigned
2275after promotion, demotion, and TODO state changes (@pxref{TODO basics}).
2276@end table
2277
2278@node Tag searches, , Setting tags, Tags
2279@section Tag searches
2280@cindex tag searches
2281
2282Once a tags system has been set up, it can be used to collect related
2283information into special lists.
2284
2285@table @kbd
2286@kindex C-c \
2287@item C-c \
2288Create a sparse tree with all headlines matching a tags search.
2289@kindex C-c a m
2290@item C-c a m
2291Create a global list of tag matches from all agenda files.
2292@xref{Matching headline tags}.
2293@kindex C-c a M
2294@item C-c a M
2295Create a global list of tag matches from all agenda files, but check
2296only TODO items and force checking subitems (see variable
2297@code{org-tags-match-list-sublevels}).
2298@end table
2299
2300A @i{tags} search string can use Boolean operators @samp{&} for AND and
2301@samp{|} for OR. @samp{&} binds more strongly than @samp{|}.
2302Parenthesis are currently not implemented. A tag may also be preceded
2303by @samp{-}, to select against it, and @samp{+} is syntactic sugar for
2304positive selection. The AND operator @samp{&} is optional when @samp{+}
2305or @samp{-} is present. For example, @samp{+WORK-BOSS} would select all
2306headlines that are tagged @samp{:WORK:}, but discard those also tagged
2307@samp{:BOSS:}. The search string @samp{WORK|LAPTOP} selects all lines
2308tagged @samp{:WORK:} or @samp{:LAPTOP:}. The string
2309@samp{WORK|LAPTOP&NIGHT} requires that the @samp{:LAPTOP:} lines are
2310also tagged @samp{NIGHT}.
2311
2312@node Agenda Views, Exporting, Tags, Top
2122@chapter Agenda Views 2313@chapter Agenda Views
2123@cindex agenda views 2314@cindex agenda views
2124 2315
2125Due to the way Org-mode works, TODO items and time-stamped items can 2316Due to the way Org-mode works, TODO items, time-stamped items, and
2126be scattered throughout a file or even a number of files. To get an 2317tagged headlines can be scattered throughout a file or even a number of
2127overview over open action items, or over events that are important for 2318files. To get an overview over open action items, or over events that
2128a particular date, this information must be collected, sorted and 2319are important for a particular date, this information must be collected,
2129displayed in an organized way. 2320sorted and displayed in an organized way.
2130 2321
2131Org-mode can select items based on various criteria, and display them 2322Org-mode can select items based on various criteria, and display them
2132in a separate buffer. Three different views are provided: 2323in a separate buffer. Three different views are provided:
2324
2133@itemize @bullet 2325@itemize @bullet
2134@item 2326@item
2135an @emph{agenda} that is like a calendar and shows information 2327an @emph{agenda} that is like a calendar and shows information
@@ -2141,6 +2333,7 @@ action items, and
2141a @emph{tags view} that shows information based on 2333a @emph{tags view} that shows information based on
2142the tags associated with headlines in the outline tree. 2334the tags associated with headlines in the outline tree.
2143@end itemize 2335@end itemize
2336
2144@noindent 2337@noindent
2145The extracted information is displayed in a special @emph{agenda 2338The extracted information is displayed in a special @emph{agenda
2146buffer}. This buffer is read-only, but provides commands to visit the 2339buffer}. This buffer is read-only, but provides commands to visit the
@@ -2161,7 +2354,9 @@ edit these files remotely.
2161@section Agenda files 2354@section Agenda files
2162 2355
2163The information to be shown is collected from all @emph{agenda files}, 2356The information to be shown is collected from all @emph{agenda files},
2164the files listed in the variable @code{org-agenda-files}. Thus even 2357the files listed in the variable @code{org-agenda-files}@footnote{If the
2358value of that variable is not a list, but a single file name, then the
2359list of agenda files will be maintained in that external file.}. Thus even
2165if you only work with a single Org-mode file, this file should be put 2360if you only work with a single Org-mode file, this file should be put
2166into that list@footnote{When using the dispatcher pressing @kbd{1} 2361into that list@footnote{When using the dispatcher pressing @kbd{1}
2167before selecting a command will actually limit the command to the 2362before selecting a command will actually limit the command to the
@@ -2181,8 +2376,9 @@ the front. With prefix arg, file is added/moved to the end.
2181Remove current file from the list of agenda files. 2376Remove current file from the list of agenda files.
2182@kindex C-, 2377@kindex C-,
2183@item C-, 2378@item C-,
2184Cycle through agenda file list. 2379Cycle through agenda file list, visiting one file after the other.
2185@end table 2380@end table
2381
2186@noindent 2382@noindent
2187The Org menu contains the current list of files and can be used 2383The Org menu contains the current list of files and can be used
2188to visit any of them. 2384to visit any of them.
@@ -2195,7 +2391,7 @@ to visit any of them.
2195@cindex agenda commands, custom 2391@cindex agenda commands, custom
2196The views are created through a dispatcher that should be bound to a 2392The views are created through a dispatcher that should be bound to a
2197global key, for example @kbd{C-c a} (@pxref{Installation and 2393global key, for example @kbd{C-c a} (@pxref{Installation and
2198Activation}). In the following we will assume that @kbd{C-c a} is 2394activation}). In the following we will assume that @kbd{C-c a} is
2199indeed how the dispatcher is accessed and list keyboard access to 2395indeed how the dispatcher is accessed and list keyboard access to
2200commands accordingly. After pressing @kbd{C-c a}, an additional 2396commands accordingly. After pressing @kbd{C-c a}, an additional
2201letter is required to execute a command. The dispatcher offers the 2397letter is required to execute a command. The dispatcher offers the
@@ -2206,7 +2402,7 @@ Create the calendar-like agenda (@pxref{Weekly/Daily Agenda}).
2206@item t / T 2402@item t / T
2207Create a list of all TODO items (@pxref{Global TODO list}). 2403Create a list of all TODO items (@pxref{Global TODO list}).
2208@item m / M 2404@item m / M
2209Create a list of headline matching a TAGS expression (@pxref{Matching 2405Create a list of headlines matching a TAGS expression (@pxref{Matching
2210headline tags}). 2406headline tags}).
2211@end table 2407@end table
2212 2408
@@ -2222,6 +2418,7 @@ Custom commands are configured in the variable
2222@code{org-agenda-custom-commands}. You can customize this variable, 2418@code{org-agenda-custom-commands}. You can customize this variable,
2223for example by pressing @kbd{C-c a C}. You can also directly set it 2419for example by pressing @kbd{C-c a C}. You can also directly set it
2224with Emacs Lisp in @file{.emacs}. For example: 2420with Emacs Lisp in @file{.emacs}. For example:
2421
2225@lisp 2422@lisp
2226(setq org-agenda-custom-commands 2423(setq org-agenda-custom-commands
2227 '(("w" todo "WAITING") 2424 '(("w" todo "WAITING")
@@ -2229,8 +2426,9 @@ with Emacs Lisp in @file{.emacs}. For example:
2229 ("U" tags-tree "+BOSS-URGENT") 2426 ("U" tags-tree "+BOSS-URGENT")
2230 ("f" occur-tree "\\<FIXME\\>"))) 2427 ("f" occur-tree "\\<FIXME\\>")))
2231@end lisp 2428@end lisp
2429
2232@noindent will define @kbd{C-c a w} as a global search for 2430@noindent will define @kbd{C-c a w} as a global search for
2233TODO entries with @samp{WAITING} as todo keyword, @kbd{C-c a u} as a 2431TODO entries with @samp{WAITING} as the TODO keyword, @kbd{C-c a u} as a
2234global tags search for headlines marked @samp{:BOSS:} but not 2432global tags search for headlines marked @samp{:BOSS:} but not
2235@samp{:URGENT:}, @kbd{C-c a U} to do the same search but only in the 2433@samp{:URGENT:}, @kbd{C-c a U} to do the same search but only in the
2236current buffer and display the result as a sparse tree, and @kbd{C-c a 2434current buffer and display the result as a sparse tree, and @kbd{C-c a
@@ -2252,11 +2450,11 @@ a paper agenda, showing all the tasks for the current week or day.
2252Compile an agenda for the current week from a list of org files. The 2450Compile an agenda for the current week from a list of org files. The
2253agenda shows the entries for each day. With a @kbd{C-u} prefix (or 2451agenda shows the entries for each day. With a @kbd{C-u} prefix (or
2254when the variable @code{org-agenda-include-all-todo} is @code{t}), all 2452when the variable @code{org-agenda-include-all-todo} is @code{t}), all
2255unfinished TODO items (also those without a date) are also listed at 2453unfinished TODO items (including those without a date) are also listed at
2256the beginning of the buffer, before the first date.@* 2454the beginning of the buffer, before the first date.@*
2257@end table 2455@end table
2258 2456
2259Remote editing from the agenda buffer means for example that you can 2457Remote editing from the agenda buffer means, for example, that you can
2260change the dates of deadlines and appointments from the agenda buffer. 2458change the dates of deadlines and appointments from the agenda buffer.
2261The commands available in the Agenda buffer are listed in @ref{Agenda 2459The commands available in the Agenda buffer are listed in @ref{Agenda
2262commands}. 2460commands}.
@@ -2275,12 +2473,15 @@ commands}.
2275In the agenda buffer, each entry is preceded by a @emph{category}, 2473In the agenda buffer, each entry is preceded by a @emph{category},
2276which is derived from the file name. The category can also be set 2474which is derived from the file name. The category can also be set
2277with a special line anywhere in the buffer, looking like this: 2475with a special line anywhere in the buffer, looking like this:
2476
2278@example 2477@example
2279#+CATEGORY: Thesis 2478#+CATEGORY: Thesis
2280@end example 2479@end example
2480
2281If there are several such lines in a file, each specifies the category 2481If there are several such lines in a file, each specifies the category
2282for the text below it. The display in the agenda buffer looks best if 2482for the text below it (but the first category also applies to any text
2283the category is not longer than 10 characters. 2483before the first CATEGORY line). The display in the agenda buffer looks
2484best if the category is not longer than 10 characters.
2284 2485
2285@node Time-of-day specifications, Calendar/Diary integration, Categories, Weekly/Daily Agenda 2486@node Time-of-day specifications, Calendar/Diary integration, Categories, Weekly/Daily Agenda
2286@subsection Time-of-Day Specifications 2487@subsection Time-of-Day Specifications
@@ -2337,7 +2538,7 @@ The time grid can be turned on and off with the variable
2337 2538
2338Emacs contains the calendar and diary by Edward M. Reingold. The 2539Emacs contains the calendar and diary by Edward M. Reingold. The
2339calendar displays a three-month calendar with holidays from different 2540calendar displays a three-month calendar with holidays from different
2340countries and cultures. The diary allows to keep track of 2541countries and cultures. The diary allows you to keep track of
2341anniversaries, lunar phases, sunrise/set, recurrent appointments 2542anniversaries, lunar phases, sunrise/set, recurrent appointments
2342(weekly, monthly) and more. In this way, it is quite complementary to 2543(weekly, monthly) and more. In this way, it is quite complementary to
2343Org-mode. It can be very useful to combine output from Org-mode with 2544Org-mode. It can be very useful to combine output from Org-mode with
@@ -2349,13 +2550,12 @@ agenda, you only need to customize the variable
2349@lisp 2550@lisp
2350(setq org-agenda-include-diary t) 2551(setq org-agenda-include-diary t)
2351@end lisp 2552@end lisp
2352@noindent
2353 2553
2354@noindent After that, everything will happen automatically. All diary 2554@noindent After that, everything will happen automatically. All diary
2355entries including holidays, anniversaries etc will be included in the 2555entries including holidays, anniversaries etc will be included in the
2356agenda buffer created by Org-mode. @key{SPC}, @key{TAB}, and 2556agenda buffer created by Org-mode. @key{SPC}, @key{TAB}, and
2357@key{RET} can be used from the agenda buffer to jump to the diary 2557@key{RET} can be used from the agenda buffer to jump to the diary
2358file, in order to edit existing diary entries. The @kbd{i} command to 2558file in order to edit existing diary entries. The @kbd{i} command to
2359insert new entries for the current date works in the agenda buffer, as 2559insert new entries for the current date works in the agenda buffer, as
2360well as the commands @kbd{S}, @kbd{M}, and @kbd{C} to display 2560well as the commands @kbd{S}, @kbd{M}, and @kbd{C} to display
2361Sunrise/Sunset times, show lunar phases and to convert to other 2561Sunrise/Sunset times, show lunar phases and to convert to other
@@ -2399,7 +2599,7 @@ the TODO entries directly from that buffer (@pxref{Agenda commands}).
2399@xref{Global TODO list}, for more information. 2599@xref{Global TODO list}, for more information.
2400@kindex C-c a T 2600@kindex C-c a T
2401@item C-c a T 2601@item C-c a T
2402Like the above, but allow to select a specific TODO keyword. You can 2602Like the above, but allows selection of a specific TODO keyword. You can
2403also do this by specifying a prefix argument to @kbd{C-c a t}. With a 2603also do this by specifying a prefix argument to @kbd{C-c a t}. With a
2404@kbd{C-u} prefix you are prompted for a keyword. With a numeric 2604@kbd{C-u} prefix you are prompted for a keyword. With a numeric
2405prefix, the Nth keyword in @code{org-todo-keywords} is selected. 2605prefix, the Nth keyword in @code{org-todo-keywords} is selected.
@@ -2452,7 +2652,7 @@ The timeline is not really an agenda view, because it only summarizes
2452items from a single Org-mode file. But it also uses the agenda buffer 2652items from a single Org-mode file. But it also uses the agenda buffer
2453and provides similar commands, so we discuss it here. The timeline 2653and provides similar commands, so we discuss it here. The timeline
2454shows all time-stamped items in a single Org-mode file (or the 2654shows all time-stamped items in a single Org-mode file (or the
2455selected part of it), in @emph{time-sorted view}. The main purpose of 2655selected part of it), in a @emph{time-sorted view}. The main purpose of
2456this command is to give an overview over events in a project. 2656this command is to give an overview over events in a project.
2457 2657
2458@table @kbd 2658@table @kbd
@@ -2462,8 +2662,8 @@ Show a time-sorted view of the org file, with all time-stamped items.
2462When called with a @kbd{C-u} prefix, all unfinished TODO entries 2662When called with a @kbd{C-u} prefix, all unfinished TODO entries
2463(scheduled or not) are also listed under the current date. 2663(scheduled or not) are also listed under the current date.
2464@end table 2664@end table
2465@noindent
2466 2665
2666@noindent
2467The commands available in the timeline buffer are listed in 2667The commands available in the timeline buffer are listed in
2468@ref{Agenda commands}. 2668@ref{Agenda commands}.
2469 2669
@@ -2476,7 +2676,7 @@ file where they originate. You are not allowed to edit the agenda
2476buffer itself, but commands are provided to show and jump to the 2676buffer itself, but commands are provided to show and jump to the
2477original entry location, and to edit the org-files ``remotely'' from 2677original entry location, and to edit the org-files ``remotely'' from
2478the agenda buffer. In this way, all information is stored only once, 2678the agenda buffer. In this way, all information is stored only once,
2479and you don't risk that your agenda and note files diverge. 2679removing the risk that your agenda and note files may diverge.
2480 2680
2481Some commands can be executed with mouse clicks on agenda lines. For 2681Some commands can be executed with mouse clicks on agenda lines. For
2482the other commands, the cursor needs to be in the desired line. 2682the other commands, the cursor needs to be in the desired line.
@@ -2507,7 +2707,7 @@ Display original location and recenter that window.
2507@itemx mouse-1 2707@itemx mouse-1
2508@itemx @key{TAB} 2708@itemx @key{TAB}
2509Go to the original location of the item in another window. Under Emacs 2709Go to the original location of the item in another window. Under Emacs
251022, also @kbd{mouse-1} will works for this. 271022, @kbd{mouse-1} will also works for this.
2511 2711
2512@kindex @key{RET} 2712@kindex @key{RET}
2513@itemx @key{RET} 2713@itemx @key{RET}
@@ -2531,11 +2731,11 @@ Delete other windows.
2531 2731
2532@kindex w 2732@kindex w
2533@item w 2733@item w
2534Switch to weekly view (7 days displayed together) 2734Switch to weekly view (7 days displayed together).
2535 2735
2536@kindex d 2736@kindex d
2537@item d 2737@item d
2538Switch to daily view (just one day displayed) 2738Switch to daily view (just one day displayed).
2539 2739
2540@kindex D 2740@kindex D
2541@item D 2741@item D
@@ -2580,7 +2780,7 @@ original org file.
2580 2780
2581@kindex T 2781@kindex T
2582@item T 2782@item T
2583Show all tags assiciated with the current item. Because of 2783Show all tags associated with the current item. Because of
2584inheritance, this may be more than the tags listed in the line itself. 2784inheritance, this may be more than the tags listed in the line itself.
2585 2785
2586@kindex : 2786@kindex :
@@ -2650,7 +2850,7 @@ date at the cursor.
2650 2850
2651@kindex M 2851@kindex M
2652@item M 2852@item M
2653Show the phases of the moon for three month around current date. 2853Show the phases of the moon for the three months around current date.
2654 2854
2655@kindex S 2855@kindex S
2656@item S 2856@item S
@@ -2673,7 +2873,7 @@ Export a single iCalendar file containing entries from all agenda files.
2673@tsubheading{Quit and Exit} 2873@tsubheading{Quit and Exit}
2674@kindex q 2874@kindex q
2675@item q 2875@item q
2676Quit Agenda, remove the agenda buffer. 2876Quit agenda, remove the agenda buffer.
2677 2877
2678@kindex x 2878@kindex x
2679@cindex agenda files, removing buffers 2879@cindex agenda files, removing buffers
@@ -2718,11 +2918,13 @@ warning.
2718@cindex headline levels, for exporting 2918@cindex headline levels, for exporting
2719In the exported version, the first 3 outline levels will become 2919In the exported version, the first 3 outline levels will become
2720headlines, defining a general document structure. Additional levels 2920headlines, defining a general document structure. Additional levels
2721will be exported as itemize lists. If you want that transition to occur 2921will be exported as itemized lists. If you want that transition to occur
2722at a different level, specify it with a prefix argument. For example, 2922at a different level, specify it with a prefix argument. For example,
2923
2723@example 2924@example
2724@kbd{C-1 C-c C-x a org-export-as-ascii} 2925@kbd{C-1 C-c C-x a org-export-as-ascii}
2725@end example 2926@end example
2927
2726@noindent 2928@noindent
2727creates only top level headlines and does the rest as items. Lines 2929creates only top level headlines and does the rest as items. Lines
2728starting with @samp{#} and subtrees starting with the word @samp{COMMENT} 2930starting with @samp{#} and subtrees starting with the word @samp{COMMENT}
@@ -2757,11 +2959,13 @@ Toggle fixed-width for entry (QUOTE) or region, see below.
2757@cindex headline levels, for exporting 2959@cindex headline levels, for exporting
2758In the exported version, the first 3 outline levels will become 2960In the exported version, the first 3 outline levels will become
2759headlines, defining a general document structure. Additional levels 2961headlines, defining a general document structure. Additional levels
2760will be exported as itemize lists. If you want that transition to occur 2962will be exported as itemized lists. If you want that transition to occur
2761at a different level, specify it with a prefix argument. For example, 2963at a different level, specify it with a prefix argument. For example,
2964
2762@example 2965@example
2763@kbd{C-2 C-c C-x b} 2966@kbd{C-2 C-c C-x b}
2764@end example 2967@end example
2968
2765@noindent 2969@noindent
2766creates two levels of headings and does the rest as items. 2970creates two levels of headings and does the rest as items.
2767 2971
@@ -2851,9 +3055,10 @@ correct is to type @samp{#+} and then use @kbd{M-@key{TAB}} completion
2851#+TEXT: Several lines may be given. 3055#+TEXT: Several lines may be given.
2852#+OPTIONS: H:2 num:t toc:t \n:nil @:t ::t |:t ^:t *:nil TeX:t 3056#+OPTIONS: H:2 num:t toc:t \n:nil @:t ::t |:t ^:t *:nil TeX:t
2853@end example 3057@end example
3058
2854@noindent 3059@noindent
2855The OPTIONS line is a compact form to specify export settings. Here 3060The OPTIONS line is a compact form to specify export settings. Here
2856you can 3061you can:
2857@cindex headline levels 3062@cindex headline levels
2858@cindex section-numbers 3063@cindex section-numbers
2859@cindex table of contents 3064@cindex table of contents
@@ -2886,7 +3091,7 @@ end of the outline tree. For example:
2886@example 3091@example
2887* COMMENT HTML style specifications 3092* COMMENT HTML style specifications
2888 3093
2889# Local Variables: 3094# Local Variables:
2890# org-export-html-style: " <style type=\"text/css\"> 3095# org-export-html-style: " <style type=\"text/css\">
2891 p @{font-weight: normal; color: gray; @} 3096 p @{font-weight: normal; color: gray; @}
2892 h1 @{color: black; @} 3097 h1 @{color: black; @}
@@ -2895,7 +3100,9 @@ end of the outline tree. For example:
2895@end example 3100@end example
2896 3101
2897Remember to execute @kbd{M-x normal-mode} after changing this to make 3102Remember to execute @kbd{M-x normal-mode} after changing this to make
2898the new style visible to Emacs. 3103the new style visible to Emacs. This command reastarts org-mode for the
3104current buffer and forces Emacs to re-evaluate the loval variables
3105section in the buffer.
2899 3106
2900@node Comment lines, , Export options, HTML export 3107@node Comment lines, , Export options, HTML export
2901@subsection Comment lines 3108@subsection Comment lines
@@ -2969,6 +3176,7 @@ to make iCal re-read the calendar files each time a new version of
2969@menu 3176@menu
2970* Completion:: M-TAB knows what you need 3177* Completion:: M-TAB knows what you need
2971* Customization:: Adapting Org-mode to your taste 3178* Customization:: Adapting Org-mode to your taste
3179* Updating settings:: How to tell Org-mode that settings have changed
2972* Clean view:: Getting rid of leading stars in the outline 3180* Clean view:: Getting rid of leading stars in the outline
2973* TTY keys:: Using Org-mode on a tty 3181* TTY keys:: Using Org-mode on a tty
2974* FAQ:: Frequently asked questions 3182* FAQ:: Frequently asked questions
@@ -3021,7 +3229,7 @@ Elsewhere, complete dictionary words using ispell.
3021@end table 3229@end table
3022 3230
3023 3231
3024@node Customization, Clean view, Completion, Miscellaneous 3232@node Customization, Updating settings, Completion, Miscellaneous
3025@section Customization 3233@section Customization
3026@cindex customization 3234@cindex customization
3027@cindex options, for customization 3235@cindex options, for customization
@@ -3033,14 +3241,48 @@ describing the variables here. A structured overview of customization
3033variables is available with @kbd{M-x org-customize}. Or select 3241variables is available with @kbd{M-x org-customize}. Or select
3034@code{Browse Org Group} from the @code{Org->Customization} menu. 3242@code{Browse Org Group} from the @code{Org->Customization} menu.
3035 3243
3036@node Clean view, TTY keys, Customization, Miscellaneous 3244@node Updating settings, Clean view, Customization, Miscellaneous
3245@section Updating settings after changes
3246@cindex updating, after setting changes
3247@kindex C-c C-c
3248
3249Org-mode uses special lines in the buffer to set file-local values for a
3250number of user options. When such settings are changed, you need to
3251inform Org-mode that something has be modified and that it should
3252recheck the buffer for setting. This is done with the command @kbd{C-c
3253C-c} in the following situations:
3254
3255@itemize @bullet
3256@item
3257After changing any of the special buffer lines starting with @samp{#+},
3258for example @samp{#+STARTUP}, @samp{#+CATEGORY}. Org-mode will then
3259read these settings and activate them (see @ref{Visibility cycling},
3260@ref{Narrow columns}, @ref{Clean view}, @ref{Per file keywords},
3261@ref{Categories})
3262@item
3263After editing by hand a @samp{#+TBLFM} line containing formulas for a
3264table. When pressing @kbd{C-c C-c} in that line, all formulas are
3265re-applied to the entire table (@pxref{Editing/debugging formulas}).
3266@item
3267In a table, @kbd{C-c C-c} does force a re-align, even if the table
3268editor is turned off (@pxref{Built-in table editor})
3269@item
3270In an ordered plain list, @kbd{C-c C-c} forces a renumbering of the list
3271(@pxref{Plain Lists}).
3272@item
3273After adding a new radio target @samp{<<<New target>>>}, @kbd{C-c C-c}
3274must be used with the cursor on that target to activate it throughout
3275the buffer.
3276@end itemize
3277
3278@node Clean view, TTY keys, Updating settings, Miscellaneous
3037@section A cleaner outline view 3279@section A cleaner outline view
3038@cindex hiding leading stars 3280@cindex hiding leading stars
3039@cindex clean outline view 3281@cindex clean outline view
3040 3282
3041Some people find it noisy and distracting that the Org-mode headlines 3283Some people find it noisy and distracting that the Org-mode headlines
3042are starting with a potentially large number of stars. For example in 3284are starting with a potentially large number of stars. For example
3043the example tree from @ref{Headlines}: 3285the tree from @ref{Headlines}:
3044 3286
3045@example 3287@example
3046* Top level headline 3288* Top level headline
@@ -3071,9 +3313,10 @@ the buffer)
3071#+STARTUP: showstars 3313#+STARTUP: showstars
3072#+STARTUP: hidestars 3314#+STARTUP: hidestars
3073@end example 3315@end example
3316
3074@noindent 3317@noindent
3075Press @kbd{C-c C-c} with the cursor in a @samp{STARTUP} line to activate 3318Press @kbd{C-c C-c} with the cursor in a @samp{STARTUP} line to activate
3076the modifications. 3319the modifications.
3077 3320
3078With stars hidden, the tree becomes: 3321With stars hidden, the tree becomes:
3079 3322
@@ -3129,7 +3372,7 @@ activate changes immediately).
3129@end example 3372@end example
3130 3373
3131You can convert an Org-mode file from single-star-per-level to 3374You can convert an Org-mode file from single-star-per-level to
3132double-star-per-level convention with @kbd{M-x org-convert-to-odd-levels 3375the double-star-per-level convention with @kbd{M-x org-convert-to-odd-levels
3133RET} in that file. There is no command for the back conversion because 3376RET} in that file. There is no command for the back conversion because
3134such a command might merge levels and in this way destroy the 3377such a command might merge levels and in this way destroy the
3135structure of the tree. 3378structure of the tree.
@@ -3179,36 +3422,78 @@ rather use @kbd{C-c .} to re-insert the timestamp.
3179@enumerate 3422@enumerate
3180@item @b{Org-mode seems to be a useful default mode for the various 3423@item @b{Org-mode seems to be a useful default mode for the various
3181@file{README} files I have scattered through my directories. How do I 3424@file{README} files I have scattered through my directories. How do I
3182turn it on for all @file{README} files?} 3425turn it on for all @file{README} files?}@*
3426@c
3183@example 3427@example
3184(add-to-list 'auto-mode-alist '("README$" . org-mode)) 3428(add-to-list 'auto-mode-alist '("README$" . org-mode))
3185@end example 3429@end example
3186 3430
3431@item @b{Some of my links stopped working after I upgraded to a version
34324.20 or later. Why is this, and how can I fix it?}@*
3433@c
3434These must be links in plain text, containing white space, such as
3435@samp{bbdb:Richard Stallman}. You need to protect these links by
3436putting double brackets around them, like @samp{[[bbdb:Richard
3437Stallman]]}.
3438
3439@item @b{I see that Org-mode now creates links using the double bracket
3440convention that hides the link part and the brackets, only showing the
3441description part. How can I convert my old links to this new format?}@*
3442@c
3443Execute once in each Org-mode file: @kbd{M-x org-upgrade-old-links}.
3444The replaces angular brackets with the link format.
3445
3446@item @b{I don't care if you find the new bracket links great, I am
3447attached to the old style using angular brackets and no hiding of the
3448link text. Please give them back to me, don't tell me it is not
3449possible!}@*
3450@c
3451Would I let you down like that? If you must (even if I don't understand
3452why), you can do this
3453@lisp
3454(setq org-link-style 'plain
3455 org-link-format "<%s>")
3456@end lisp
3457
3458@item @b{When I am executing shell links I always get a
3459confirmation prompt and need to type @kbd{yes @key{RET}}, thats 4 key
3460presses! Can I get rid of this?}@*
3461@c
3462@cindex shell links, confirmation
3463@cindex dangerous commands
3464The confirmation is there to protect you from unwantingly execute
3465potentially dangerous commands. For example, imagine a link
3466@samp{[[shell:rm -rf ~/*][Google Search]]}. In an Org-mode buffer, this
3467command would look like @samp{Google Search}, but really it would remove
3468your home directory. If you wish, you can make it easier to respond to
3469the query by setting @code{org-confirm-shell-links} to @code{y-or-n-p}.
3470Then a single @kbd{y} keypress will be enough to confirm shell links.
3471It is also possible to turn off this check entirely, but I do not
3472recommend to do this. Be warned.
3473
3187@item @b{All these stars are driving me mad, I just find the Emacs 3474@item @b{All these stars are driving me mad, I just find the Emacs
3188outlines unreadable. Can't you just put white space and a single star as a 3475outlines unreadable. Can't you just put white space and a single star as a
3189starter for headlines?}@* 3476starter for headlines?}@*
3477@c
3190See @ref{Clean view}. 3478See @ref{Clean view}.
3191 3479
3192@item @b{I would like to have two windows on the same Org-mode 3480@item @b{I would like to have two windows on the same Org-mode
3193file, but with different outline visibility. Is that possible?}@* 3481file, but with different outline visibility. Is that possible?}@*
3482@c
3194@cindex @code{make-indirect-buffer} 3483@cindex @code{make-indirect-buffer}
3195@cindex indirect buffers 3484@cindex indirect buffers
3196In GNU Emacs, you may use @emph{indirect buffers} which do exactly 3485In GNU Emacs, you may use @emph{indirect buffers} which do exactly this.
3197this. See the documentation on the command 3486See the documentation on the command @code{make-indirect-buffer}. In
3198@code{make-indirect-buffer}. In XEmacs, this is currently not 3487XEmacs, this is currently not possible because of the different outline
3199possible because of the different outline implementation. 3488implementation.
3200
3201@item @b{Is there an easy way to insert links to web locations?}@*
3202@cindex URL, paste into buffer
3203Sure, just type or paste them into the buffer. A plain-text URL-like
3204string is directly interpreted as a link.
3205 3489
3206@item @b{When I export my TODO list, every TODO item becomes a 3490@item @b{When I export my TODO list, every TODO item becomes a
3207separate section. How do I enforce these items to be exported as an 3491separate section. How do I enforce these items to be exported as an
3208itemized list?}@* 3492itemized list?}@*
3493@c
3209If you plan to use ASCII or HTML export, make sure things you want to 3494If you plan to use ASCII or HTML export, make sure things you want to
3210be exported as item lists are level 4 at least, even if that does mean 3495be exported as item lists are level 4 at least, even if that does mean
3211there is a level jump. For example 3496there is a level jump. For example:
3212 3497
3213@example 3498@example
3214* Todays top priorities 3499* Todays top priorities
@@ -3225,27 +3510,22 @@ configure the @samp{H} switch.
3225+OPTIONS: H:2; ... 3510+OPTIONS: H:2; ...
3226@end example 3511@end example
3227 3512
3228@item @b{I would like to export only a subtree of my file to HTML. How?}@* 3513@item @b{I would like to export only a subtree of my file to HTML.
3514How?}@*
3515@c
3229@cindex exporting a subtree 3516@cindex exporting a subtree
3230If you want to export a subtree, mark the subtree as region and then 3517If you want to export a subtree, mark the subtree as region and then
3231export. Marking can be done with @kbd{C-c @@ C-x C-x}, for example. 3518export. Marking can be done with @kbd{C-c @@ C-x C-x}, for example.
3232 3519
3233@item @b{Org-mode takes over the S-cursor keys. I also want to use 3520@item @b{Org-mode takes over the S-cursor keys. I also want to use
3234CUA-mode, is there a way to fix this conflict?}@* 3521CUA-mode, is there a way to fix this conflict?}@*
3235Yes, see @ref{Interaction} 3522Yes, see @ref{Interaction}.
3236
3237@item @b{Is there an easy way to insert an empty table template with a
3238default number of rows and columns?}@*
3239@cindex table, empty template
3240To insert an empty table template, just type @samp{|-} and use
3241@key{TAB}. The default size can be changed with the variable
3242@code{org-table-default-size}. However, just starting to type the
3243first line is usually much easier.
3244 3523
3245@item @b{One of my table columns has started to fill up with 3524@item @b{One of my table columns has started to fill up with
3246@samp{#ERROR}. What is going on?}@* 3525@samp{#ERROR}. What is going on?}@*
3526@c
3247Org-mode tried to compute the column from other fields using a 3527Org-mode tried to compute the column from other fields using a
3248formula stored in the @samp{#+TBLFMT:} line just below the table, and 3528formula stored in the @samp{#+TBLFM:} line just below the table, and
3249the evaluation of the formula fails. Fix the fields used in the 3529the evaluation of the formula fails. Fix the fields used in the
3250formula, or fix the formula, or remove it! 3530formula, or fix the formula, or remove it!
3251 3531
@@ -3253,23 +3533,26 @@ formula, or fix the formula, or remove it!
3253horizontal line in the table, pressing TAB creates a new table line 3533horizontal line in the table, pressing TAB creates a new table line
3254@i{before} the horizontal line. How can I quickly move to the line 3534@i{before} the horizontal line. How can I quickly move to the line
3255@i{below} the horizontal line instead?}@* 3535@i{below} the horizontal line instead?}@*
3536@c
3256Press @key{down} (to get on the separator line) and then @key{TAB}. 3537Press @key{down} (to get on the separator line) and then @key{TAB}.
3257Or configure the variable @code{org-table-tab-jumps-over-hlines}. 3538Or configure the variable @code{org-table-tab-jumps-over-hlines}.
3258 3539
3259@item @b{How can I change the indentation of an entire table without 3540@item @b{How can I change the indentation of an entire table without
3260fixing every line by hand?}@* 3541fixing every line by hand?}@*
3542@c
3261@cindex indentation, of tables 3543@cindex indentation, of tables
3262The indentation of a table is set by the first line. So just fix the 3544The indentation of a table is set by the first line. So just fix the
3263indentation of the first line and realign with @key{TAB}. 3545indentation of the first line and realign with @key{TAB}.
3264 3546
3265@item @b{Is it possible to include entries from org-mode files into my 3547@item @b{Is it possible to include entries from org-mode files into my
3266emacs diary?}@* 3548emacs diary?}@*
3549@c
3267Since the org-mode agenda is much more powerful and can contain the 3550Since the org-mode agenda is much more powerful and can contain the
3268diary (@pxref{Calendar/Diary integration}), you should think twice 3551diary (@pxref{Calendar/Diary integration}), you should think twice
3269before deciding to do this. Inegrating org-mode information into the 3552before deciding to do this. Integrating Org-mode information into the
3270diary is, however, possible. The following steps are necessary: 3553diary is, however, possible. The following steps are necessary:
3271Autoload the function @command{org-diary} as shown above under 3554Autoload the function @command{org-diary} as shown above under
3272@ref{Installation and Activation}. You also need to use @emph{fancy 3555@ref{Installation and activation}. You also need to use @emph{fancy
3273diary display} by setting in @file{.emacs}: 3556diary display} by setting in @file{.emacs}:
3274 3557
3275@lisp 3558@lisp
@@ -3310,10 +3593,10 @@ Org-mode can cooperate with the following packages:
3310@cindex @file{org-mouse.el} 3593@cindex @file{org-mouse.el}
3311@item @file{org-mouse.el} by Piotr Zielinski 3594@item @file{org-mouse.el} by Piotr Zielinski
3312This package implements extended mouse functionality for Org-mode. It 3595This package implements extended mouse functionality for Org-mode. It
3313allows to cycle visibility and to edit the document structure with the 3596allows you to cycle visibility and to edit the document structure with
3314mouse. It also provides a context-sensitive menu that changes depending 3597the mouse. It also provides a context-sensitive menu that changes
3315on the context of a mouse-click. Use a search engine to find this 3598depending on the context of a mouse-click. Use a search engine to find
3316package on the web. 3599this package on the web.
3317@cindex @file{table.el} 3600@cindex @file{table.el}
3318@item @file{table.el} by Takaaki Ota 3601@item @file{table.el} by Takaaki Ota
3319Org mode cooperates with table.el, see @ref{table.el}. @file{table.el} 3602Org mode cooperates with table.el, see @ref{table.el}. @file{table.el}
@@ -3331,7 +3614,7 @@ packages is using calc for embedded calculations. @xref{Embedded Mode,
3331@cindex @file{constants.el} 3614@cindex @file{constants.el}
3332@item @file{constants.el} by Carsten Dominik 3615@item @file{constants.el} by Carsten Dominik
3333In a table formula (@pxref{Table calculations}), it is possible to use 3616In a table formula (@pxref{Table calculations}), it is possible to use
3334names for natural constants or units. Instead of defining you own 3617names for natural constants or units. Instead of defining your own
3335constants in the variable @code{org-table-formula-constants}, install 3618constants in the variable @code{org-table-formula-constants}, install
3336the @file{constants} package which defines a large number of constants 3619the @file{constants} package which defines a large number of constants
3337and units, and lets you use unit prefixes like @samp{M} for 3620and units, and lets you use unit prefixes like @samp{M} for
@@ -3350,38 +3633,40 @@ packages along with Org-mode, configure the variable
3350@code{org-CUA-compatible}. When set, Org-mode will move the following 3633@code{org-CUA-compatible}. When set, Org-mode will move the following
3351keybindings in org-mode files, and in the agenda buffer (but not 3634keybindings in org-mode files, and in the agenda buffer (but not
3352during date selection). 3635during date selection).
3636
3353@example 3637@example
3354S-UP -> M-p S-DOWN -> M-n 3638S-UP -> M-p S-DOWN -> M-n
3355S-LEFT -> M-- S-RIGHT -> M-+ 3639S-LEFT -> M-- S-RIGHT -> M-+
3356S-RET -> C-S-RET 3640S-RET -> C-S-RET
3357@end example 3641@end example
3642
3358Yes, these are unfortunately more difficult to remember. If you want 3643Yes, these are unfortunately more difficult to remember. If you want
3359to have other replacement keys, look at the variable 3644to have other replacement keys, look at the variable
3360@code{org-disputed-keys}. 3645@code{org-disputed-keys}.
3361@item @file{remember.el} by John Wiegley 3646@item @file{remember.el} by John Wiegley
3362Org mode cooperates with remember, see @ref{Remember}. 3647Org mode cooperates with remember, see @ref{Remember}.
3363@file{Remember.el} is not part of Emacs, find it on the web. 3648@file{Remember.el} is not part of Emacs, find it on the web.
3364@cindex @file{planner.el}
3365@item @file{planner.el} by John Wiegley
3366Planner is another tool to plan work and keep track of tasks. Planner
3367uses a multi-file approach with project pages and day pages. Is based
3368on Emacs-Wiki. If Planner is your primary tool, it can be useful to
3369display the agenda entries resulting from org files in day-pages of
3370the planner. This can be done through the diary of the calendar:
3371Integrate org files into the diary as described above, and then turn
3372on the diary support of planner. Planner is not part of Emacs, find it
3373on the web.
3374@end table 3649@end table
3375 3650
3376@node Bugs, Acknowledgments, Interaction, Miscellaneous 3651@node Bugs, Acknowledgments, Interaction, Miscellaneous
3377@section Bugs 3652@section Bugs
3378@cindex bugs 3653@cindex bugs
3379 3654
3380Here is a list of things which should work differently, but which I 3655Here is a list of things that should work differently, but which I
3381have found too hard to fix. 3656have found too hard to fix.
3382 3657
3383@itemize @bullet 3658@itemize @bullet
3384@item 3659@item
3660If a table field starts with a link, and if the corresponding table
3661column is narrowed (@pxref{Narrow columns}) to a width too small to
3662display the link, the field would look entirely empty even though it is
3663not. To prevent this, Org-mode throws an error. The work-around is to
3664make the column wide enough to fit the link, or to add some text (at
3665least 2 characters) before the link in the same field.
3666@item
3667Narrowing table columns does not work on XEmacs, because the
3668@code{format} function does not transport text properties.
3669@item
3385Text in an entry protected with the @samp{QUOTE} keyword should not 3670Text in an entry protected with the @samp{QUOTE} keyword should not
3386autowrap. 3671autowrap.
3387@item 3672@item
@@ -3415,8 +3700,6 @@ several words in a row, each must have the emphasize markers, like in
3415The exporters work well, but could be made more efficient. 3700The exporters work well, but could be made more efficient.
3416@end itemize 3701@end itemize
3417 3702
3418@page
3419
3420@node Acknowledgments, , Bugs, Miscellaneous 3703@node Acknowledgments, , Bugs, Miscellaneous
3421@section Acknowledgments 3704@section Acknowledgments
3422@cindex acknowledgments 3705@cindex acknowledgments
@@ -3432,37 +3715,41 @@ Org-mode would not be what it is without your input.
3432@item 3715@item
3433Thomas Baumann contributed the code for links to the MH-E email system. 3716Thomas Baumann contributed the code for links to the MH-E email system.
3434@item 3717@item
3435Pavel Chalmoviansky reported bugs and suggested improvements 3718Alex Bochannek provided a patch for rounding time stamps.
3436related to the agenda treatment of items with specified time. 3719@item
3720Charles Caves' suggestion sparked the implementation of templates for
3721Remember.
3722@item
3723Pavel Chalmoviansky influenced the agenda treatment of items with
3724specified time.
3725@item
3726Sacha Chua suggested to copy some linking code from Planner.
3437@item 3727@item
3438Sacha Chua, the current maintainer of Planner, suggested to copy 3728Christian Egli converted the documentation into TeXInfo format, patched
3439linking code from Planner (I took code for RMAIL and Wanderlust). 3729CSS formatting into the HTML exporter, and inspired the agenda.
3440@item 3730@item
3441Christian Egli converted the documentation into TeXInfo format and 3731Nic Ferrier contributed mailcap and XML support.
3442patched basic CSS formatting support into the HTML exporter. He also
3443inspired the agenda by showing me his plans for a multifile summary.
3444@item 3732@item
3445Kai Grossjohann pointed out that a number of key bindings in Org-mode 3733Kai Grossjohann pointed out key-binding conflicts caused by Org-mode.
3446conflict with other packages.
3447@item 3734@item
3448Stefan Monnier provided a patch with lots of little fixes to keep the 3735Stefan Monnier provided a patch to keep the Emacs-Lisp compiler happy.
3449Emacs-Lisp compiler happy.
3450@item 3736@item
3451Tim O'Callaghan suggested in-file links, search options for 3737Tim O'Callaghan suggested in-file links, search options for
3452general file links, and TAGS. 3738general file links, and TAGS.
3453@item 3739@item
3454Oliver Oppitz suggested multi-state TODO items. 3740Oliver Oppitz suggested multi-state TODO items.
3455@item 3741@item
3456Pete Phillips helped the development of the TAGS feature with beta 3742Scott Otterson sparked the introduction of descriptive text for links,
3457testing and suggestions. 3743among other things.
3458@item 3744@item
3459Matthias Rempe (Oelde) provided ideas, a patch introducing Windows 3745Pete Phillips helped the development of the TAGS feature.
3460NT/2000 support, and quality control. 3746@item
3747Matthias Rempe (Oelde) provided ideas, Windows support, and quality
3748control.
3461@item 3749@item
3462Kevin Rogers contributed code to access VM files on remote hosts. 3750Kevin Rogers contributed code to access VM files on remote hosts.
3463@item 3751@item
3464Philip Rooke created the Org-mode reference card. He also helped with 3752Philip Rooke created the Org-mode reference card and provided lots of feedback.
3465beta testing and contributed a number of very useful ideas.
3466@item 3753@item
3467Christian Schlauer proposed angular brackets around links, among other 3754Christian Schlauer proposed angular brackets around links, among other
3468things. 3755things.
@@ -3470,28 +3757,31 @@ things.
3470Linking to VM/BBDB/GNUS was inspired by Tom Shannon's 3757Linking to VM/BBDB/GNUS was inspired by Tom Shannon's
3471@file{organizer-mode.el}. 3758@file{organizer-mode.el}.
3472@item 3759@item
3473Juergen Vollmer contributed code generating the table of contents 3760J@"urgen Vollmer contributed code generating the table of contents
3474in HTML output, and other export improvements. 3761in HTML output.
3475@item 3762@item
3476Chris Wallace provided a patch implementing the @samp{QUOTE} keyword. 3763Chris Wallace provided a patch implementing the @samp{QUOTE} keyword.
3477@item 3764@item
3478David Wainberg suggested the archiving mechanism and shaped the 3765David Wainberg suggested archiving, and improvements to the linking
3479internal link system with many suggestions and ideas. 3766system.
3480@item 3767@item
3481Scheduling TODO items was inspired by John Wiegley's @file{planner.el}. 3768John Wiegley wrote @file{emacs-wiki.el} and @file{planner.el}. The
3769development of Org-mode was fully independent, and both systems are
3770really different beasts in their basic ideas and implementation details.
3771However, I have later looked at John's code and learned from his
3772implementation of (i) links where the link itself is hidden and only a
3773description is shown, and (ii) popping up a calendar to select a date.
3482@item 3774@item
3483Carsten Wimmer suggested some changes and helped fix a bug in linking 3775Carsten Wimmer suggested some changes and helped fix a bug in linking
3484to GNUS. 3776to GNUS.
3485@item
3486Roland Winkler pointed out that additional keybindings are needed to
3487use Org-mode on a tty.
3488@item 3777@item
3489Piotr Zielinski wrote @file{org-mouse.el} and pointed out to me that 3778Roland Winkler requested additional keybindings to make Org-mode
3490Emacs 22 can be made to follow links using mouse-1 clicks. 3779work on a tty.
3491@c @item 3780@item
3492@c Nic Ferrier and Christian Egli implemented XML export. 3781Piotr Zielinski wrote @file{org-mouse.el} and showed how to follow links
3782with mouse-1.
3493@end itemize 3783@end itemize
3494 3784
3495@node Index, Key Index, Miscellaneous, Top 3785@node Index, Key Index, Miscellaneous, Top
3496@chapter Index 3786@chapter Index
3497 3787
diff --git a/src/ChangeLog b/src/ChangeLog
index d5e4d20111e..936b14089b4 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,23 @@
12006-04-11 Dan Nicolaescu <dann@ics.uci.edu>
2
3 * lisp.h (wrong_type_argument): Mark as NO_RETURN.
4
5 * data.c (wrong_type_argument): Try to avoid compiler warnings due
6 to the fact the function is now marked as NO_RETURN.
7
82006-04-10 Eli Zaretskii <eliz@gnu.org>
9
10 * s/ms-w32.h (pid_t) [_MSC_VER]: New typedef.
11
122006-04-10 Romain Francoise <romain@orebokech.com>
13
14 * xrdb.c (gethomedir): Use xstrdup.
15
162006-04-10 Andreas Schwab <schwab@suse.de>
17
18 * xrdb.c (gethomedir): Make sure to always return a pointer that
19 can be passed to free.
20
12006-04-09 Richard Stallman <rms@gnu.org> 212006-04-09 Richard Stallman <rms@gnu.org>
2 22
3 * lisp.h (Fkill_emacs): Undo previous change. 23 * lisp.h (Fkill_emacs): Undo previous change.
diff --git a/src/data.c b/src/data.c
index d2f6ce76905..fdad80b2727 100644
--- a/src/data.c
+++ b/src/data.c
@@ -126,7 +126,14 @@ wrong_type_argument (predicate, value)
126 tem = call1 (predicate, value); 126 tem = call1 (predicate, value);
127 } 127 }
128 while (NILP (tem)); 128 while (NILP (tem));
129 /* This function is marked as NO_RETURN, gcc would warn if it has a
130 return statement or if falls off the function. Other compilers
131 warn if no return statement is present. */
132#ifndef __GNUC__
129 return value; 133 return value;
134#else
135 abort ();
136#endif
130} 137}
131 138
132void 139void
diff --git a/src/lisp.h b/src/lisp.h
index c28c981daf9..468b699fb06 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2246,7 +2246,7 @@ extern unsigned long cons_to_long P_ ((Lisp_Object));
2246extern void args_out_of_range P_ ((Lisp_Object, Lisp_Object)) NO_RETURN; 2246extern void args_out_of_range P_ ((Lisp_Object, Lisp_Object)) NO_RETURN;
2247extern void args_out_of_range_3 P_ ((Lisp_Object, Lisp_Object, 2247extern void args_out_of_range_3 P_ ((Lisp_Object, Lisp_Object,
2248 Lisp_Object)) NO_RETURN; 2248 Lisp_Object)) NO_RETURN;
2249extern Lisp_Object wrong_type_argument P_ ((Lisp_Object, Lisp_Object)); 2249extern Lisp_Object wrong_type_argument P_ ((Lisp_Object, Lisp_Object)) NO_RETURN;
2250extern void store_symval_forwarding P_ ((Lisp_Object, Lisp_Object, 2250extern void store_symval_forwarding P_ ((Lisp_Object, Lisp_Object,
2251 Lisp_Object, struct buffer *)); 2251 Lisp_Object, struct buffer *));
2252extern Lisp_Object do_symval_forwarding P_ ((Lisp_Object)); 2252extern Lisp_Object do_symval_forwarding P_ ((Lisp_Object));
diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h
index 5c6d1d07c20..3e5d9c865bb 100644
--- a/src/s/ms-w32.h
+++ b/src/s/ms-w32.h
@@ -365,6 +365,9 @@ Boston, MA 02110-1301, USA. */
365#define ftruncate _chsize 365#define ftruncate _chsize
366#define getw _getw 366#define getw _getw
367#define getpid _getpid 367#define getpid _getpid
368#ifdef _MSC_VER
369typedef int pid_t;
370#endif
368#define isatty _isatty 371#define isatty _isatty
369#define logb _logb 372#define logb _logb
370#define _longjmp longjmp 373#define _longjmp longjmp
diff --git a/src/xrdb.c b/src/xrdb.c
index 2b7888ebe84..988db614c41 100644
--- a/src/xrdb.c
+++ b/src/xrdb.c
@@ -315,7 +315,7 @@ gethomedir ()
315 } 315 }
316 316
317 if (ptr == NULL) 317 if (ptr == NULL)
318 return "/"; 318 return xstrdup ("/");
319 319
320 copy = (char *) malloc (strlen (ptr) + 2); 320 copy = (char *) malloc (strlen (ptr) + 2);
321 strcpy (copy, ptr); 321 strcpy (copy, ptr);