aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Dominik2005-06-13 06:42:53 +0000
committerCarsten Dominik2005-06-13 06:42:53 +0000
commit30313b908d672bd3949df266e8d8a4fd527fa80c (patch)
tree1f465ea5c9804728d7fd71ec49ef9b54e589e6ae
parent1e539d255bef9e76a8eaa781f69db71f57b636f5 (diff)
downloademacs-30313b908d672bd3949df266e8d8a4fd527fa80c.tar.gz
emacs-30313b908d672bd3949df266e8d8a4fd527fa80c.zip
(org-CUA-compatible): New option.
(org-disputed-keys): New variable. (org-key): New function. (orgtbl-make-binding): Add docstring to the created function. (org-mode): Set paragraph start/separate regexps. (orgtbl-mode): Don't start `orgtbl-mode' in `org-mode' buffers. (org-archive-location, org-archive-mark-done) (org-archive-stamp-time): New options. (org-archive-subtree): New command. (org-fill-paragraph): New function. (org-mode): Set `fill-paragraph-function' to `org-fill-paragraph'. (org-fake-empty-table-line): Function removed. (org-format-org-table-html): Do not create empty table lines at separator lines. Improved table header treatment. (org-link-format): New option. (org-make-link): New function. (org-insert-link, org-store-link): Use org-make-link. (org-open-file): Quote file name for shell command, to allow spaces in file names. (org-link-regexp): Fixed bug with mailto link. (org-link-maybe-angles-regexp, org-protected-link-regexp): New constant. (org-export-as-html): Deal with the optional angles around a link. Better treatment of file: links. (org-open-at-point): Replace @{ and @} with < and >. (org-run-mode-hooks): Function removed. (org-agenda-mode): No longer use `org-run-mode-hooks'.
-rw-r--r--lisp/ChangeLog30
-rw-r--r--lisp/textmodes/org.el671
-rw-r--r--man/ChangeLog4
3 files changed, 496 insertions, 209 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 379fb41cbba..ee10a5f787e 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,33 @@
12005-06-13 Carsten Dominik <dominik@science.uva.nl>
2
3 * textmodes/org.el: (org-CUA-compatible): New option.
4 (org-disputed-keys): New variable.
5 (org-key): New function.
6 (orgtbl-make-binding): Add docstring to the created function.
7 (org-mode): Set paragraph start/separate regexps.
8 (orgtbl-mode): Don't start `orgtbl-mode' in `org-mode' buffers.
9 (org-archive-location, org-archive-mark-done)
10 (org-archive-stamp-time): New options.
11 (org-archive-subtree): New command.
12 (org-fill-paragraph): New function.
13 (org-mode): Set `fill-paragraph-function' to `org-fill-paragraph'.
14 (org-fake-empty-table-line): Function removed.
15 (org-format-org-table-html): Do not create empty table lines at
16 separator lines. Improved table header treatment.
17 (org-link-format): New option.
18 (org-make-link): New function.
19 (org-insert-link, org-store-link): Use org-make-link.
20 (org-open-file): Quote file name for shell command, to allow
21 spaces in file names.
22 (org-link-regexp): Fixed bug with mailto link.
23 (org-link-maybe-angles-regexp, org-protected-link-regexp): New
24 constant.
25 (org-export-as-html): Deal with the optional angles around a link.
26 Better treatment of file: links.
27 (org-open-at-point): Replace @{ and @} with < and >.
28 (org-run-mode-hooks): Function removed.
29 (org-agenda-mode): No longer use `org-run-mode-hooks'.
30
12005-06-13 Nick Roberts <nickrob@snap.net.nz> 312005-06-13 Nick Roberts <nickrob@snap.net.nz>
2 32
3 * progmodes/gdb-ui.el (gdb-registers-mode): Let gdbmi use 33 * progmodes/gdb-ui.el (gdb-registers-mode): Let gdbmi use
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el
index 1a9e97dd0b9..bfb2a81294e 100644
--- a/lisp/textmodes/org.el
+++ b/lisp/textmodes/org.el
@@ -1,11 +1,11 @@
1;; org.el --- Outline-based notes management and organizer 1;;; org.el --- Outline-based notes management and organizer
2;; Carstens outline-mode for keeping track of everything. 2;; Carstens outline-mode for keeping track of everything.
3;; Copyright (c) 2004, 2005 Free Software Foundation 3;; Copyright (c) 2004, 2005 Free Software Foundation
4;; 4;;
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 6;; Keywords: outlines, hypermedia, calendar
7;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ 7;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/
8;; Version: 3.10 8;; Version: 3.11
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
@@ -80,6 +80,17 @@
80;; 80;;
81;; Changes: 81;; Changes:
82;; ------- 82;; -------
83;; Version 3.11
84;; - Links inserted with C-c C-l are now by default enclosed in angle
85;; brackets. See the new variable `org-link-format'.
86;; - ">" terminates a link, this is a way to have several links in a line.
87;; - Archiving of finished tasks.
88;; - C-<up>/<down> bindings removed, to allow access to paragraph commands.
89;; - Compatibility with CUA-mode (see variable `org-CUA-compatible').
90;; - Compatibility problems with viper-mode fixed.
91;; - Improved html export of tables.
92;; - Various clean-up changes.
93;;
83;; Version 3.10 94;; Version 3.10
84;; - Using `define-derived-mode' to derive `org-mode' from `outline-mode'. 95;; - Using `define-derived-mode' to derive `org-mode' from `outline-mode'.
85;; 96;;
@@ -157,7 +168,7 @@
157 168
158;;; Customization variables 169;;; Customization variables
159 170
160(defvar org-version "3.10" 171(defvar org-version "3.11"
161 "The version number of the file org.el.") 172 "The version number of the file org.el.")
162(defun org-version () 173(defun org-version ()
163 (interactive) 174 (interactive)
@@ -183,6 +194,44 @@
183 :tag "Org Startup" 194 :tag "Org Startup"
184 :group 'org) 195 :group 'org)
185 196
197(defcustom org-CUA-compatible nil
198 "Non-nil means use alternative key bindings for S-<cursor movement>.
199Org-mode used S-<cursor movement> for changing timestamps and priorities.
200S-<cursor movement> is also used for example by `CUA-mode' to select text.
201If you want to use Org-mode together with `CUA-mode', Org-mode needs to use
202alternative bindings. Setting this variable to t will replace the following
203keys both in Org-mode and in the Org-agenda buffer.
204
205S-RET -> C-S-RET
206S-up -> M-p
207S-down -> M-n
208S-left -> M--
209S-right -> M-+
210
211If you do not like the alternative keys, take a look at the variable
212`org-disputed-keys'.
213
214This option is only relevant at load-time of Org-mode. Changing it requires
215a restart of Emacs to become effective."
216 :group 'org-startup
217 :type 'boolean)
218
219(defvar org-disputed-keys
220 '((S-up [(shift up)] [(meta ?p)])
221 (S-down [(shift down)] [(meta ?n)])
222 (S-left [(shift left)] [(meta ?-)])
223 (S-right [(shift right)] [(meta ?+)])
224 (S-return [(shift return)] [(control shift return)]))
225 "Keys for which Org-mode and other modes compete.
226This is an alist, cars are symbols for lookup, 1st element is the default key,
227second element will be used when `org-CUA-compatible' is t.")
228
229(defun org-key (key)
230 "Select a key according to `org-CUA-compatible'."
231 (nth (if org-CUA-compatible 2 1)
232 (or (assq key org-disputed-keys)
233 (error "Invalid Key %s in `org-key'" key))))
234
186(defcustom org-startup-folded t 235(defcustom org-startup-folded t
187 "Non-nil means, entering Org-mode will switch to OVERVIEW. 236 "Non-nil means, entering Org-mode will switch to OVERVIEW.
188This can also be configured on a per-file basis by adding one of 237This can also be configured on a per-file basis by adding one of
@@ -382,19 +431,14 @@ or contain a special line
382If the file does not specify a category, then file's base name 431If the file does not specify a category, then file's base name
383is used instead.") 432is used instead.")
384 433
385(defun org-run-mode-hooks (&rest hooks)
386 "Call `run-mode-hooks' if it is available; otherwise call `run-hooks'."
387 (if (fboundp 'run-mode-hooks)
388 (apply 'run-mode-hooks hooks)
389 (apply 'run-hooks hooks)))
390
391(defun org-set-regexps-and-options () 434(defun org-set-regexps-and-options ()
392 "Precompute regular expressions for current buffer." 435 "Precompute regular expressions for current buffer."
393 (when (eq major-mode 'org-mode) 436 (when (eq major-mode 'org-mode)
394 (let ((re (org-make-options-regexp 437 (let ((re (org-make-options-regexp
395 '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO" "STARTUP"))) 438 '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO"
439 "STARTUP" "ARCHIVE")))
396 (splitre "[ \t]+") 440 (splitre "[ \t]+")
397 kwds int key value cat) 441 kwds int key value cat arch)
398 (save-excursion 442 (save-excursion
399 (save-restriction 443 (save-restriction
400 (widen) 444 (widen)
@@ -425,10 +469,16 @@ is used instead.")
425 l var val) 469 l var val)
426 (while (setq l (assoc (pop opts) set)) 470 (while (setq l (assoc (pop opts) set))
427 (setq var (nth 1 l) val (nth 2 l)) 471 (setq var (nth 1 l) val (nth 2 l))
428 (set (make-local-variable var) val))))) 472 (set (make-local-variable var) val))))
473 ((equal key "ARCHIVE")
474 (string-match " *$" value)
475 (setq arch (replace-match "" t t value))
476 (remove-text-properties 0 (length arch)
477 '(face t fontified t) arch)))
429 ))) 478 )))
430 (and cat (set (make-local-variable 'org-category) cat)) 479 (and cat (set (make-local-variable 'org-category) cat))
431 (and kwds (set (make-local-variable 'org-todo-keywords) kwds)) 480 (and kwds (set (make-local-variable 'org-todo-keywords) kwds))
481 (and arch (set (make-local-variable 'org-archive-location) arch))
432 (and int (set (make-local-variable 'org-todo-interpretation) int))) 482 (and int (set (make-local-variable 'org-todo-interpretation) int)))
433 ;; Compute the regular expressions and other local variables 483 ;; Compute the regular expressions and other local variables
434 (setq org-todo-kwd-priority-p (equal org-todo-interpretation 'priority) 484 (setq org-todo-kwd-priority-p (equal org-todo-interpretation 'priority)
@@ -469,6 +519,11 @@ is used instead.")
469 :tag "Org Time" 519 :tag "Org Time"
470 :group 'org) 520 :group 'org)
471 521
522(defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>")
523 "Formats for `format-time-string' which are used for time stamps.
524It is not recommended to change this constant.")
525
526
472(defcustom org-deadline-warning-days 30 527(defcustom org-deadline-warning-days 30
473 "No. of days before expiration during which a deadline becomes active. 528 "No. of days before expiration during which a deadline becomes active.
474This variable governs the display in the org file." 529This variable governs the display in the org file."
@@ -672,7 +727,19 @@ the variable `org-agenda-time-grid'."
672 "----------------" 727 "----------------"
673 (800 1000 1200 1400 1600 1800 2000)) 728 (800 1000 1200 1400 1600 1800 2000))
674 729
675 "FIXME: document" 730 "The settings for time grid for agenda display.
731This is a list of three items. The first item is again a list. It contains
732symbols specifying conditions when the grid should be displayed:
733
734 daily if the agenda shows a single day
735 weekly if the agenda shows an entire week
736 today show grid on current date, independent of daily/weekly display
737 require-timed show grid only if at least on item has a time specification
738
739The second item is a string which will be places behing the grid time.
740
741The third item is a list of integers, indicating the times that should have
742a grid line."
676 :group 'org-agenda 743 :group 'org-agenda
677 :type 744 :type
678 '(list 745 '(list
@@ -756,10 +823,6 @@ t Everywhere except in headlines"
756 (const :tag "Everywhere except in headlines" t) 823 (const :tag "Everywhere except in headlines" t)
757 )) 824 ))
758 825
759(defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>")
760 "Formats for `format-time-string' which are used for time stamps.
761It is not recommended to change this constant.")
762
763(defcustom org-show-following-heading t 826(defcustom org-show-following-heading t
764 "Non-nil means, show heading following match in `org-occur'. 827 "Non-nil means, show heading following match in `org-occur'.
765When doing an `org-occur' it is useful to show the headline which 828When doing an `org-occur' it is useful to show the headline which
@@ -770,12 +833,73 @@ unnecessary clutter."
770 :group 'org-structure 833 :group 'org-structure
771 :type 'boolean) 834 :type 'boolean)
772 835
836(defcustom org-archive-location "%s_archive::"
837 "The location where subtrees should be archived.
838This string consists of two parts, separated by a double-colon.
839
840The first part is a file name - when omitted, archiving happens in the same
841file. %s will be replaced by the current file name (without directory part).
842Archiving to a different file is useful to keep archived entries from
843contributing to the Org-mode Agenda.
844
845The part after the double colon is a headline. The archived entries will be
846filed under that headline. When omitted, the subtrees are simply filed away
847at the end of the file, as top-level entries.
848
849Here are a few examples:
850\"%s_archive::\"
851 If the current file is Projects.org, archive in file
852 Projects.org_archive, as top-level trees. This is the default.
853
854\"::* Archived Tasks\"
855 Archive in the current file, under the top-level headline
856 \"* Archived Tasks\".
857
858\"~/org/archive.org::\"
859 Archive in file ~/org/archive.org (absolute path), as top-level trees.
860
861\"basement::** Finished Tasks\"
862 Archive in file ./basement (relative path), as level 3 trees
863 below the level 2 heading \"** Finished Tasks\".
864
865You may set this option on a per-file basis by adding to the buffer a
866line like
867
868#+ARCHIVE: basement::** Finished Tasks"
869 :group 'org-structure
870 :type 'string)
871
872(defcustom org-archive-mark-done t
873 "Non-nil means, mark archived entries as DONE."
874 :group 'org-structure
875 :type 'boolean)
876
877(defcustom org-archive-stamp-time t
878 "Non-nil means, add a time stamp to archived entries.
879The time stamp will be added directly after the TODO state keyword in the
880first line, so it is probably best to use this in combinations with
881`org-archive-mark-done'."
882 :group 'org-structure
883 :type 'boolean)
773 884
774(defgroup org-link nil 885(defgroup org-link nil
775 "Options concerning links in Org-mode." 886 "Options concerning links in Org-mode."
776 :tag "Org Link" 887 :tag "Org Link"
777 :group 'org) 888 :group 'org)
778 889
890(defcustom org-link-format "<%s>"
891 "Default format for linkes in the buffer.
892This is a format string for printf, %s will be replaced by the link text.
893If you want to make sure that your link is always properly terminated,
894include angle brackets into this format, like \"<%s>\". Some people also
895recommend an additional URL: prefix, so the format would be \"<URL:%s>\"."
896 :group 'org-link
897 :type '(choice
898 (const :tag "\"%s\" (e.g. http://www.there.com)" "%s")
899 (const :tag "\"<%s>\" (e.g. <http://www.there.com>)" "<%s>")
900 (const :tag "\"<URL:%s>\" (e.g. <URL:http://www.there.com>)" "<URL:%s>")
901 (string :tag "Other" :value "<%s>")))
902
779(defcustom org-allow-space-in-links t 903(defcustom org-allow-space-in-links t
780 "Non-nil means, file names in links may contain space characters. 904 "Non-nil means, file names in links may contain space characters.
781When nil, it becomes possible to put several links into a line. 905When nil, it becomes possible to put several links into a line.
@@ -1321,8 +1445,6 @@ Otherwise, the buffer will just be saved to a file and stay hidden."
1321 (t (:inverse-video t :bold t))) 1445 (t (:inverse-video t :bold t)))
1322 "Face used for level 1 headlines." 1446 "Face used for level 1 headlines."
1323 :group 'org-faces) 1447 :group 'org-faces)
1324;; backward-compatibility alias
1325(put 'org-level-1-face 'face-alias 'org-level-1)
1326 1448
1327(defface org-level-2 ;; font-lock-variable-name-face 1449(defface org-level-2 ;; font-lock-variable-name-face
1328 '((((type tty) (class color)) (:foreground "yellow" :weight light)) 1450 '((((type tty) (class color)) (:foreground "yellow" :weight light))
@@ -1331,8 +1453,6 @@ Otherwise, the buffer will just be saved to a file and stay hidden."
1331 (t (:bold t :italic t))) 1453 (t (:bold t :italic t)))
1332 "Face used for level 2 headlines." 1454 "Face used for level 2 headlines."
1333 :group 'org-faces) 1455 :group 'org-faces)
1334;; backward-compatibility alias
1335(put 'org-level-2-face 'face-alias 'org-level-2)
1336 1456
1337(defface org-level-3 ;; font-lock-keyword-face 1457(defface org-level-3 ;; font-lock-keyword-face
1338 '((((type tty) (class color)) (:foreground "cyan" :weight bold)) 1458 '((((type tty) (class color)) (:foreground "cyan" :weight bold))
@@ -1341,10 +1461,8 @@ Otherwise, the buffer will just be saved to a file and stay hidden."
1341 (t (:bold t))) 1461 (t (:bold t)))
1342 "Face used for level 3 headlines." 1462 "Face used for level 3 headlines."
1343 :group 'org-faces) 1463 :group 'org-faces)
1344;; backward-compatibility alias
1345(put 'org-level-3-face 'face-alias 'org-level-3)
1346 1464
1347(defface org-level-4 ;; font-lock-comment-face 1465(defface org-level-4 ;; font-lock-comment-face
1348 '((((type tty pc) (class color) (background light)) (:foreground "red")) 1466 '((((type tty pc) (class color) (background light)) (:foreground "red"))
1349 (((type tty pc) (class color) (background dark)) (:foreground "red1")) 1467 (((type tty pc) (class color) (background dark)) (:foreground "red1"))
1350 (((class color) (background light)) (:foreground "Firebrick")) 1468 (((class color) (background light)) (:foreground "Firebrick"))
@@ -1352,8 +1470,6 @@ Otherwise, the buffer will just be saved to a file and stay hidden."
1352 (t (:bold t :italic t))) 1470 (t (:bold t :italic t)))
1353 "Face used for level 4 headlines." 1471 "Face used for level 4 headlines."
1354 :group 'org-faces) 1472 :group 'org-faces)
1355;; backward-compatibility alias
1356(put 'org-level-4-face 'face-alias 'org-level-4)
1357 1473
1358(defface org-level-5 ;; font-lock-type-face 1474(defface org-level-5 ;; font-lock-type-face
1359 '((((type tty) (class color)) (:foreground "green")) 1475 '((((type tty) (class color)) (:foreground "green"))
@@ -1362,8 +1478,6 @@ Otherwise, the buffer will just be saved to a file and stay hidden."
1362 (t (:bold t :underline t))) 1478 (t (:bold t :underline t)))
1363 "Face used for level 5 headlines." 1479 "Face used for level 5 headlines."
1364 :group 'org-faces) 1480 :group 'org-faces)
1365;; backward-compatibility alias
1366(put 'org-level-5-face 'face-alias 'org-level-5)
1367 1481
1368(defface org-level-6 ;; font-lock-constant-face 1482(defface org-level-6 ;; font-lock-constant-face
1369 '((((type tty) (class color)) (:foreground "magenta")) 1483 '((((type tty) (class color)) (:foreground "magenta"))
@@ -1372,8 +1486,6 @@ Otherwise, the buffer will just be saved to a file and stay hidden."
1372 (t (:bold t :underline t))) 1486 (t (:bold t :underline t)))
1373 "Face used for level 6 headlines." 1487 "Face used for level 6 headlines."
1374 :group 'org-faces) 1488 :group 'org-faces)
1375;; backward-compatibility alias
1376(put 'org-level-6-face 'face-alias 'org-level-6)
1377 1489
1378(defface org-level-7 ;; font-lock-builtin-face 1490(defface org-level-7 ;; font-lock-builtin-face
1379 '((((type tty) (class color)) (:foreground "blue" :weight light)) 1491 '((((type tty) (class color)) (:foreground "blue" :weight light))
@@ -1382,8 +1494,6 @@ Otherwise, the buffer will just be saved to a file and stay hidden."
1382 (t (:bold t))) 1494 (t (:bold t)))
1383 "Face used for level 7 headlines." 1495 "Face used for level 7 headlines."
1384 :group 'org-faces) 1496 :group 'org-faces)
1385;; backward-compatibility alias
1386(put 'org-level-7-face 'face-alias 'org-level-7)
1387 1497
1388(defface org-level-8 ;; font-lock-string-face 1498(defface org-level-8 ;; font-lock-string-face
1389 '((((type tty) (class color)) (:foreground "green")) 1499 '((((type tty) (class color)) (:foreground "green"))
@@ -1392,8 +1502,6 @@ Otherwise, the buffer will just be saved to a file and stay hidden."
1392 (t (:italic t))) 1502 (t (:italic t)))
1393 "Face used for level 8 headlines." 1503 "Face used for level 8 headlines."
1394 :group 'org-faces) 1504 :group 'org-faces)
1395;; backward-compatibility alias
1396(put 'org-level-8-face 'face-alias 'org-level-8)
1397 1505
1398(defface org-warning ;; font-lock-warning-face 1506(defface org-warning ;; font-lock-warning-face
1399 '((((type tty) (class color)) (:foreground "red")) 1507 '((((type tty) (class color)) (:foreground "red"))
@@ -1403,14 +1511,12 @@ Otherwise, the buffer will just be saved to a file and stay hidden."
1403 (t (:inverse-video t :bold t))) 1511 (t (:inverse-video t :bold t)))
1404 "Face for deadlines and TODO keywords." 1512 "Face for deadlines and TODO keywords."
1405 :group 'org-faces) 1513 :group 'org-faces)
1406;; backward-compatibility alias
1407(put 'org-warning-face 'face-alias 'org-warning)
1408 1514
1409(defcustom org-fontify-done-headline nil 1515(defcustom org-fontify-done-headline nil
1410 "Non-nil means, change the face of a headline if it is marked DONE. 1516 "Non-nil means, change the face of a headline if it is marked DONE.
1411Normally, only the TODO/DONE keyword indicates the state of a headline. 1517Normally, only the TODO/DONE keyword indicates the state of a headline.
1412When this is non-nil, the headline after the keyword is set to the 1518When this is non-nil, the headline after the keyword is set to the
1413`org-headline-done-face' as an additional indication." 1519`org-headline-done' as an additional indication."
1414 :group 'org-faces 1520 :group 'org-faces
1415 :type 'boolean) 1521 :type 'boolean)
1416 1522
@@ -1422,8 +1528,6 @@ When this is non-nil, the headline after the keyword is set to the
1422 "Face used to indicate that a headline is DONE. See also the variable 1528 "Face used to indicate that a headline is DONE. See also the variable
1423`org-fontify-done-headline'." 1529`org-fontify-done-headline'."
1424 :group 'org-faces) 1530 :group 'org-faces)
1425;; backward-compatibility alias
1426(put 'org-headline-done-face 'face-alias 'org-headline-done)
1427 1531
1428;; Inheritance does not yet work for xemacs. So we just copy... 1532;; Inheritance does not yet work for xemacs. So we just copy...
1429 1533
@@ -1434,8 +1538,6 @@ When this is non-nil, the headline after the keyword is set to the
1434 (t (:inverse-video t :bold t))) 1538 (t (:inverse-video t :bold t)))
1435 "Face for upcoming deadlines." 1539 "Face for upcoming deadlines."
1436 :group 'org-faces) 1540 :group 'org-faces)
1437;; backward-compatibility alias
1438(put 'org-deadline-announce-face 'face-alias 'org-deadline-announce)
1439 1541
1440(defface org-scheduled-today 1542(defface org-scheduled-today
1441 '((((type tty) (class color)) (:foreground "green")) 1543 '((((type tty) (class color)) (:foreground "green"))
@@ -1444,8 +1546,6 @@ When this is non-nil, the headline after the keyword is set to the
1444 (t (:bold t :underline t))) 1546 (t (:bold t :underline t)))
1445 "Face for items scheduled for a certain day." 1547 "Face for items scheduled for a certain day."
1446 :group 'org-faces) 1548 :group 'org-faces)
1447;; backward-compatibility alias
1448(put 'org-scheduled-today-face 'face-alias 'org-scheduled-today)
1449 1549
1450(defface org-scheduled-previously 1550(defface org-scheduled-previously
1451 '((((type tty pc) (class color) (background light)) (:foreground "red")) 1551 '((((type tty pc) (class color) (background light)) (:foreground "red"))
@@ -1455,8 +1555,6 @@ When this is non-nil, the headline after the keyword is set to the
1455 (t (:bold t :italic t))) 1555 (t (:bold t :italic t)))
1456 "Face for items scheduled previously, and not yet done." 1556 "Face for items scheduled previously, and not yet done."
1457 :group 'org-faces) 1557 :group 'org-faces)
1458;; backward-compatibility alias
1459(put 'org-scheduled-previously-face 'face-alias 'org-scheduled-previously)
1460 1558
1461(defface org-link 1559(defface org-link
1462 '((((type tty) (class color)) (:foreground "cyan" :weight bold)) 1560 '((((type tty) (class color)) (:foreground "cyan" :weight bold))
@@ -1465,8 +1563,6 @@ When this is non-nil, the headline after the keyword is set to the
1465 (t (:bold t))) 1563 (t (:bold t)))
1466 "Face for links." 1564 "Face for links."
1467 :group 'org-faces) 1565 :group 'org-faces)
1468;; backward-compatibility alias
1469(put 'org-link-face 'face-alias 'org-link)
1470 1566
1471(defface org-done ;; font-lock-type-face 1567(defface org-done ;; font-lock-type-face
1472 '((((type tty) (class color)) (:foreground "green")) 1568 '((((type tty) (class color)) (:foreground "green"))
@@ -1475,8 +1571,6 @@ When this is non-nil, the headline after the keyword is set to the
1475 (t (:bold t :underline t))) 1571 (t (:bold t :underline t)))
1476 "Face used for DONE." 1572 "Face used for DONE."
1477 :group 'org-faces) 1573 :group 'org-faces)
1478;; backward-compatibility alias
1479(put 'org-done-face 'face-alias 'org-done)
1480 1574
1481(defface org-table ;; font-lock-function-name-face 1575(defface org-table ;; font-lock-function-name-face
1482 '((((type tty) (class color)) (:foreground "blue" :weight bold)) 1576 '((((type tty) (class color)) (:foreground "blue" :weight bold))
@@ -1485,8 +1579,6 @@ When this is non-nil, the headline after the keyword is set to the
1485 (t (:inverse-video t :bold t))) 1579 (t (:inverse-video t :bold t)))
1486 "Face used for tables." 1580 "Face used for tables."
1487 :group 'org-faces) 1581 :group 'org-faces)
1488;; backward-compatibility alias
1489(put 'org-table-face 'face-alias 'org-table)
1490 1582
1491(defface org-time-grid ;; font-lock-variable-name-face 1583(defface org-time-grid ;; font-lock-variable-name-face
1492 '((((type tty) (class color)) (:foreground "yellow" :weight light)) 1584 '((((type tty) (class color)) (:foreground "yellow" :weight light))
@@ -1495,8 +1587,6 @@ When this is non-nil, the headline after the keyword is set to the
1495 (t (:bold t :italic t))) 1587 (t (:bold t :italic t)))
1496 "Face used for level 2 headlines." 1588 "Face used for level 2 headlines."
1497 :group 'org-faces) 1589 :group 'org-faces)
1498;; backward-compatibility alias
1499(put 'org-time-grid-face 'face-alias 'org-time-grid)
1500 1590
1501(defvar org-level-faces 1591(defvar org-level-faces
1502 '( 1592 '(
@@ -1602,6 +1692,9 @@ The following commands are available:
1602 (make-local-hook 'before-change-functions) ;; needed for XEmacs 1692 (make-local-hook 'before-change-functions) ;; needed for XEmacs
1603 (add-hook 'before-change-functions 'org-before-change-function nil 1693 (add-hook 'before-change-functions 'org-before-change-function nil
1604 'local) 1694 'local)
1695 ;; Paragraph regular expressions
1696 (set (make-local-variable 'paragraph-separate) "\f\\|[ ]*$")
1697 (set (make-local-variable 'paragraph-start) "\f\\|[ ]*$\\|\\([*\f]+\\)")
1605 ;; Inhibit auto-fill for headers, tables and fixed-width lines. 1698 ;; Inhibit auto-fill for headers, tables and fixed-width lines.
1606 (set (make-local-variable 'auto-fill-inhibit-regexp) 1699 (set (make-local-variable 'auto-fill-inhibit-regexp)
1607 (concat "\\*" 1700 (concat "\\*"
@@ -1611,6 +1704,7 @@ The following commands are available:
1611 (if org-enable-table-editor "|" "") 1704 (if org-enable-table-editor "|" "")
1612 (if org-enable-fixed-width-editor ":" "") 1705 (if org-enable-fixed-width-editor ":" "")
1613 "]")))) 1706 "]"))))
1707 (set (make-local-variable 'fill-paragraph-function) 'org-fill-paragraph)
1614 (if (and org-insert-mode-line-in-empty-file 1708 (if (and org-insert-mode-line-in-empty-file
1615 (interactive-p) 1709 (interactive-p)
1616 (= (point-min) (point-max))) 1710 (= (point-min) (point-max)))
@@ -1625,6 +1719,12 @@ The following commands are available:
1625 (let ((this-command 'org-cycle) (last-command 'org-cycle)) 1719 (let ((this-command 'org-cycle) (last-command 'org-cycle))
1626 (org-cycle '(4)) (org-cycle '(4)))))))) 1720 (org-cycle '(4)) (org-cycle '(4))))))))
1627 1721
1722(defun org-fill-paragraph (&optional justify)
1723 "Re-align a table, pass through to fill-paragraph if no table."
1724 (save-excursion
1725 (beginning-of-line 1)
1726 (looking-at "\\s-*\\(|\\|\\+-+\\)")))
1727
1628;;; Font-Lock stuff 1728;;; Font-Lock stuff
1629 1729
1630(defvar org-mouse-map (make-sparse-keymap)) 1730(defvar org-mouse-map (make-sparse-keymap))
@@ -1635,15 +1735,22 @@ The following commands are available:
1635 1735
1636(require 'font-lock) 1736(require 'font-lock)
1637 1737
1638(defconst org-non-link-chars "\t\n\r|") 1738(defconst org-non-link-chars "\t\n\r|<>\000")
1639(defconst org-link-regexp 1739(defconst org-link-regexp
1640 (if org-allow-space-in-links 1740 (if org-allow-space-in-links
1641 (concat 1741 (concat
1642 "\\(https?\\|ftp\\|mailto|\\|file\\|news\\|bbdb\\|vm\\|wl\\|rmail\\|gnus\\|shell\\):\\([^" org-non-link-chars "]+[^ " org-non-link-chars "]\\)") 1742 "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|rmail\\|gnus\\|shell\\):\\([^" org-non-link-chars "]+[^ " org-non-link-chars "]\\)")
1643 (concat 1743 (concat
1644 "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|rmail\\|gnus\\|shell\\):\\([^ " org-non-link-chars "]+\\)") 1744 "\\(https?\\|ftp\\|mailto\\|file\\|news\\|bbdb\\|vm\\|wl\\|rmail\\|gnus\\|shell\\):\\([^ " org-non-link-chars "]+\\)")
1645 ) 1745 )
1646 "Regular expression for matching links.") 1746 "Regular expression for matching links.")
1747(defconst org-link-maybe-angles-regexp
1748 (concat "<?\\(" org-link-regexp "\\)>?")
1749 "Matches a link and optionally surrounding angle brackets.")
1750(defconst org-protected-link-regexp
1751 (concat "\000" org-link-regexp "\000")
1752 "Matches a link and optionally surrounding angle brackets.")
1753
1647(defconst org-ts-lengths 1754(defconst org-ts-lengths
1648 (cons (length (format-time-string (car org-time-stamp-formats))) 1755 (cons (length (format-time-string (car org-time-stamp-formats)))
1649 (length (format-time-string (cdr org-time-stamp-formats)))) 1756 (length (format-time-string (cdr org-time-stamp-formats))))
@@ -1704,7 +1811,7 @@ The following commands are available:
1704 '("\\<FIXME\\>" (0 'org-warning t)) 1811 '("\\<FIXME\\>" (0 'org-warning t))
1705 (list (concat "^\\*+[ \t]*\\<\\(" org-comment-string "\\)\\>") 1812 (list (concat "^\\*+[ \t]*\\<\\(" org-comment-string "\\)\\>")
1706 '(1 'org-warning t)) 1813 '(1 'org-warning t))
1707 '("^#.*" (0 font-lock-comment-face t)) 1814 '("^#.*" (0 'font-lock-comment-face t))
1708 (if org-fontify-done-headline 1815 (if org-fontify-done-headline
1709 (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\(.*\\)\\>") 1816 (list (concat "^[*]+ +\\<\\(" org-done-string "\\)\\(.*\\)\\>")
1710 '(1 'org-done t) '(2 'org-headline-done t)) 1817 '(1 'org-done t) '(2 'org-headline-done t))
@@ -1923,12 +2030,12 @@ Optional argument N means, put the headline into the Nth line of the window."
1923(let ((cmds '(isearch-forward isearch-backward)) cmd) 2030(let ((cmds '(isearch-forward isearch-backward)) cmd)
1924 (while (setq cmd (pop cmds)) 2031 (while (setq cmd (pop cmds))
1925 (substitute-key-definition cmd cmd org-goto-map global-map))) 2032 (substitute-key-definition cmd cmd org-goto-map global-map)))
1926(define-key org-goto-map [(return)] 'org-goto-ret) 2033(define-key org-goto-map "\C-m" 'org-goto-ret)
1927(define-key org-goto-map [(left)] 'org-goto-left) 2034(define-key org-goto-map [(left)] 'org-goto-left)
1928(define-key org-goto-map [(right)] 'org-goto-right) 2035(define-key org-goto-map [(right)] 'org-goto-right)
1929(define-key org-goto-map [(?q)] 'org-goto-quit) 2036(define-key org-goto-map [(?q)] 'org-goto-quit)
1930(define-key org-goto-map [(control ?g)] 'org-goto-quit) 2037(define-key org-goto-map [(control ?g)] 'org-goto-quit)
1931(define-key org-goto-map [(tab)] 'org-cycle) 2038(define-key org-goto-map "\C-i" 'org-cycle)
1932(define-key org-goto-map [(down)] 'outline-next-visible-heading) 2039(define-key org-goto-map [(down)] 'outline-next-visible-heading)
1933(define-key org-goto-map [(up)] 'outline-previous-visible-heading) 2040(define-key org-goto-map [(up)] 'outline-previous-visible-heading)
1934(define-key org-goto-map "n" 'outline-next-visible-heading) 2041(define-key org-goto-map "n" 'outline-next-visible-heading)
@@ -2313,15 +2420,21 @@ If optional TREE is given, use this text instead of the kill ring."
2313 (- (match-end 0) (match-beginning 0))) 2420 (- (match-end 0) (match-beginning 0)))
2314 (t nil))) 2421 (t nil)))
2315 (previous-level (save-excursion 2422 (previous-level (save-excursion
2316 (outline-previous-visible-heading 1) 2423 (condition-case nil
2317 (if (looking-at re) 2424 (progn
2318 (- (match-end 0) (match-beginning 0)) 2425 (outline-previous-visible-heading 1)
2319 1))) 2426 (if (looking-at re)
2427 (- (match-end 0) (match-beginning 0))
2428 1))
2429 (error 1))))
2320 (next-level (save-excursion 2430 (next-level (save-excursion
2321 (outline-next-visible-heading 1) 2431 (condition-case nil
2322 (if (looking-at re) 2432 (progn
2323 (- (match-end 0) (match-beginning 0)) 2433 (outline-next-visible-heading 1)
2324 1))) 2434 (if (looking-at re)
2435 (- (match-end 0) (match-beginning 0))
2436 1))
2437 (error 1))))
2325 (new-level (or force-level (max previous-level next-level))) 2438 (new-level (or force-level (max previous-level next-level)))
2326 (shift (if (or (= old-level -1) 2439 (shift (if (or (= old-level -1)
2327 (= new-level -1) 2440 (= new-level -1)
@@ -2380,6 +2493,102 @@ If optional TXT is given, check this string instead of the current kill."
2380 (throw 'exit nil))) 2493 (throw 'exit nil)))
2381 t)))) 2494 t))))
2382 2495
2496(defun org-archive-subtree ()
2497 "Move the current subtree to the archive.
2498The archive can be a certain top-level heading in the current file, or in
2499a different file. The tree will be moved to that location, the subtree
2500heading be marked DONE, and the current time will be added."
2501 (interactive)
2502 ;; Save all relevant TODO keyword-relatex variables
2503 (let ((tr-org-todo-line-regexp org-todo-line-regexp) ; keep despite compiler
2504 (tr-org-todo-keywords org-todo-keywords)
2505 (tr-org-todo-interpretation org-todo-interpretation)
2506 (tr-org-done-string org-done-string)
2507 (tr-org-todo-regexp org-todo-regexp)
2508 (tr-org-todo-line-regexp org-todo-line-regexp)
2509 (this-buffer (current-buffer))
2510 file heading buffer level newfile-p)
2511 (if (string-match "\\(.*\\)::\\(.*\\)" org-archive-location)
2512 (progn
2513 (setq file (format (match-string 1 org-archive-location)
2514 (file-name-nondirectory (buffer-file-name)))
2515 heading (match-string 2 org-archive-location)))
2516 (error "Invalid `org-archive-location'"))
2517 (if (> (length file) 0)
2518 (setq newfile-p (not (file-exists-p file))
2519 buffer (find-file-noselect file))
2520 (setq buffer (current-buffer)))
2521 (unless buffer
2522 (error "Cannot access file \"%s\"" file))
2523 (if (and (> (length heading) 0)
2524 (string-match "^\\*+" heading))
2525 (setq level (match-end 0))
2526 (setq heading nil level 0))
2527 (save-excursion
2528 (org-copy-subtree) ; We first only copy, in case something goes wrong
2529 (set-buffer buffer)
2530 ;; Enforce org-mode for the archive buffer
2531 (if (not (eq major-mode 'org-mode))
2532 ;; Force the mode for future visits.
2533 (let ((org-insert-mode-line-in-empty-file t))
2534 (call-interactively 'org-mode)))
2535 (when newfile-p
2536 (goto-char (point-max))
2537 (insert (format "\nArchived entries from file %s\n\n"
2538 (buffer-file-name this-buffer))))
2539 ;; Force the TODO keywords of the original buffer
2540 (let ((org-todo-line-regexp tr-org-todo-line-regexp)
2541 (org-todo-keywords tr-org-todo-keywords)
2542 (org-todo-interpretation tr-org-todo-interpretation)
2543 (org-done-string tr-org-done-string)
2544 (org-todo-regexp tr-org-todo-regexp)
2545 (org-todo-line-regexp tr-org-todo-line-regexp))
2546 (goto-char (point-min))
2547 (if heading
2548 (progn
2549 (if (re-search-forward
2550 (concat "\\(^\\|\r\\)"
2551 (regexp-quote heading) "[ \t]*\\($\\|\r\\)")
2552 nil t)
2553 (goto-char (match-end 0))
2554 ;; Heading not found, just insert it at the end
2555 (goto-char (point-max))
2556 (or (bolp) (insert "\n"))
2557 (insert "\n" heading "\n")
2558 (end-of-line 0))
2559 ;; Make the heading visible, and the following as well
2560 (let ((org-show-following-heading t)) (org-show-hierarchy-above))
2561 (if (re-search-forward
2562 (concat "^" (regexp-quote (make-string level ?*)) "[ \t]")
2563 nil t)
2564 (progn (goto-char (match-beginning 0)) (insert "\n")
2565 (beginning-of-line 0))
2566 (goto-char (point-max)) (insert "\n")))
2567 (goto-char (point-max)) (insert "\n"))
2568 ;; Paste
2569 (org-paste-subtree (1+ level))
2570 ;; Mark the entry as done, i.e. set to last work in org-todo-keywords
2571 (if org-archive-mark-done
2572 (org-todo (length org-todo-keywords)))
2573 ;; Move cursor to right after the TODO keyword
2574 (when org-archive-stamp-time
2575 (beginning-of-line 1)
2576 (looking-at org-todo-line-regexp)
2577 (goto-char (or (match-end 2) (match-beginning 3)))
2578 (insert "(" (format-time-string (cdr org-time-stamp-formats)
2579 (current-time))
2580 ")"))
2581 ;; Save the buffer, if it is not the same buffer.
2582 (if (not (eq this-buffer buffer)) (save-buffer))))
2583 ;; Here we are back in the original buffer. Everything seems to have
2584 ;; worked. So now cut the tree and finish up.
2585 (org-cut-subtree)
2586 (if (looking-at "[ \t]*$") (kill-line))
2587 (message "Subtree archived %s"
2588 (if (eq this-buffer buffer)
2589 (concat "under heading: " heading)
2590 (concat "in file: " (abbreviate-file-name file))))))
2591
2383;;; Completion 2592;;; Completion
2384 2593
2385(defun org-complete (&optional arg) 2594(defun org-complete (&optional arg)
@@ -3130,6 +3339,7 @@ If there is already a time stamp at the cursor position, update it."
3130(defvar org-agenda-follow-mode nil) 3339(defvar org-agenda-follow-mode nil)
3131(defvar org-agenda-buffer-name "*Org Agenda*") 3340(defvar org-agenda-buffer-name "*Org Agenda*")
3132(defvar org-agenda-redo-command nil) 3341(defvar org-agenda-redo-command nil)
3342(defvar org-agenda-mode-hook nil)
3133 3343
3134;;;###autoload 3344;;;###autoload
3135(defun org-agenda-mode () 3345(defun org-agenda-mode ()
@@ -3156,19 +3366,21 @@ The following commands are available:
3156 "--") 3366 "--")
3157 (mapcar 'org-file-menu-entry org-agenda-files))) 3367 (mapcar 'org-file-menu-entry org-agenda-files)))
3158 (org-agenda-set-mode-name) 3368 (org-agenda-set-mode-name)
3159 (org-run-mode-hooks 'org-agenda-mode-hook)) 3369 (apply
3370 (if (fboundp 'run-mode-hooks) 'run-mode-hooks 'run-hooks)
3371 org-agenda-mode-hook))
3160 3372
3161(define-key org-agenda-mode-map [(tab)] 'org-agenda-goto) 3373(define-key org-agenda-mode-map "\C-i" 'org-agenda-goto)
3162(define-key org-agenda-mode-map [(return)] 'org-agenda-switch-to) 3374(define-key org-agenda-mode-map "\C-m" 'org-agenda-switch-to)
3163(define-key org-agenda-mode-map " " 'org-agenda-show) 3375(define-key org-agenda-mode-map " " 'org-agenda-show)
3164(define-key org-agenda-mode-map "\C-c\C-t" 'org-agenda-todo) 3376(define-key org-agenda-mode-map "\C-c\C-t" 'org-agenda-todo)
3165(define-key org-agenda-mode-map "o" 'delete-other-windows) 3377(define-key org-agenda-mode-map "o" 'delete-other-windows)
3166(define-key org-agenda-mode-map "l" 'org-agenda-recenter) 3378(define-key org-agenda-mode-map "l" 'org-agenda-recenter)
3167(define-key org-agenda-mode-map "t" 'org-agenda-todo) 3379(define-key org-agenda-mode-map "t" 'org-agenda-todo)
3168(define-key org-agenda-mode-map "." 'org-agenda-goto-today) 3380(define-key org-agenda-mode-map "." 'org-agenda-goto-today)
3169(define-key org-agenda-mode-map "w" 'org-agenda-toggle-week-view) 3381(define-key org-agenda-mode-map "w" 'org-agenda-toggle-week-view)
3170(define-key org-agenda-mode-map [(shift right)] 'org-agenda-date-later) 3382(define-key org-agenda-mode-map (org-key 'S-right) 'org-agenda-date-later)
3171(define-key org-agenda-mode-map [(shift left)] 'org-agenda-date-earlier) 3383(define-key org-agenda-mode-map (org-key 'S-left) 'org-agenda-date-earlier)
3172 3384
3173(define-key org-agenda-mode-map ">" 'org-agenda-date-prompt) 3385(define-key org-agenda-mode-map ">" 'org-agenda-date-prompt)
3174(let ((l '(1 2 3 4 5 6 7 8 9 0))) 3386(let ((l '(1 2 3 4 5 6 7 8 9 0)))
@@ -3202,8 +3414,8 @@ The following commands are available:
3202(define-key org-agenda-mode-map "H" 'org-agenda-holidays) 3414(define-key org-agenda-mode-map "H" 'org-agenda-holidays)
3203(define-key org-agenda-mode-map "+" 'org-agenda-priority-up) 3415(define-key org-agenda-mode-map "+" 'org-agenda-priority-up)
3204(define-key org-agenda-mode-map "-" 'org-agenda-priority-down) 3416(define-key org-agenda-mode-map "-" 'org-agenda-priority-down)
3205(define-key org-agenda-mode-map [(shift up)] 'org-agenda-priority-up) 3417(define-key org-agenda-mode-map (org-key 'S-up) 'org-agenda-priority-up)
3206(define-key org-agenda-mode-map [(shift down)] 'org-agenda-priority-down) 3418(define-key org-agenda-mode-map (org-key 'S-down) 'org-agenda-priority-down)
3207(define-key org-agenda-mode-map [(right)] 'org-agenda-later) 3419(define-key org-agenda-mode-map [(right)] 'org-agenda-later)
3208(define-key org-agenda-mode-map [(left)] 'org-agenda-earlier) 3420(define-key org-agenda-mode-map [(left)] 'org-agenda-earlier)
3209 3421
@@ -3373,7 +3585,8 @@ dates."
3373 (number-to-string (extract-calendar-day date)) " " 3585 (number-to-string (extract-calendar-day date)) " "
3374 (calendar-month-name (extract-calendar-month date)) " " 3586 (calendar-month-name (extract-calendar-month date)) " "
3375 (number-to-string (extract-calendar-year date)) "\n") 3587 (number-to-string (extract-calendar-year date)) "\n")
3376 (put-text-property s (1- (point)) 'face 'org-link) 3588 (put-text-property s (1- (point)) 'face
3589 'org-link)
3377 (if (equal d today) 3590 (if (equal d today)
3378 (put-text-property s (1- (point)) 'org-today t)) 3591 (put-text-property s (1- (point)) 'org-today t))
3379 (insert (org-finalize-agenda-entries rtn) "\n") 3592 (insert (org-finalize-agenda-entries rtn) "\n")
@@ -3452,7 +3665,7 @@ NDAYS defaults to `org-agenda-ndays'."
3452 (when rtnall 3665 (when rtnall
3453 (insert "ALL CURRENTLY OPEN TODO ITEMS:\n") 3666 (insert "ALL CURRENTLY OPEN TODO ITEMS:\n")
3454 (add-text-properties (point-min) (1- (point)) 3667 (add-text-properties (point-min) (1- (point))
3455 (list 'face 'org-link)) 3668 (list 'face 'org-link))
3456 (insert (org-finalize-agenda-entries rtnall) "\n"))) 3669 (insert (org-finalize-agenda-entries rtnall) "\n")))
3457 (while (setq d (pop day-numbers)) 3670 (while (setq d (pop day-numbers))
3458 (setq date (calendar-gregorian-from-absolute d) 3671 (setq date (calendar-gregorian-from-absolute d)
@@ -3481,7 +3694,8 @@ NDAYS defaults to `org-agenda-ndays'."
3481 (extract-calendar-day date) 3694 (extract-calendar-day date)
3482 (calendar-month-name (extract-calendar-month date)) 3695 (calendar-month-name (extract-calendar-month date))
3483 (extract-calendar-year date))) 3696 (extract-calendar-year date)))
3484 (put-text-property s (1- (point)) 'face 'org-link) 3697 (put-text-property s (1- (point)) 'face
3698 'org-link)
3485 (if rtnall (insert 3699 (if rtnall (insert
3486 (org-finalize-agenda-entries ;; FIXME: condition needed 3700 (org-finalize-agenda-entries ;; FIXME: condition needed
3487 (org-agenda-add-time-grid-maybe 3701 (org-agenda-add-time-grid-maybe
@@ -4055,7 +4269,8 @@ the documentation of `org-diary'."
4055 (if deadlinep 4269 (if deadlinep
4056 (add-text-properties 4270 (add-text-properties
4057 0 (length txt) 4271 0 (length txt)
4058 (list 'face (if donep 'org-done 'org-warning) 4272 (list 'face
4273 (if donep 'org-done 'org-warning)
4059 'undone-face 'org-warning 4274 'undone-face 'org-warning
4060 'done-face 'org-done 4275 'done-face 'org-done
4061 'priority (+ 100 priority)) 4276 'priority (+ 100 priority))
@@ -4436,6 +4651,7 @@ HH:MM."
4436 4651
4437(defun org-entries-lessp (a b) 4652(defun org-entries-lessp (a b)
4438 "Predicate for sorting agenda entries." 4653 "Predicate for sorting agenda entries."
4654 ;; The following variables will be used when the form is evaluated.
4439 (let* ((time-up (org-cmp-time a b)) 4655 (let* ((time-up (org-cmp-time a b))
4440 (time-down (if time-up (- time-up) nil)) 4656 (time-down (if time-up (- time-up) nil))
4441 (priority-up (org-cmp-priority a b)) 4657 (priority-up (org-cmp-priority a b))
@@ -4836,7 +5052,8 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file."
4836 (let (type path line (pos (point))) 5052 (let (type path line (pos (point)))
4837 (save-excursion 5053 (save-excursion
4838 (skip-chars-backward 5054 (skip-chars-backward
4839 (if org-allow-space-in-links "^\t\n\r" "^ \t\n\r")) 5055 (concat (if org-allow-space-in-links "^" "^ ")
5056 org-non-link-chars))
4840 (if (re-search-forward 5057 (if (re-search-forward
4841 org-link-regexp 5058 org-link-regexp
4842 (save-excursion 5059 (save-excursion
@@ -4901,6 +5118,10 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file."
4901 5118
4902 ((string= type "shell") 5119 ((string= type "shell")
4903 (let ((cmd path)) 5120 (let ((cmd path))
5121 (while (string-match "@{" cmd)
5122 (setq cmd (replace-match "<" t t cmd)))
5123 (while (string-match "@}" cmd)
5124 (setq cmd (replace-match ">" t t cmd)))
4904 (if (or (not org-confirm-shell-links) 5125 (if (or (not org-confirm-shell-links)
4905 (yes-or-no-p (format "Execute \"%s\" in the shell? " cmd))) 5126 (yes-or-no-p (format "Execute \"%s\" in the shell? " cmd)))
4906 (shell-command cmd) 5127 (shell-command cmd)
@@ -5032,7 +5253,7 @@ If the file does not exist, an error is thrown."
5032 (cdr (assoc t apps))))) 5253 (cdr (assoc t apps)))))
5033 (cond 5254 (cond
5034 ((and (stringp cmd) (not (string-match "^\\s-*$" cmd))) 5255 ((and (stringp cmd) (not (string-match "^\\s-*$" cmd)))
5035 (setq cmd (format cmd file)) 5256 (setq cmd (format cmd (concat "\"" file "\"")))
5036 (save-window-excursion 5257 (save-window-excursion
5037 (shell-command (concat cmd " & &")))) 5258 (shell-command (concat cmd " & &"))))
5038 ((or (stringp cmd) 5259 ((or (stringp cmd)
@@ -5078,9 +5299,11 @@ For file links, arg negates `org-line-numbers-in-file-links'."
5078 (cond 5299 (cond
5079 5300
5080 ((eq major-mode 'bbdb-mode) 5301 ((eq major-mode 'bbdb-mode)
5081 (setq link (concat "bbdb:" 5302 (setq cpltxt (concat
5082 (or (bbdb-record-name (bbdb-current-record)) 5303 "bbdb:"
5083 (bbdb-record-company (bbdb-current-record)))))) 5304 (or (bbdb-record-name (bbdb-current-record))
5305 (bbdb-record-company (bbdb-current-record))))
5306 link (org-make-link cpltxt)))
5084 5307
5085 ((eq major-mode 'calendar-mode) 5308 ((eq major-mode 'calendar-mode)
5086 (let ((cd (calendar-cursor-to-date))) 5309 (let ((cd (calendar-cursor-to-date)))
@@ -5107,8 +5330,9 @@ For file links, arg negates `org-line-numbers-in-file-links'."
5107 folder) 5330 folder)
5108 (setq folder (replace-match "" t t folder))) 5331 (setq folder (replace-match "" t t folder)))
5109 (setq cpltxt (concat author " on: " subject)) 5332 (setq cpltxt (concat author " on: " subject))
5110 (setq link (concat cpltxt "\n " "vm:" folder 5333 (setq link (concat cpltxt "\n "
5111 "#" message-id))))) 5334 (org-make-link
5335 "vm:" folder "#" message-id))))))
5112 5336
5113 ((eq major-mode 'wl-summary-mode) 5337 ((eq major-mode 'wl-summary-mode)
5114 (let* ((msgnum (wl-summary-message-number)) 5338 (let* ((msgnum (wl-summary-message-number))
@@ -5119,8 +5343,10 @@ For file links, arg negates `org-line-numbers-in-file-links'."
5119 (author (wl-summary-line-from)) ; FIXME: how to get author name? 5343 (author (wl-summary-line-from)) ; FIXME: how to get author name?
5120 (subject "???")) ; FIXME: How to get subject of email? 5344 (subject "???")) ; FIXME: How to get subject of email?
5121 (setq cpltxt (concat author " on: " subject)) 5345 (setq cpltxt (concat author " on: " subject))
5122 (setq link (concat cpltxt "\n " "wl:" wl-summary-buffer-folder-name 5346 (setq link (concat cpltxt "\n "
5123 "#" message-id)))) 5347 (org-make-link
5348 "wl:" wl-summary-buffer-folder-name
5349 "#" message-id)))))
5124 5350
5125 ((eq major-mode 'rmail-mode) 5351 ((eq major-mode 'rmail-mode)
5126 (save-excursion 5352 (save-excursion
@@ -5131,8 +5357,9 @@ For file links, arg negates `org-line-numbers-in-file-links'."
5131 (author (mail-fetch-field "from")) 5357 (author (mail-fetch-field "from"))
5132 (subject (mail-fetch-field "subject"))) 5358 (subject (mail-fetch-field "subject")))
5133 (setq cpltxt (concat author " on: " subject)) 5359 (setq cpltxt (concat author " on: " subject))
5134 (setq link (concat cpltxt "\n " "rmail:" folder 5360 (setq link (concat cpltxt "\n "
5135 "#" message-id)))))) 5361 (org-make-link
5362 "rmail:" folder "#" message-id)))))))
5136 5363
5137 ((eq major-mode 'gnus-group-mode) 5364 ((eq major-mode 'gnus-group-mode)
5138 (let ((group (cond ((fboundp 'gnus-group-group-name) ; depending on Gnus 5365 (let ((group (cond ((fboundp 'gnus-group-group-name) ; depending on Gnus
@@ -5140,11 +5367,12 @@ For file links, arg negates `org-line-numbers-in-file-links'."
5140 ((fboundp 'gnus-group-name) 5367 ((fboundp 'gnus-group-name)
5141 (gnus-group-name)) 5368 (gnus-group-name))
5142 (t "???")))) 5369 (t "???"))))
5143 (setq link (concat 5370 (setq cpltxt (concat
5144 (if (org-xor arg org-usenet-links-prefer-google) 5371 (if (org-xor arg org-usenet-links-prefer-google)
5145 "http://groups.google.com/groups?group=" 5372 "http://groups.google.com/groups?group="
5146 "gnus:") 5373 "gnus:")
5147 group)))) 5374 group)
5375 link (org-make-link cpltxt))))
5148 5376
5149 ((memq major-mode '(gnus-summary-mode gnus-article-mode)) 5377 ((memq major-mode '(gnus-summary-mode gnus-article-mode))
5150 (and (eq major-mode 'gnus-article-mode) (gnus-article-show-summary)) 5378 (and (eq major-mode 'gnus-article-mode) (gnus-article-show-summary))
@@ -5163,27 +5391,34 @@ For file links, arg negates `org-line-numbers-in-file-links'."
5163 cpltxt "\n " 5391 cpltxt "\n "
5164 (format "http://groups.google.com/groups?as_umsgid=%s" 5392 (format "http://groups.google.com/groups?as_umsgid=%s"
5165 (org-fixup-message-id-for-http message-id)))) 5393 (org-fixup-message-id-for-http message-id))))
5166 (setq link (concat cpltxt "\n" "gnus:" group 5394 (setq link (concat cpltxt "\n"
5167 "#" (number-to-string article)))))) 5395 (org-make-link
5396 "gnus:" group
5397 "#" (number-to-string article)))))))
5168 5398
5169 ((eq major-mode 'w3-mode) 5399 ((eq major-mode 'w3-mode)
5170 (setq link (url-view-url t))) 5400 (setq cpltxt (url-view-url t)
5401 link (org-make-link cpltxt)))
5171 ((eq major-mode 'w3m-mode) 5402 ((eq major-mode 'w3m-mode)
5172 (setq link w3m-current-url)) 5403 (setq cpltxt w3m-current-url
5404 link (org-make-link cpltxt)))
5173 5405
5174 ((buffer-file-name) 5406 ((buffer-file-name)
5175 ;; Just link to this file here. 5407 ;; Just link to this file here.
5176 (setq link (concat "file:" 5408 (setq cpltxt (concat "file:"
5177 (abbreviate-file-name (buffer-file-name)))) 5409 (abbreviate-file-name (buffer-file-name))))
5178 ;; Add the line number? 5410 ;; Add the line number?
5179 (if (org-xor org-line-numbers-in-file-links arg) 5411 (if (org-xor org-line-numbers-in-file-links arg)
5180 (setq link 5412 (setq cpltxt
5181 (concat link 5413 (concat cpltxt
5182 ":" (int-to-string 5414 ":" (int-to-string
5183 (+ (if (bolp) 1 0) (count-lines 5415 (+ (if (bolp) 1 0) (count-lines
5184 (point-min) (point)))))))) 5416 (point-min) (point)))))))
5417 (setq link (org-make-link cpltxt)))
5418
5185 ((interactive-p) 5419 ((interactive-p)
5186 (error "Cannot link to a buffer which is not visiting a file")) 5420 (error "Cannot link to a buffer which is not visiting a file"))
5421
5187 (t (setq link nil))) 5422 (t (setq link nil)))
5188 5423
5189 (if (and (interactive-p) link) 5424 (if (and (interactive-p) link)
@@ -5193,6 +5428,10 @@ For file links, arg negates `org-line-numbers-in-file-links'."
5193 (message "Stored: %s" (or cpltxt link))) 5428 (message "Stored: %s" (or cpltxt link)))
5194 link))) 5429 link)))
5195 5430
5431(defun org-make-link (&rest strings)
5432 "Concatenate STRINGS, format resulting string with `org-link-format'."
5433 (format org-link-format (apply 'concat strings)))
5434
5196(defun org-xor (a b) 5435(defun org-xor (a b)
5197 "Exclusive or." 5436 "Exclusive or."
5198 (if a (not b) b)) 5437 (if a (not b) b))
@@ -5237,7 +5476,8 @@ For file links, arg negates `org-line-numbers-in-file-links'."
5237Completion can be used to select a link previously stored with 5476Completion can be used to select a link previously stored with
5238`org-store-link'. When the empty string is entered (i.e. if you just 5477`org-store-link'. When the empty string is entered (i.e. if you just
5239press RET at the prompt), the link defaults to the most recently 5478press RET at the prompt), the link defaults to the most recently
5240stored link. 5479stored link. As SPC triggers completion in the minibuffer, you need to
5480use M-SPC or C-q SPC to force the insertion of a space character.
5241 5481
5242With a \\[universal-argument] prefix, prompts for a file to link to. The file name can be 5482With a \\[universal-argument] prefix, prompts for a file to link to. The file name can be
5243selected using completion. The path to the file will be relative to 5483selected using completion. The path to the file will be relative to
@@ -5261,15 +5501,20 @@ is in the current directory or below."
5261 (let ((pwd (file-name-as-directory (expand-file-name ".")))) 5501 (let ((pwd (file-name-as-directory (expand-file-name "."))))
5262 (cond 5502 (cond
5263 ((equal complete-file '(16)) 5503 ((equal complete-file '(16))
5264 (insert "file:" (abbreviate-file-name (expand-file-name link)))) 5504 (insert
5505 (org-make-link
5506 "file:" (abbreviate-file-name (expand-file-name link)))))
5265 ((string-match (concat "^" (regexp-quote pwd) "\\(.+\\)") 5507 ((string-match (concat "^" (regexp-quote pwd) "\\(.+\\)")
5266 (expand-file-name link)) 5508 (expand-file-name link))
5267 (insert "file:" (match-string 1 (expand-file-name link)))) 5509 (insert
5268 (t (insert "file:" link)))) 5510 (org-make-link
5511 "file:" (match-string 1 (expand-file-name link)))))
5512 (t (insert (org-make-link "file:" link)))))
5269 (setq linktxt (cdr (assoc link org-stored-links))) 5513 (setq linktxt (cdr (assoc link org-stored-links)))
5270 (if (not org-keep-stored-link-after-insertion) 5514 (if (not org-keep-stored-link-after-insertion)
5271 (setq org-stored-links (delq (assoc link org-stored-links) 5515 (setq org-stored-links (delq (assoc link org-stored-links)
5272 org-stored-links))) 5516 org-stored-links)))
5517 (if (not linktxt) (setq link (org-make-link link)))
5273 (let ((lines (org-split-string (or linktxt link) "\n"))) 5518 (let ((lines (org-split-string (or linktxt link) "\n")))
5274 (insert (car lines)) 5519 (insert (car lines))
5275 (setq matched (string-match org-link-regexp (car lines))) 5520 (setq matched (string-match org-link-regexp (car lines)))
@@ -5937,7 +6182,8 @@ However, when FORCE is non-nil, create new columns if necessary."
5937 (if (looking-at " ") (forward-char 1)))))) 6182 (if (looking-at " ") (forward-char 1))))))
5938 6183
5939(defun org-at-table-p (&optional table-type) 6184(defun org-at-table-p (&optional table-type)
5940 "Return t if the cursor is inside an org-type table." 6185 "Return t if the cursor is inside an org-type table.
6186If TABLE-TYPE is non-nil, also chack for table.el-type tables."
5941 (if org-enable-table-editor 6187 (if org-enable-table-editor
5942 (save-excursion 6188 (save-excursion
5943 (beginning-of-line 1) 6189 (beginning-of-line 1)
@@ -6717,27 +6963,31 @@ table editor in arbitrary modes.")
6717;;;###autoload 6963;;;###autoload
6718(defun orgtbl-mode (&optional arg) 6964(defun orgtbl-mode (&optional arg)
6719 "The `org-mode' table editor as a minor mode for use in other modes." 6965 "The `org-mode' table editor as a minor mode for use in other modes."
6720 (interactive) 6966 (interactive)
6721 (setq orgtbl-mode 6967 (if (eq major-mode 'org-mode)
6722 (if arg (> (prefix-numeric-value arg) 0) (not orgtbl-mode))) 6968 ;; Exit without error, in case some hook functions calls this
6723 (if orgtbl-mode 6969 ;; by accident in org-mode.
6724 (progn 6970 (message "Orgtbl-mode is not useful in org-mode, command ignored")
6725 (set (make-local-variable (quote org-table-may-need-update)) t) 6971 (setq orgtbl-mode
6726 (make-local-hook (quote before-change-functions)) 6972 (if arg (> (prefix-numeric-value arg) 0) (not orgtbl-mode)))
6727 (add-hook 'before-change-functions 'org-before-change-function 6973 (if orgtbl-mode
6728 nil 'local) 6974 (progn
6729 (set (make-local-variable 'org-old-auto-fill-inhibit-regexp) 6975 (set (make-local-variable (quote org-table-may-need-update)) t)
6730 auto-fill-inhibit-regexp) 6976 (make-local-hook (quote before-change-functions))
6731 (set (make-local-variable 'auto-fill-inhibit-regexp) 6977 (add-hook 'before-change-functions 'org-before-change-function
6732 (if auto-fill-inhibit-regexp 6978 nil 'local)
6733 (concat "\\([ \t]*|\\|" auto-fill-inhibit-regexp) 6979 (set (make-local-variable 'org-old-auto-fill-inhibit-regexp)
6734 "[ \t]*|")) 6980 auto-fill-inhibit-regexp)
6735 (easy-menu-add orgtbl-mode-menu) 6981 (set (make-local-variable 'auto-fill-inhibit-regexp)
6736 (run-hooks 'orgtbl-mode-hook)) 6982 (if auto-fill-inhibit-regexp
6737 (setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp) 6983 (concat "\\([ \t]*|\\|" auto-fill-inhibit-regexp)
6738 (remove-hook 'before-change-functions 'org-before-change-function t) 6984 "[ \t]*|"))
6739 (easy-menu-remove orgtbl-mode-menu) 6985 (easy-menu-add orgtbl-mode-menu)
6740 (force-mode-line-update 'all))) 6986 (run-hooks 'orgtbl-mode-hook))
6987 (setq auto-fill-inhibit-regexp org-old-auto-fill-inhibit-regexp)
6988 (remove-hook 'before-change-functions 'org-before-change-function t)
6989 (easy-menu-remove orgtbl-mode-menu)
6990 (force-mode-line-update 'all))))
6741 6991
6742;; Install it as a minor mode. 6992;; Install it as a minor mode.
6743(put 'orgtbl-mode :included t) 6993(put 'orgtbl-mode :included t)
@@ -6746,7 +6996,9 @@ table editor in arbitrary modes.")
6746 6996
6747(defun orgtbl-make-binding (fun &rest keys) 6997(defun orgtbl-make-binding (fun &rest keys)
6748 "Create a function for binding in the table minor mode." 6998 "Create a function for binding in the table minor mode."
6749 (list 'lambda '(arg) '(interactive "p") 6999 (list 'lambda '(arg)
7000 (concat "Run `" (symbol-name fun) "' or the default binding.")
7001 '(interactive "p")
6750 (list 'if 7002 (list 'if
6751 '(org-at-table-p) 7003 '(org-at-table-p)
6752 (list 'call-interactively (list 'quote fun)) 7004 (list 'call-interactively (list 'quote fun))
@@ -6765,29 +7017,30 @@ table editor in arbitrary modes.")
6765 7017
6766;; Keybindings for the minor mode 7018;; Keybindings for the minor mode
6767(let ((bindings 7019(let ((bindings
6768 '(([(meta shift left)] org-table-delete-column) 7020 (list
6769 ([(meta left)] org-table-move-column-left) 7021 '([(meta shift left)] org-table-delete-column)
6770 ([(meta right)] org-table-move-column-right) 7022 '([(meta left)] org-table-move-column-left)
6771 ([(meta shift right)] org-table-insert-column) 7023 '([(meta right)] org-table-move-column-right)
6772 ([(meta shift up)] org-table-kill-row) 7024 '([(meta shift right)] org-table-insert-column)
6773 ([(meta shift down)] org-table-insert-row) 7025 '([(meta shift up)] org-table-kill-row)
6774 ([(meta up)] org-table-move-row-up) 7026 '([(meta shift down)] org-table-insert-row)
6775 ([(meta down)] org-table-move-row-down) 7027 '([(meta up)] org-table-move-row-up)
6776 ("\C-c\C-w" org-table-cut-region) 7028 '([(meta down)] org-table-move-row-down)
6777 ("\C-c\M-w" org-table-copy-region) 7029 '("\C-c\C-w" org-table-cut-region)
6778 ("\C-c\C-y" org-table-paste-rectangle) 7030 '("\C-c\M-w" org-table-copy-region)
6779 ("\C-c-" org-table-insert-hline) 7031 '("\C-c\C-y" org-table-paste-rectangle)
6780 ([(shift tab)] org-table-previous-field) 7032 '("\C-c-" org-table-insert-hline)
6781 ("\C-c\C-c" org-table-align) 7033 '([(shift tab)] org-table-previous-field)
6782 ([(return)] org-table-next-row) 7034 '("\C-c\C-c" org-table-align)
6783 ([(shift return)] org-table-copy-down) 7035 '("\C-m" org-table-next-row)
6784 ([(meta return)] org-table-wrap-region) 7036 (list (org-key 'S-return) 'org-table-copy-down)
6785 ("\C-c\C-q" org-table-wrap-region) 7037 '([(meta return)] org-table-wrap-region)
6786 ("\C-c?" org-table-current-column) 7038 '("\C-c\C-q" org-table-wrap-region)
6787 ("\C-c " org-table-blank-field) 7039 '("\C-c?" org-table-current-column)
6788 ("\C-c+" org-table-sum) 7040 '("\C-c " org-table-blank-field)
6789 ("\C-c|" org-table-toggle-vline-visibility) 7041 '("\C-c+" org-table-sum)
6790 ("\C-c=" org-table-eval-formula))) 7042 '("\C-c|" org-table-toggle-vline-visibility)
7043 '("\C-c=" org-table-eval-formula)))
6791 elt key fun cmd) 7044 elt key fun cmd)
6792 (while (setq elt (pop bindings)) 7045 (while (setq elt (pop bindings))
6793 (setq key (car elt) 7046 (setq key (car elt)
@@ -6796,14 +7049,6 @@ table editor in arbitrary modes.")
6796 (define-key orgtbl-mode-map key cmd))) 7049 (define-key orgtbl-mode-map key cmd)))
6797 7050
6798;; Special treatment needed for TAB and RET 7051;; Special treatment needed for TAB and RET
6799;(define-key orgtbl-mode-map [(return)]
6800; (orgtbl-make-binding 'org-table-next-row [(return)] "\C-m"))
6801;(define-key orgtbl-mode-map "\C-m"
6802; (orgtbl-make-binding 'org-table-next-row "\C-m" [(return)]))
6803;(define-key orgtbl-mode-map [(tab)]
6804; (orgtbl-make-binding 'org-table-next-field [(tab)] "\C-i"))
6805;(define-key orgtbl-mode-map "\C-i"
6806; (orgtbl-make-binding 'org-table-next-field "\C-i" [(tab)]))
6807 7052
6808(define-key orgtbl-mode-map [(return)] 7053(define-key orgtbl-mode-map [(return)]
6809 (orgtbl-make-binding 'orgtbl-ret [(return)] "\C-m")) 7054 (orgtbl-make-binding 'orgtbl-ret [(return)] "\C-m"))
@@ -7433,7 +7678,8 @@ and all options lines."
7433 (buffer (find-file-noselect filename)) 7678 (buffer (find-file-noselect filename))
7434 (ore (concat 7679 (ore (concat
7435 (org-make-options-regexp 7680 (org-make-options-regexp
7436 '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO" "STARTUP" 7681 '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO"
7682 "STARTUP" "ARCHIVE"
7437 "TITLE" "AUTHOR" "EMAIL" "TEXT" "OPTIONS" "LANGUAGE")) 7683 "TITLE" "AUTHOR" "EMAIL" "TEXT" "OPTIONS" "LANGUAGE"))
7438 (if org-noutline-p "\\(\n\\|$\\)" ""))) 7684 (if org-noutline-p "\\(\n\\|$\\)" "")))
7439 s e) 7685 s e)
@@ -7488,6 +7734,7 @@ Does include HTML export options as well as TODO and CATEGORY stuff."
7488#+SEQ_TODO: %s 7734#+SEQ_TODO: %s
7489#+TYP_TODO: %s 7735#+TYP_TODO: %s
7490#+STARTUP: %s %s 7736#+STARTUP: %s %s
7737#+ARCHIVE: %s
7491" 7738"
7492 (buffer-name) (user-full-name) user-mail-address org-export-default-language 7739 (buffer-name) (user-full-name) user-mail-address org-export-default-language
7493 org-export-headline-levels 7740 org-export-headline-levels
@@ -7510,6 +7757,7 @@ Does include HTML export options as well as TODO and CATEGORY stuff."
7510 (cdr (assoc org-startup-folded 7757 (cdr (assoc org-startup-folded
7511 '((nil . "nofold")(t . "fold")(content . "content")))) 7758 '((nil . "nofold")(t . "fold")(content . "content"))))
7512 (if org-startup-with-deadline-check "dlcheck" "nodlcheck") 7759 (if org-startup-with-deadline-check "dlcheck" "nodlcheck")
7760 org-archive-location
7513 )) 7761 ))
7514 7762
7515(defun org-insert-export-options-template () 7763(defun org-insert-export-options-template ()
@@ -7606,6 +7854,7 @@ headlines. The default is 3. Lower levels will become bulleted lists."
7606 (text nil) 7854 (text nil)
7607 (lang-words nil) 7855 (lang-words nil)
7608 (head-count 0) cnt 7856 (head-count 0) cnt
7857 (start 0)
7609 table-open type 7858 table-open type
7610 table-buffer table-orig-buffer 7859 table-buffer table-orig-buffer
7611 ) 7860 )
@@ -7703,8 +7952,15 @@ headlines. The default is 3. Lower levels will become bulleted lists."
7703 )) 7952 ))
7704 (setq head-count 0) 7953 (setq head-count 0)
7705 (org-init-section-numbers) 7954 (org-init-section-numbers)
7706
7707 (while (setq line (pop lines) origline line) 7955 (while (setq line (pop lines) origline line)
7956 ;; Protect the links
7957 (setq start 0)
7958 (while (string-match org-link-maybe-angles-regexp line start)
7959 (setq start (match-end 0))
7960 (setq line (replace-match
7961 (concat "\000" (match-string 1 line) "\000")
7962 t t line)))
7963
7708 ;; replace "<" and ">" by "&lt;" and "&gt;" 7964 ;; replace "<" and ">" by "&lt;" and "&gt;"
7709 ;; handle @<..> HTML tags (replace "@&gt;..&lt;" by "<..>") 7965 ;; handle @<..> HTML tags (replace "@&gt;..&lt;" by "<..>")
7710 (setq line (org-html-expand line)) 7966 (setq line (org-html-expand line))
@@ -7722,27 +7978,34 @@ headlines. The default is 3. Lower levels will become bulleted lists."
7722 (not (string-match "^[ \t]+\\(:.*\\)" 7978 (not (string-match "^[ \t]+\\(:.*\\)"
7723 (car lines)))) 7979 (car lines))))
7724 "<br>\n" "\n")))) 7980 "<br>\n" "\n"))))
7725 7981 (setq start 0)
7726 (when (string-match org-link-regexp line) 7982 (while (string-match org-protected-link-regexp line start)
7983 (setq start (- (match-end 0) 2))
7727 (setq type (match-string 1 line)) 7984 (setq type (match-string 1 line))
7728 (cond 7985 (cond
7729 ((member type '("http" "https" "ftp" "mailto" "news")) 7986 ((member type '("http" "https" "ftp" "mailto" "news"))
7730 ;; standard URL 7987 ;; standard URL
7731 (setq line (replace-match 7988 (setq line (replace-match
7732 "<a href=\"\\1:\\2\">&lt;\\1:\\2&gt;</a>" 7989; "<a href=\"\\1:\\2\">&lt;\\1:\\2&gt;</a>"
7990 "<a href=\"\\1:\\2\">\\1:\\2</a>"
7733 nil nil line))) 7991 nil nil line)))
7734 ((string= type "file") 7992 ((string= type "file")
7735 ;; FILE link 7993 ;; FILE link
7736
7737 (let* ((filename (match-string 2 line)) 7994 (let* ((filename (match-string 2 line))
7995 (abs-p (file-name-absolute-p filename))
7996 (thefile (if abs-p (expand-file-name filename) filename))
7997 (thefile (save-match-data
7998 (if (string-match ":[0-9]+$" thefile)
7999 (replace-match "" t t thefile)
8000 thefile)))
7738 (file-is-image-p 8001 (file-is-image-p
7739 (save-match-data 8002 (save-match-data
7740 (string-match (org-image-file-name-regexp) filename)))) 8003 (string-match (org-image-file-name-regexp) thefile))))
7741 (setq line (replace-match 8004 (setq line (replace-match
7742 (if (and org-export-html-inline-images 8005 (if (and org-export-html-inline-images
7743 file-is-image-p) 8006 file-is-image-p)
7744 "<img src=\"\\2\"/>" 8007 (concat "<img src=\"" thefile "\"/>")
7745 "<a href=\"\\2\">\\1:\\2</a>") 8008 (concat "<a href=\"" thefile "\">\\1:\\2</a>"))
7746 nil nil line)))) 8009 nil nil line))))
7747 8010
7748 ((member type '("bbdb" "vm" "wl" "rmail" "gnus" "shell")) 8011 ((member type '("bbdb" "vm" "wl" "rmail" "gnus" "shell"))
@@ -7840,20 +8103,15 @@ headlines. The default is 3. Lower levels will become bulleted lists."
7840 (let ((head (and org-export-highlight-first-table-line 8103 (let ((head (and org-export-highlight-first-table-line
7841 (delq nil (mapcar 8104 (delq nil (mapcar
7842 (lambda (x) (string-match "^[ \t]*|-" x)) 8105 (lambda (x) (string-match "^[ \t]*|-" x))
7843 lines)))) 8106 (cdr lines)))))
7844 lastline line fields html empty) 8107 line fields html)
7845 (setq html (concat org-export-html-table-tag "\n")) 8108 (setq html (concat org-export-html-table-tag "\n"))
7846 (while (setq lastline line 8109 (while (setq line (pop lines))
7847 line (pop lines))
7848 (setq empty "&nbsp")
7849 (catch 'next-line 8110 (catch 'next-line
7850 (if (string-match "^[ \t]*|-" line) 8111 (if (string-match "^[ \t]*|-" line)
7851 (if lastline 8112 (progn
7852 ;; A hline: simulate an empty table row instead. 8113 (setq head nil) ;; head ends here, first time around
7853 (setq line (org-fake-empty-table-line lastline) 8114 ;; ignore this line
7854 head nil
7855 empty "")
7856 ;; Ignore this line
7857 (throw 'next-line t))) 8115 (throw 'next-line t)))
7858 ;; Break the line into fields 8116 ;; Break the line into fields
7859 (setq fields (org-split-string line "[ \t]*|[ \t]*")) 8117 (setq fields (org-split-string line "[ \t]*|[ \t]*"))
@@ -7861,7 +8119,6 @@ headlines. The default is 3. Lower levels will become bulleted lists."
7861 html 8119 html
7862 "<tr>" 8120 "<tr>"
7863 (mapconcat (lambda (x) 8121 (mapconcat (lambda (x)
7864 (if (equal x "") (setq x empty))
7865 (if head 8122 (if head
7866 (concat "<th>" x "</th>") 8123 (concat "<th>" x "</th>")
7867 (concat "<td valign=\"top\">" x "</td>"))) 8124 (concat "<td valign=\"top\">" x "</td>")))
@@ -7950,9 +8207,9 @@ But it has the disadvantage, that Org-mode's HTML conversions cannot be used."
7950 (r (if m (substring string m) ""))) 8207 (r (if m (substring string m) "")))
7951 ;; convert < to &lt; and > to &gt; 8208 ;; convert < to &lt; and > to &gt;
7952 (while (string-match "<" s) 8209 (while (string-match "<" s)
7953 (setq s (replace-match "&lt;" nil nil s))) 8210 (setq s (replace-match "&lt;" t t s)))
7954 (while (string-match ">" s) 8211 (while (string-match ">" s)
7955 (setq s (replace-match "&gt;" nil nil s))) 8212 (setq s (replace-match "&gt;" t t s)))
7956 (if org-export-html-expand 8213 (if org-export-html-expand
7957 (while (string-match "@&lt;\\([^&]*\\)&gt;" s) 8214 (while (string-match "@&lt;\\([^&]*\\)&gt;" s)
7958 (setq s (replace-match "<\\1>" nil nil s)))) 8215 (setq s (replace-match "<\\1>" nil nil s))))
@@ -8161,7 +8418,6 @@ When LEVEL is non-nil, increase section numbers on that level."
8161;; i k @ expendable from outline-mode 8418;; i k @ expendable from outline-mode
8162;; 0123456789 ! $%^& * ()_{} " ~`' free 8419;; 0123456789 ! $%^& * ()_{} " ~`' free
8163 8420
8164(define-key org-mode-map [(tab)] 'org-cycle)
8165(define-key org-mode-map "\C-i" 'org-cycle) 8421(define-key org-mode-map "\C-i" 'org-cycle)
8166(define-key org-mode-map [(meta tab)] 'org-complete) 8422(define-key org-mode-map [(meta tab)] 'org-complete)
8167(define-key org-mode-map "\M-\C-i" 'org-complete) 8423(define-key org-mode-map "\M-\C-i" 'org-complete)
@@ -8179,6 +8435,7 @@ When LEVEL is non-nil, increase section numbers on that level."
8179(define-key org-mode-map "\C-c\C-h\C-w" 'org-cut-special) 8435(define-key org-mode-map "\C-c\C-h\C-w" 'org-cut-special)
8180(define-key org-mode-map "\C-c\C-h\M-w" 'org-copy-special) 8436(define-key org-mode-map "\C-c\C-h\M-w" 'org-copy-special)
8181(define-key org-mode-map "\C-c\C-h\C-y" 'org-paste-special) 8437(define-key org-mode-map "\C-c\C-h\C-y" 'org-paste-special)
8438(define-key org-mode-map "\C-c$" 'org-archive-subtree)
8182(define-key org-mode-map "\C-c\C-j" 'org-goto) 8439(define-key org-mode-map "\C-c\C-j" 'org-goto)
8183(define-key org-mode-map "\C-c\C-t" 'org-todo) 8440(define-key org-mode-map "\C-c\C-t" 'org-todo)
8184(define-key org-mode-map "\C-c\C-s" 'org-schedule) 8441(define-key org-mode-map "\C-c\C-s" 'org-schedule)
@@ -8201,21 +8458,19 @@ When LEVEL is non-nil, increase section numbers on that level."
8201(define-key org-mode-map "\C-c[" 'org-add-file) 8458(define-key org-mode-map "\C-c[" 'org-add-file)
8202(define-key org-mode-map "\C-c]" 'org-remove-file) 8459(define-key org-mode-map "\C-c]" 'org-remove-file)
8203(define-key org-mode-map "\C-c\C-r" 'org-timeline) 8460(define-key org-mode-map "\C-c\C-r" 'org-timeline)
8204(define-key org-mode-map [(shift up)] 'org-shiftup) 8461(define-key org-mode-map (org-key 'S-up) 'org-shiftup)
8205(define-key org-mode-map [(shift down)] 'org-shiftdown) 8462(define-key org-mode-map (org-key 'S-down) 'org-shiftdown)
8206(define-key org-mode-map [(shift left)] 'org-timestamp-down-day) 8463(define-key org-mode-map (org-key 'S-left) 'org-timestamp-down-day)
8207(define-key org-mode-map [(shift right)] 'org-timestamp-up-day) 8464(define-key org-mode-map (org-key 'S-right) 'org-timestamp-up-day)
8208(define-key org-mode-map "\C-c-" 'org-table-insert-hline) 8465(define-key org-mode-map "\C-c-" 'org-table-insert-hline)
8209;; The following line is e.g. necessary for German keyboards under Suse Linux 8466;; The following line is e.g. necessary for German keyboards under Suse Linux
8210(unless org-xemacs-p 8467(unless org-xemacs-p
8211 (define-key org-mode-map [S-iso-lefttab] 'org-shifttab)) 8468 (define-key org-mode-map [S-iso-lefttab] 'org-shifttab))
8212(define-key org-mode-map [(shift tab)] 'org-shifttab) 8469(define-key org-mode-map [(shift tab)] 'org-shifttab)
8213(define-key org-mode-map "\C-c\C-c" 'org-ctrl-c-ctrl-c) 8470(define-key org-mode-map "\C-c\C-c" 'org-ctrl-c-ctrl-c)
8214(define-key org-mode-map [(return)] 'org-return) 8471(define-key org-mode-map "\C-m" 'org-return)
8215(define-key org-mode-map [(shift return)] 'org-table-copy-down) 8472(define-key org-mode-map (org-key 'S-return) 'org-table-copy-down)
8216(define-key org-mode-map [(meta return)] 'org-meta-return) 8473(define-key org-mode-map [(meta return)] 'org-meta-return)
8217(define-key org-mode-map [(control up)] 'org-move-line-up)
8218(define-key org-mode-map [(control down)] 'org-move-line-down)
8219(define-key org-mode-map "\C-c?" 'org-table-current-column) 8474(define-key org-mode-map "\C-c?" 'org-table-current-column)
8220(define-key org-mode-map "\C-c " 'org-table-blank-field) 8475(define-key org-mode-map "\C-c " 'org-table-blank-field)
8221(define-key org-mode-map "\C-c+" 'org-table-sum) 8476(define-key org-mode-map "\C-c+" 'org-table-sum)
@@ -8234,15 +8489,12 @@ When LEVEL is non-nil, increase section numbers on that level."
8234(define-key org-mode-map "\C-c\C-xh" 'org-export-as-html) 8489(define-key org-mode-map "\C-c\C-xh" 'org-export-as-html)
8235(define-key org-mode-map "\C-c\C-x\C-h" 'org-export-as-html-and-open) 8490(define-key org-mode-map "\C-c\C-x\C-h" 'org-export-as-html-and-open)
8236 8491
8237
8238;; FIXME: Do we really need to save match data in these commands?
8239;; I would like to remove it in order to minimize impact.
8240;; Self-insert already does not preserve it. How much resources used by this???
8241
8242(defsubst org-table-p () 8492(defsubst org-table-p ()
8243 (if (and (eq major-mode 'org-mode) font-lock-mode) 8493 (if (and (eq major-mode 'org-mode) font-lock-mode)
8244 (eq (get-text-property (point) 'face) 'org-table) 8494 (eq (get-text-property (point) 'face) 'org-table)
8245 (save-match-data (org-at-table-p)))) 8495 ;; (save-match-data (org-at-table-p)))) ; FIXME: OK to not use this?
8496 (org-at-table-p)))
8497
8246 8498
8247(defun org-self-insert-command (N) 8499(defun org-self-insert-command (N)
8248 "Like `self-insert-command', use overwrite-mode for whitespace in tables. 8500 "Like `self-insert-command', use overwrite-mode for whitespace in tables.
@@ -8504,7 +8756,9 @@ the automatic table editor has been turned off."
8504 ["Promote Heading" org-metaleft (not (org-at-table-p))] 8756 ["Promote Heading" org-metaleft (not (org-at-table-p))]
8505 ["Promote Subtree" org-shiftmetaleft (not (org-at-table-p))] 8757 ["Promote Subtree" org-shiftmetaleft (not (org-at-table-p))]
8506 ["Demote Heading" org-metaright (not (org-at-table-p))] 8758 ["Demote Heading" org-metaright (not (org-at-table-p))]
8507 ["Demote Subtree" org-shiftmetaright (not (org-at-table-p))]) 8759 ["Demote Subtree" org-shiftmetaright (not (org-at-table-p))]
8760 "--"
8761 ["Archive Subtree" org-archive-subtree t])
8508 "--" 8762 "--"
8509 ("TODO Lists" 8763 ("TODO Lists"
8510 ["TODO/DONE/-" org-todo t] 8764 ["TODO/DONE/-" org-todo t]
@@ -8769,11 +9023,11 @@ Only visible heading lines are considered, unless INVISIBLE-OK is non-nil."
8769 (outline-back-to-heading invisible-ok) 9023 (outline-back-to-heading invisible-ok)
8770 (if (looking-at outline-regexp) 9024 (if (looking-at outline-regexp)
8771 t 9025 t
8772 (if (re-search-backward (concat (if invisible-ok "[\r\n]" "^") 9026 (if (re-search-backward (concat (if invisible-ok "\\([\r\n]\\|^\\)" "^")
8773 outline-regexp) 9027 outline-regexp)
8774 nil t) 9028 nil t)
8775 (if invisible-ok 9029 (if invisible-ok
8776 (progn (forward-char 1) 9030 (progn (goto-char (match-end 1))
8777 (looking-at outline-regexp))) 9031 (looking-at outline-regexp)))
8778 (error "Before first heading"))))) 9032 (error "Before first heading")))))
8779 9033
@@ -8894,7 +9148,6 @@ Show the heading too, if it is currently invisible."
8894 9148
8895(run-hooks 'org-load-hook) 9149(run-hooks 'org-load-hook)
8896 9150
8897;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd 9151;;; arch-tag: e3a97958-3c2c-487f-9557-fafc3c98452a
8898
8899;;; org.el ends here 9152;;; org.el ends here
8900 9153
diff --git a/man/ChangeLog b/man/ChangeLog
index 70e55a4b8df..cfbbf8aab89 100644
--- a/man/ChangeLog
+++ b/man/ChangeLog
@@ -1,3 +1,7 @@
12005-06-13 Carsten Dominik <dominik@science.uva.nl>
2
3 * org.texi: Version 3.11
4
12005-06-12 Jay Belanger <belanger@truman.edu> 52005-06-12 Jay Belanger <belanger@truman.edu>
2 6
3 * calc.texi (Getting Started): Remove extra menu item. 7 * calc.texi (Getting Started): Remove extra menu item.