aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCarsten Dominik2005-12-20 08:08:48 +0000
committerCarsten Dominik2005-12-20 08:08:48 +0000
commitd924f2e5dc72ef24a5d55974381ed1476d058b6d (patch)
treefb993680af39206fda340127851e5b37655a4ed8
parent54e42ad99ad88224ddfbda54603499d18500c92a (diff)
downloademacs-d924f2e5dc72ef24a5d55974381ed1476d058b6d.tar.gz
emacs-d924f2e5dc72ef24a5d55974381ed1476d058b6d.zip
(org-agenda-custom-commands): New option.
(org-agenda): Offer custom commands on splash screen. (org-make-tags-matcher): Parser for Boolean logic added. (org-agenda-set-tags): New command. (org-agenda-menu, org-agenda-mode-map): Add `org-agenda-set-tags'. (org-set-tags): Efficiency improvements. (org-auto-align-tags): New option. (org-todo, org-demote, org-promote): Realign tags. (org-tags-completion-function): Use also "&" and "|" as separators. (org-org-menu): Agenda commands simplified.
-rw-r--r--lisp/ChangeLog14
-rw-r--r--lisp/textmodes/org.el248
-rw-r--r--man/ChangeLog5
-rw-r--r--man/org.texi196
4 files changed, 306 insertions, 157 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index ce448411be9..45bfb786f0b 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,17 @@
12005-12-20 Carsten Dominik <dominik@science.uva.nl>
2
3 * textmodes/org.el: (org-agenda-custom-commands): New option.
4 (org-agenda): Offer custom commands on splash screen.
5 (org-make-tags-matcher): Parser for Boolean logic added.
6 (org-agenda-set-tags): New command.
7 (org-agenda-menu, org-agenda-mode-map): Add `org-agenda-set-tags'.
8 (org-set-tags): Efficiency improvements.
9 (org-auto-align-tags): New option.
10 (org-todo, org-demote, org-promote): Realign tags.
11 (org-tags-completion-function): Use also "&" and "|" as
12 separators.
13 (org-org-menu): Agenda commands simplified.
14
12005-12-19 Luc Teirlinck <teirllm@auburn.edu> 152005-12-19 Luc Teirlinck <teirllm@auburn.edu>
2 16
3 * cus-edit.el (customize-apropos, customize-apropos-options): 17 * cus-edit.el (customize-apropos, customize-apropos-options):
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el
index 2e79be9e4cc..3cdc40b9f32 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.00 8;; Version: 4.01
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
@@ -81,6 +81,13 @@
81;; 81;;
82;; Changes: 82;; Changes:
83;; ------- 83;; -------
84;; Version 4.01
85;; - Tags can also be set remotely from agenda buffer.
86;; - Boolean logic for tag searches.
87;; - Additional agenda commands can be configured through the variable
88;; `org-agenda-custom-commands'.
89;; - Minor bug fixes.
90;;
84;; Version 4.00 91;; Version 4.00
85;; - Headlines can contain TAGS, and Org-mode can produced a list 92;; - Headlines can contain TAGS, and Org-mode can produced a list
86;; of matching headlines based on a TAG search expression. 93;; of matching headlines based on a TAG search expression.
@@ -199,7 +206,7 @@
199;; - Cleanup. 206;; - Cleanup.
200;; 207;;
201;; Version 3.07 208;; Version 3.07
202;; - Some folding incinsistencies removed. 209;; - Some folding inconsistencies removed.
203;; - BBDB links to company-only entries. 210;; - BBDB links to company-only entries.
204;; - Bug fixes and global cleanup. 211;; - Bug fixes and global cleanup.
205;; 212;;
@@ -266,7 +273,7 @@
266 273
267;;; Customization variables 274;;; Customization variables
268 275
269(defvar org-version "4.00" 276(defvar org-version "4.01"
270 "The version number of the file org.el.") 277 "The version number of the file org.el.")
271(defun org-version () 278(defun org-version ()
272 (interactive) 279 (interactive)
@@ -594,6 +601,23 @@ Entries are added to this list with \\[org-agenda-file-to-front] and removed wit
594 :group 'org-agenda 601 :group 'org-agenda
595 :type '(repeat file)) 602 :type '(repeat file))
596 603
604(defcustom org-agenda-custom-commands
605 '(("w" todo "WAITING")
606 ("u" tags "+WORK+URGENT-BOSS"))
607 "Custom commands for the agenda.
608These commands will be offered on the splash screen displayed by the
609agenda dispatcher \\[org-agenda]. Each entry is a list of 3 items:
610
611key The key (as a string) to be associated with the command.
612type The command type, either `todo' for a todo list with a specific
613 todo keyword, or `tags' for a tags search.
614match What to search for. Either a TODO keyword, or a tags match query."
615 :group 'org-agenda
616 :type '(repeat
617 (list (string :tag "Key")
618 (choice :tag "Type" (const tags) (const todo))
619 (string :tag "Match"))))
620
597(defcustom org-select-timeline-window t 621(defcustom org-select-timeline-window t
598 "Non-nil means, after creating a timeline, move cursor into Timeline window. 622 "Non-nil means, after creating a timeline, move cursor into Timeline window.
599When nil, cursor will remain in the current window." 623When nil, cursor will remain in the current window."
@@ -981,7 +1005,7 @@ first line, so it is probably best to use this in combinations with
981 :tag "Org Tags" 1005 :tag "Org Tags"
982 :group 'org) 1006 :group 'org)
983 1007
984(defcustom org-tags-column 40 1008(defcustom org-tags-column 48
985 "The column to which tags should be indented in a headline. 1009 "The column to which tags should be indented in a headline.
986If this number is positive, it specified the column. If it is negative, 1010If this number is positive, it specified the column. If it is negative,
987it means that the tags should be flushright to that column. For example, 1011it means that the tags should be flushright to that column. For example,
@@ -989,9 +1013,19 @@ it means that the tags should be flushright to that column. For example,
989 :group 'org-tags 1013 :group 'org-tags
990 :type 'integer) 1014 :type 'integer)
991 1015
1016(defcustom org-auto-align-tags t
1017 "Non-nil means, realign tags after pro/demotion of TODO state change.
1018These operations change the length of a headline and therefore shift
1019the tags around. With this options turned on, after each such operation
1020the tags are again aligned to `org-tags-column'."
1021 :group 'org-tags
1022 :type 'boolean)
1023
992(defcustom org-use-tag-inheritance t 1024(defcustom org-use-tag-inheritance t
993 "Non-nil means, tags in levels apply also for sublevels. 1025 "Non-nil means, tags in levels apply also for sublevels.
994When nil, only the tags directly give in a specific line apply there." 1026When nil, only the tags directly give in a specific line apply there.
1027If you turn off this option, you very likely want to turn on the
1028companion option `org-tags-match-list-sublevels'."
995 :group 'org-tags 1029 :group 'org-tags
996 :type 'boolean) 1030 :type 'boolean)
997 1031
@@ -1000,7 +1034,9 @@ When nil, only the tags directly give in a specific line apply there."
1000Because of tag inheritance (see variable `org-use-tag-inheritance'), 1034Because of tag inheritance (see variable `org-use-tag-inheritance'),
1001the sublevels of a headline matching a tag search often also match 1035the sublevels of a headline matching a tag search often also match
1002the same search. Listing all of them can create very long lists. 1036the same search. Listing all of them can create very long lists.
1003Setting this variable to nil causes subtrees to be skipped." 1037Setting this variable to nil causes subtrees to be skipped.
1038This option is off by default, because inheritance in on. If you turn
1039inheritance off, you very likely want to turn this option on."
1004 :group 'org-tags 1040 :group 'org-tags
1005 :type 'boolean) 1041 :type 'boolean)
1006 1042
@@ -2721,6 +2757,8 @@ in the region."
2721 (up-head (make-string (1- level) ?*))) 2757 (up-head (make-string (1- level) ?*)))
2722 (if (= level 1) (error "Cannot promote to level 0. UNDO to recover")) 2758 (if (= level 1) (error "Cannot promote to level 0. UNDO to recover"))
2723 (replace-match up-head nil t) 2759 (replace-match up-head nil t)
2760 ;; Fixup tag positioning
2761 (and org-auto-align-tags (org-set-tags nil t))
2724 (if org-adapt-indentation 2762 (if org-adapt-indentation
2725 (org-fixup-indentation "^ " "" "^ ?\\S-")))) 2763 (org-fixup-indentation "^ " "" "^ ?\\S-"))))
2726 2764
@@ -2732,6 +2770,8 @@ in the region."
2732 (let* ((level (save-match-data (funcall outline-level))) 2770 (let* ((level (save-match-data (funcall outline-level)))
2733 (down-head (make-string (1+ level) ?*))) 2771 (down-head (make-string (1+ level) ?*)))
2734 (replace-match down-head nil t) 2772 (replace-match down-head nil t)
2773 ;; Fixup tag positioning
2774 (and org-auto-align-tags (org-set-tags nil t))
2735 (if org-adapt-indentation 2775 (if org-adapt-indentation
2736 (org-fixup-indentation "^ " " " "^\\S-")))) 2776 (org-fixup-indentation "^ " " " "^\\S-"))))
2737 2777
@@ -3467,6 +3507,8 @@ prefix arg, switch to that state."
3467 (org-log-done) 3507 (org-log-done)
3468 (if (not this) 3508 (if (not this)
3469 (org-log-done t)))) 3509 (org-log-done t))))
3510 ;; Fixup tag positioning
3511 (and org-auto-align-tags (org-set-tags nil t))
3470 (run-hooks 'org-after-todo-state-change-hook))) 3512 (run-hooks 'org-after-todo-state-change-hook)))
3471 ;; Fixup cursor location if close to the keyword 3513 ;; Fixup cursor location if close to the keyword
3472 (if (and (outline-on-heading-p) 3514 (if (and (outline-on-heading-p)
@@ -4226,6 +4268,7 @@ The following commands are available:
4226(define-key org-agenda-mode-map "o" 'delete-other-windows) 4268(define-key org-agenda-mode-map "o" 'delete-other-windows)
4227(define-key org-agenda-mode-map "L" 'org-agenda-recenter) 4269(define-key org-agenda-mode-map "L" 'org-agenda-recenter)
4228(define-key org-agenda-mode-map "t" 'org-agenda-todo) 4270(define-key org-agenda-mode-map "t" 'org-agenda-todo)
4271(define-key org-agenda-mode-map ":" 'org-agenda-set-tags)
4229(define-key org-agenda-mode-map "." 'org-agenda-goto-today) 4272(define-key org-agenda-mode-map "." 'org-agenda-goto-today)
4230(define-key org-agenda-mode-map "d" 'org-agenda-day-view) 4273(define-key org-agenda-mode-map "d" 'org-agenda-day-view)
4231(define-key org-agenda-mode-map "w" 'org-agenda-week-view) 4274(define-key org-agenda-mode-map "w" 'org-agenda-week-view)
@@ -4293,6 +4336,7 @@ The following commands are available:
4293 :style toggle :selected org-agenda-follow-mode :active t] 4336 :style toggle :selected org-agenda-follow-mode :active t]
4294 "--" 4337 "--"
4295 ["Cycle TODO" org-agenda-todo t] 4338 ["Cycle TODO" org-agenda-todo t]
4339 ["Set Tags" org-agenda-set-tags t]
4296 ("Reschedule" 4340 ("Reschedule"
4297 ["Reschedule +1 day" org-agenda-date-later t] 4341 ["Reschedule +1 day" org-agenda-date-later t]
4298 ["Reschedule -1 day" org-agenda-date-earlier t] 4342 ["Reschedule -1 day" org-agenda-date-earlier t]
@@ -4338,7 +4382,7 @@ The following commands are available:
4338(defun org-agenda (arg) 4382(defun org-agenda (arg)
4339 "Dispatch agenda commands to collect entries to the agenda buffer. 4383 "Dispatch agenda commands to collect entries to the agenda buffer.
4340Prompts for a character to select a command. Any prefix arg will be passed 4384Prompts for a character to select a command. Any prefix arg will be passed
4341on to the selected command. Possible selections are: 4385on to the selected command. The default selections are:
4342 4386
4343a Call `org-agenda' to display the agenda for the current day or week. 4387a Call `org-agenda' to display the agenda for the current day or week.
4344t Call `org-todo-list' to display the global todo list. 4388t Call `org-todo-list' to display the global todo list.
@@ -4349,35 +4393,70 @@ m Call `org-tags-view' to display headlines with tags matching
4349 selections, like `+WORK+URGENT-WITHBOSS'. 4393 selections, like `+WORK+URGENT-WITHBOSS'.
4350M like `m', but select only TODO entries, no ordinary headlines. 4394M like `m', but select only TODO entries, no ordinary headlines.
4351 4395
4396More commands can be added by configuring the variable
4397`org-agenda-custom-commands'.
4398
4352If the current buffer is in Org-mode and visiting a file, you can also 4399If the current buffer is in Org-mode and visiting a file, you can also
4353first press `1' to indicate that the agenda should be temporarily 4400first press `1' to indicate that the agenda should be temporarily
4354restricted to the current file." 4401restricted to the current file."
4355 (interactive "P") 4402 (interactive "P")
4356 (let ((restrict-ok (and (buffer-file-name) (eq major-mode 'org-mode))) 4403 (catch 'exit
4357 c) 4404 (let ((restrict-ok (and (buffer-file-name) (eq major-mode 'org-mode)))
4358 (put 'org-agenda-files 'org-restrict nil) 4405 (custom org-agenda-custom-commands)
4359 (message"[a]genda [t]odoList [T]odoKwd [m]atchTags [M]atchTagsTodo%s" 4406 c entry key type string)
4360 (if restrict-ok " [1]JustThisFile" "")) 4407 (put 'org-agenda-files 'org-restrict nil)
4361 (setq c (read-char-exclusive)) 4408 (save-window-excursion
4362 (message "") 4409 (delete-other-windows)
4363 (when (equal c ?1) 4410 (switch-to-buffer-other-window " *Agenda Commands*")
4364 (if restrict-ok 4411 (erase-buffer)
4365 (put 'org-agenda-files 'org-restrict (list (buffer-file-name))) 4412 (insert
4366 (error "Cannot restrict agenda to current buffer")) 4413 "Press key for an agenda command:
4367 (message "Single file: [a]genda [t]odoList [T]odoKwd [m]atchTags [M]atchTagsTodo") 4414--------------------------------
4368 (setq c (read-char-exclusive)) 4415a Agenda for current week or day
4369 (message "")) 4416t List of all TODO entries T Entries with special TODO kwd
4370 (cond 4417m Match a TAGS query M Like m, but only TODO entries.
4371 ((equal c ?a) (call-interactively 'org-agenda-list)) 4418C Configure your own agenda commands")
4372 ((equal c ?t) (call-interactively 'org-todo-list)) 4419 (while (setq entry (pop custom))
4373 ((equal c ?T) 4420 (setq key (car entry) type (nth 1 entry) string (nth 2 entry))
4374 (setq current-prefix-arg (or arg '(4))) 4421 (insert (format "\n%-4s%-12s: %s"
4375 (call-interactively 'org-todo-list)) 4422 key
4376 ((equal c ?m) (call-interactively 'org-tags-view)) 4423 (if (eq type 'tags) "Tags query" "TODO keyword")
4377 ((equal c ?M) 4424 string)))
4378 (setq current-prefix-arg (or arg '(4))) 4425 (goto-char (point-min))
4379 (call-interactively 'org-tags-view)) 4426 (fit-window-to-buffer)
4380 (t (error "Invalid key"))))) 4427 (message "Press key for agenda command%s"
4428 (if restrict-ok ", or [1] to restrict to current file" ""))
4429 (setq c (read-char-exclusive))
4430 (message "")
4431 (when (equal c ?1)
4432 (if restrict-ok
4433 (put 'org-agenda-files 'org-restrict (list (buffer-file-name)))
4434 (error "Cannot restrict agenda to current buffer"))
4435 (message "Press key for agenda command%s"
4436 (if restrict-ok " (restricted to current file)" ""))
4437 (setq c (read-char-exclusive))
4438 (message "")))
4439 (require 'calendar) ; FIXME: can we avoid this for some commands?
4440 (cond
4441 ((equal c ?C) (customize-variable 'org-agenda-custom-commands))
4442 ((equal c ?a) (call-interactively 'org-agenda-list))
4443 ((equal c ?t) (call-interactively 'org-todo-list))
4444 ((equal c ?T)
4445 (setq current-prefix-arg (or arg '(4)))
4446 (call-interactively 'org-todo-list))
4447 ((equal c ?m) (call-interactively 'org-tags-view))
4448 ((equal c ?M)
4449 (setq current-prefix-arg (or arg '(4)))
4450 (call-interactively 'org-tags-view))
4451 ((setq entry (assoc (char-to-string c) org-agenda-custom-commands))
4452 (setq type (nth 1 entry) string (nth 2 entry))
4453 (cond
4454 ((eq type 'tags)
4455 (org-tags-view current-prefix-arg string))
4456 ((eq type 'todo)
4457 (org-todo-list string))
4458 (t (error "Invalid custom agenda command type %s" type))))
4459 (t (error "Invalid key"))))))
4381 4460
4382(defun org-fit-agenda-window () 4461(defun org-fit-agenda-window ()
4383 "Fit the window to the buffer size." 4462 "Fit the window to the buffer size."
@@ -4667,7 +4746,8 @@ for a keyword. A numeric prefix directly selects the Nth keyword in
4667 (kwds org-todo-keywords) 4746 (kwds org-todo-keywords)
4668 (completion-ignore-case t) 4747 (completion-ignore-case t)
4669 (org-select-this-todo-keyword 4748 (org-select-this-todo-keyword
4670 (and arg (integerp arg) (nth (1- arg) org-todo-keywords))) 4749 (if (stringp arg) arg
4750 (and arg (integerp arg) (nth (1- arg) org-todo-keywords))))
4671 rtn rtnall files file pos) 4751 rtn rtnall files file pos)
4672 (when (equal arg '(4)) 4752 (when (equal arg '(4))
4673 (setq org-select-this-todo-keyword 4753 (setq org-select-this-todo-keyword
@@ -6005,6 +6085,30 @@ the same tree node, and the headline of the tree node in the Org-mode file."
6005 (org-agenda-change-all-lines newhead hdmarker) 6085 (org-agenda-change-all-lines newhead hdmarker)
6006 (beginning-of-line 1))) 6086 (beginning-of-line 1)))
6007 6087
6088(defun org-agenda-set-tags ()
6089 "Set tags for the current headline."
6090 (interactive)
6091 (org-agenda-check-no-diary)
6092 (let* ((marker (or (get-text-property (point) 'org-marker)
6093 (org-agenda-error)))
6094 (hdmarker (get-text-property (point) 'org-hd-marker))
6095 (buffer (marker-buffer hdmarker))
6096 (pos (marker-position hdmarker))
6097 (buffer-read-only nil)
6098 newhead)
6099 (with-current-buffer buffer
6100 (widen)
6101 (goto-char pos)
6102 (org-show-hidden-entry)
6103 (save-excursion
6104 (and (outline-next-heading)
6105 (org-flag-heading nil))) ; show the next heading
6106 (call-interactively 'org-set-tags)
6107 (end-of-line 1)
6108 (setq newhead (org-get-heading)))
6109 (org-agenda-change-all-lines newhead hdmarker)
6110 (beginning-of-line 1)))
6111
6008(defun org-agenda-date-later (arg &optional what) 6112(defun org-agenda-date-later (arg &optional what)
6009 "Change the date of this item to one day later." 6113 "Change the date of this item to one day later."
6010 (interactive "p") 6114 (interactive "p")
@@ -6269,21 +6373,34 @@ MATCH can contain positive and negative selection of tags, like
6269(defun org-make-tags-matcher (match) 6373(defun org-make-tags-matcher (match)
6270 "Create the TAGS matcher form for the tags-selecting string MATCH." 6374 "Create the TAGS matcher form for the tags-selecting string MATCH."
6271 (unless match 6375 (unless match
6376 ;; Get a new match request, with completion
6272 (setq org-last-tags-completion-table 6377 (setq org-last-tags-completion-table
6273 (or (org-get-buffer-tags) 6378 (or (org-get-buffer-tags)
6274 org-last-tags-completion-table)) 6379 org-last-tags-completion-table))
6275 (setq match (completing-read 6380 (setq match (completing-read
6276 "Tags: " 'org-tags-completion-function nil nil nil 6381 "Tags: " 'org-tags-completion-function nil nil nil
6277 'org-tags-history))) 6382 'org-tags-history)))
6278 (let ((match0 match) minus tag mm matcher) 6383 ;; parse the string and create a lisp form
6279 (while (string-match "^\\([-+:]\\)?\\([A-Za-z_]+\\)" match) 6384 (let ((match0 match) minus tag mm matcher orterms term orlist)
6280 (setq minus (and (match-end 1) (equal (string-to-char match) ?-)) 6385 (setq orterms (org-split-string match "|"))
6281 tag (match-string 2 match) 6386 (while (setq term (pop orterms))
6282 match (substring match (match-end 0)) 6387 (while (string-match "^&?\\([-+:]\\)?\\([A-Za-z_]+\\)" term)
6283 mm (list 'member (downcase tag) 'tags-list) 6388 (setq minus (and (match-end 1)
6284 mm (if minus (list 'not mm) mm)) 6389 (equal (match-string 1 term) "-"))
6285 (push mm matcher)) 6390 tag (match-string 2 term)
6286 (cons match0 (cons 'and matcher)))) 6391 term (substring term (match-end 0))
6392 mm (list 'member (downcase tag) 'tags-list)
6393 mm (if minus (list 'not mm) mm))
6394 (push mm matcher))
6395 (push (if (> (length matcher) 1) (cons 'and matcher) (car matcher))
6396 orlist)
6397 (setq matcher nil))
6398 (setq matcher (if (> (length orlist) 1) (cons 'or orlist) (car orlist)))
6399 ;; Return the string and lisp forms of the matcher
6400 (cons match0 matcher)))
6401
6402;;(org-make-tags-matcher "&hello&-you")
6403
6287 6404
6288;;;###autoload 6405;;;###autoload
6289(defun org-tags-view (&optional todo-only match keep-modes) 6406(defun org-tags-view (&optional todo-only match keep-modes)
@@ -6368,32 +6485,35 @@ With prefix ARG, realign all tags in headings in the current buffer."
6368 (if just-align 6485 (if just-align
6369 (setq tags current) 6486 (setq tags current)
6370 (setq org-last-tags-completion-table 6487 (setq org-last-tags-completion-table
6371 (or (org-get-buffer-tags);; FIXME: replace +- with :, so that we can use history stuff??? 6488 (or (org-get-buffer-tags)
6372 org-last-tags-completion-table)) 6489 org-last-tags-completion-table))
6373 (setq tags 6490 (setq tags
6374 (let ((org-add-colon-after-tag-completion t)) 6491 (let ((org-add-colon-after-tag-completion t))
6375 (completing-read "Tags: " 'org-tags-completion-function 6492 (completing-read "Tags: " 'org-tags-completion-function
6376 nil nil current 'org-tags-history))) 6493 nil nil current 'org-tags-history)))
6377 (while (string-match "[-+]" tags) 6494 (while (string-match "[-+&]+" tags)
6378 (setq tags (replace-match ":" t t tags))) 6495 (setq tags (replace-match ":" t t tags)))
6379 (unless (string-match ":$" tags) (setq tags (concat tags ":"))) 6496 (unless (string-match ":$" tags) (setq tags (concat tags ":")))
6380 (unless (string-match "^:" tags) (setq tags (concat ":" tags)))) 6497 (unless (string-match "^:" tags) (setq tags (concat ":" tags))))
6381 (beginning-of-line 1) 6498 (if (equal current "")
6382 (looking-at (concat "\\(.*\\)\\(" (regexp-quote current) "\\)[ \t]*")) 6499 (end-of-line 1)
6383 (setq hd (save-match-data (org-trim (match-string 1)))) 6500 (beginning-of-line 1)
6384 (delete-region (match-beginning 0) (match-end 0)) 6501 (looking-at (concat "\\(.*\\)\\(" (regexp-quote current) "\\)[ \t]*"))
6385 (insert hd " ") 6502 (setq hd (match-string 1))
6386 (move-to-column (max (current-column) 6503 (delete-region (match-beginning 0) (match-end 0))
6387 (if (> org-tags-column 0) 6504 (insert (org-trim hd) " "))
6388 org-tags-column 6505 (unless (equal tags "")
6389 (- org-tags-column (length tags)))) 6506 (move-to-column (max (current-column)
6390 t) 6507 (if (> org-tags-column 0)
6391 (insert tags) 6508 org-tags-column
6509 (- (- org-tags-column) (length tags))))
6510 t)
6511 (insert tags))
6392 (move-to-column col)))) 6512 (move-to-column col))))
6393 6513
6394(defun org-tags-completion-function (string predicate &optional flag) 6514(defun org-tags-completion-function (string predicate &optional flag)
6395 (let (s1 s2 rtn (ctable org-last-tags-completion-table)) 6515 (let (s1 s2 rtn (ctable org-last-tags-completion-table))
6396 (if (string-match "^\\(.*[-+:]\\)\\([^-+:]*\\)$" string) 6516 (if (string-match "^\\(.*[-+:&|]\\)\\([^-+:&|]*\\)$" string)
6397 (setq s1 (match-string 1 string) 6517 (setq s1 (match-string 1 string)
6398 s2 (match-string 2 string)) 6518 s2 (match-string 2 string))
6399 (setq s1 "" s2 string)) 6519 (setq s1 "" s2 string))
@@ -11610,19 +11730,13 @@ See the individual commands for more information."
11610 ["Goto Calendar" org-goto-calendar t] 11730 ["Goto Calendar" org-goto-calendar t]
11611 ["Date from Calendar" org-date-from-calendar t]) 11731 ["Date from Calendar" org-date-from-calendar t])
11612 "--" 11732 "--"
11613 ("Agenda/Summary Views" 11733 ["Agenda Command" org-agenda t]
11614 "Current File" 11734 ("File List for Agenda")
11735 ("Special views current file"
11615 ["TODO Tree" org-show-todo-tree t] 11736 ["TODO Tree" org-show-todo-tree t]
11616 ["Check Deadlines" org-check-deadlines t] 11737 ["Check Deadlines" org-check-deadlines t]
11617 ["Timeline" org-timeline t] 11738 ["Timeline" org-timeline t]
11618 ["Tags Tree" org-tags-sparse-tree t] 11739 ["Tags Tree" org-tags-sparse-tree t])
11619 "--"
11620 "All Agenda Files"
11621 ["Command Dispatcher" org-agenda t]
11622 ["TODO list" org-todo-list t]
11623 ["Agenda" org-agenda-list t]
11624 ["Tags View" org-tags-view t])
11625 ("File List for Agenda")
11626 "--" 11740 "--"
11627 ("Hyperlinks" 11741 ("Hyperlinks"
11628 ["Store Link (Global)" org-store-link t] 11742 ["Store Link (Global)" org-store-link t]
@@ -12011,5 +12125,3 @@ Show the heading too, if it is currently invisible."
12011 12125
12012;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd 12126;; arch-tag: e77da1a7-acc7-4336-b19e-efa25af3f9fd
12013;;; org.el ends here 12127;;; org.el ends here
12014
12015
diff --git a/man/ChangeLog b/man/ChangeLog
index debad982ffc..e724f24167c 100644
--- a/man/ChangeLog
+++ b/man/ChangeLog
@@ -1,3 +1,8 @@
12005-12-20 Carsten Dominik <dominik@science.uva.nl>
2
3 * org.texi: (Tags): Boolean logic documented.
4 (Agenda Views): Document custom commands.
5
12005-12-20 David Kastrup <dak@gnu.org> 62005-12-20 David Kastrup <dak@gnu.org>
2 7
3 * faq.texi (AUCTeX): Update version and mailing list info. 8 * faq.texi (AUCTeX): Update version and mailing list info.
diff --git a/man/org.texi b/man/org.texi
index 0477077d91f..5056119b3b2 100644
--- a/man/org.texi
+++ b/man/org.texi
@@ -4,7 +4,7 @@
4@setfilename ../info/org 4@setfilename ../info/org
5@settitle Org Mode Manual 5@settitle Org Mode Manual
6 6
7@set VERSION 4.00 7@set VERSION 4.01
8@set DATE December 2005 8@set DATE December 2005
9 9
10@dircategory Emacs 10@dircategory Emacs
@@ -229,7 +229,7 @@ ways, for example
229 229
230@example 230@example
231@r{@bullet{} as an outline extension with visibility cycling and structure editing} 231@r{@bullet{} as an outline extension with visibility cycling and structure editing}
232@r{@bullet{} as an ASCII system and table editor to take structured notes} 232@r{@bullet{} as an ASCII system and table editor for taking structured notes}
233@r{@bullet{} as an ASCII table editor with spreadsheet-like capabilities} 233@r{@bullet{} as an ASCII table editor with spreadsheet-like capabilities}
234@r{@bullet{} as a simple hypertext system, with HTML export} 234@r{@bullet{} as a simple hypertext system, with HTML export}
235@r{@bullet{} as a TODO list editor} 235@r{@bullet{} as a TODO list editor}
@@ -532,7 +532,7 @@ functionality.
532@node Archiving, Sparse trees, Structure editing, Document Structure 532@node Archiving, Sparse trees, Structure editing, Document Structure
533@section Archiving 533@section Archiving
534@cindex archiving 534@cindex archiving
535@cindex filing subtries 535@cindex filing subtrees
536 536
537When a project represented by a (sub)tree is finished, you may want 537When a project represented by a (sub)tree is finished, you may want
538to move the tree to an archive place, either in the same file under a 538to move the tree to an archive place, either in the same file under a
@@ -618,12 +618,24 @@ well. For example, in the list
618 618
619@example 619@example
620* Meeting with the French group :WORK: 620* Meeting with the French group :WORK:
621** Summary by Frank :BOSS: 621** Summary by Frank :BOSS:NOTES:
622*** TODO Prepare slides for him :ACTION: 622*** TODO Prepare slides for him :ACTION:
623@end example 623@end example
624@noindent 624@noindent
625the final heading will have the tags @samp{:WORK:}, @samp{:BOSS:}, and 625the final heading will have the tags @samp{:WORK:}, @samp{:BOSS:},
626@samp{:ACTION:}. 626@samp{:NOTES:}, and @samp{:ACTION:}. When executing tag searches and
627Org-mode finds that a certain headline matches the search criterion,
628it will not check any sublevel headline, assuming that these likely
629also match, and that the list of matches can become very long. You
630can influence inheritance and searching using the variables
631@code{org-use-tag-inheritance} and
632@code{org-tags-match-list-sublevels}.
633
634@kindex M-@key{TAB}
635Tags can simply be typed into the buffer. After a colon,
636@kbd{M-@key{TAB}} offers completion on all tags being used in the
637current buffer. There are also special commands for inserting tags,
638and for executing searches based on tags.
627 639
628@table @kbd 640@table @kbd
629@kindex C-c C-c 641@kindex C-c C-c
@@ -631,29 +643,33 @@ the final heading will have the tags @samp{:WORK:}, @samp{:BOSS:}, and
631@cindex completion, of tags 643@cindex completion, of tags
632Enter new tags for the current headline. The minibuffer will prompt 644Enter new tags for the current headline. The minibuffer will prompt
633for a list of tags and offer completion with respect to all other tags 645for a list of tags and offer completion with respect to all other tags
634used in the current buffer. After pressing @key{RET}, the tags will 646used in the current buffer. Several tags, separated by colons, may be
647specified at the prompt. After pressing @key{RET}, the tags will
635be inserted and aligned to @code{org-tags-column}. When called with a 648be inserted and aligned to @code{org-tags-column}. When called with a
636@kbd{C-u} prefix, align all tags in the current buffer to that column, 649@kbd{C-u} prefix, align all tags in the current buffer to that column,
637just to make things look nice. Tags can also be just typed into the 650just to make things look nice. TAGS are automatically realigned after
638buffer, with @kbd{M-@key{TAB}} support. 651promotion, demotion, and TODO state changes (@pxref{TODO basics}).
639@cindex M-@key{TAB}
640@item M-@key{TAB}
641Tags can also be typed directly into the buffer, using
642@kbd{M-@key{TAB}} completion.
643@kindex C-c \ 652@kindex C-c \
644@item C-c \ 653@item C-c \
645Create a sparse tree with all headlines matching a given set of tags. 654Create a sparse tree with all headlines matching a tags search.
646The command prompts for the tags to match. The criterion is just a
647list of tags separated by @samp{+} or @samp{-} for positive and
648negative selection. For example, @samp{+WORK-BOSS} would select all
649headlines that are tagged @samp{:WORK:}, but discard those also tagged
650@samp{:BOSS:}.
651@kindex C-c a m 655@kindex C-c a m
652@item C-c a m 656@item C-c a m
653Create a global list of tag matches from all agenda files. 657Create a global list of tag matches from all agenda files.
654@xref{Matching headline tags}. 658@xref{Matching headline tags}.
655@end table 659@end table
656 660
661A tags search string can use Boolean operators @samp{&} for AND and
662@samp{|} for OR. @samp{&} binds more strongly than
663@samp{|}. Parenthesis are currently no implemented. A tag may also be
664preceded by @samp{-}, to select against it, and @samp{+} is syntactic
665sugar for positive selection. The AND operator @samp{&} is optional
666when @samp{+} or @samp{-} is present. For example, @samp{+WORK-BOSS}
667would select all headlines that are tagged @samp{:WORK:}, but discard
668those also tagged @samp{:BOSS:}. The search string @samp{WORK|LAPTOP}
669selects all lines tagged @samp{:WORK:} or @samp{:LAPTOP:}. The string
670@samp{WORK|LAPTOP&NIGHT} requires that the @samp{:LAPTOP:} lines are
671also tagged @samp{NIGHT}.
672
657@node Plain Lists, , Tags, Document Structure 673@node Plain Lists, , Tags, Document Structure
658@section Plain Lists 674@section Plain Lists
659@cindex plain lists 675@cindex plain lists
@@ -692,7 +708,7 @@ My favorite scenes are (in this order)
692@end example 708@end example
693 709
694Org-mode supports these lists by tuning filling and wrapping commands 710Org-mode supports these lists by tuning filling and wrapping commands
695to correctly deal with them. Futhermore, the following commands act 711to correctly deal with them. Furthermore, the following commands act
696on items when the cursor is in the first line of an item (the line 712on items when the cursor is in the first line of an item (the line
697with the bullet or number). 713with the bullet or number).
698 714
@@ -1322,11 +1338,11 @@ links to other files, Usenet articles, emails and much more.
1322 1338
1323Similar to Wiki implementations, Org-mode interprets words spelled in 1339Similar to Wiki implementations, Org-mode interprets words spelled in
1324CamelCase (i.e. mixed case with at least one capital letter following 1340CamelCase (i.e. mixed case with at least one capital letter following
1325on a small letter inside the word) as links. While in Wiki 1341on a small letter inside the word) as links. While in Wiki these
1326implementations these links usually point to another file, in Org-mode 1342links usually point to another file, in Org-mode they point to a
1327they point to a target in the current file. Targets are CamelCased 1343target in the current file. Targets are CamelCased words in double
1328words in double angular brackets, and may be located anywhere, also in 1344angular brackets, and may be located anywhere, also in a comment line.
1329a comment line. For example 1345For example
1330@example 1346@example
1331# <<MyTarget>> 1347# <<MyTarget>>
1332@end example 1348@end example
@@ -2020,32 +2036,16 @@ Choose date in calendar (only if nothing typed into minibuffer).
2020@chapter Agenda Views 2036@chapter Agenda Views
2021@cindex agenda views 2037@cindex agenda views
2022 2038
2023@ignore 2039Org-mode can select items based of various criteria, and display them
2024We have already described three commands to filter important 2040in a separate buffer. The information to be shown is collected from
2025information in an org file into a sparse tree (@pxref{Sparse trees}): 2041all @emph{agenda files}, the files listed in the variable
2026 2042@code{org-agenda-files}. Thus even if you only work with a single
2027@cindex sparse trees 2043Org-mode file, this file must be put into that list@footnote{When
2028@itemize @bullet 2044using the dispatcher pressing @kbd{1} before selecting a command will
2029@item 2045actually limit the command to the current file, and ignore
2030The TODO tree, (@kbd{C-c C-v}), see @ref{TODO items}. 2046@code{org-agenda-files} until the next dispatcher command.}. You can
2031@item 2047customize @code{org-agenda-files}, but the easiest way to maintain it
2032The occur tree @kbd{C-c /}, see @ref{TODO items}. 2048is through the following commands
2033@item
2034Checking upcoming deadlines with @kbd{C-c C-w}, see @ref{Creating
2035timestamps}.
2036@end itemize
2037@noindent
2038@end ignore
2039
2040Org-mode can collect and sort selected items into a separate buffer.
2041The information to be listed is collected from all @emph{agenda
2042files}, the files listed in the variable @code{org-agenda-files}.
2043Thus even if you only work with a single Org-mode file, this file must
2044be put into that list@footnote{When using the dispatcher pressing
2045@kbd{1} before selecting a command will actually limit the command to
2046the current file, and ignore @code{org-agenda-files} until the next
2047dispatcher command.}. You can customize this variable, but the easiest
2048way to maintain it is through the following commands
2049 2049
2050@cindex files, adding to agenda list 2050@cindex files, adding to agenda list
2051@table @kbd 2051@table @kbd
@@ -2084,11 +2084,21 @@ buffer}. This buffer is read-only, but provides commands to visit the
2084corresponding locations in the original Org-mode files, and even to 2084corresponding locations in the original Org-mode files, and even to
2085edit these files remotely. 2085edit these files remotely.
2086 2086
2087@cindex custom agenda commands
2088@cindex agenda commands, custom
2087The views are created through a dispatcher that should be bound to a 2089The views are created through a dispatcher that should be bound to a
2088global key, for example @kbd{C-c a} (@pxref{Installation and 2090global key, for example @kbd{C-c a} (@pxref{Installation and
2089Activation}). In the following we will assume that @kbd{C-c a} is 2091Activation}). In the following we will assume that @kbd{C-c a} is
2090indeed how the dispatcher is accessed and list keyboard access to 2092indeed how the dispatcher is accessed and list keyboard access to
2091commands accordingly. 2093commands accordingly. The dispatcher offers a number of default
2094commands, for example to create a TODO list or a the calendar-like
2095agenda. You can also define a number of custom searches for tags and
2096specific TODO keywords through the variable
2097@code{org-agenda-custom-commands}.
2098@kindex C-c a C
2099These commands will be offered by the dispatcher just like the default
2100commands. If you press @kbd{C-c a C}, you will get a customization
2101buffer for this variable.
2092 2102
2093@menu 2103@menu
2094* Agenda:: Your weekly planner 2104* Agenda:: Your weekly planner
@@ -2230,7 +2240,7 @@ a prefix argument to this command to change the selected TODO keyword,
2230for example @kbd{3 r}. 2240for example @kbd{3 r}.
2231@end table 2241@end table
2232 2242
2233Remote editing of TDOD items means that you can change the state of a 2243Remote editing of TODO items means that you can change the state of a
2234TODO entry with a single key press. The commands available in the 2244TODO entry with a single key press. The commands available in the
2235TODO list are described in @ref{Agenda commands}. 2245TODO list are described in @ref{Agenda commands}.
2236 2246
@@ -2241,15 +2251,15 @@ TODO list are described in @ref{Agenda commands}.
2241 2251
2242If headlines in the agenda files are marked with @emph{tags} 2252If headlines in the agenda files are marked with @emph{tags}
2243(@pxref{Tags}), you can select headlines based on the tags that apply 2253(@pxref{Tags}), you can select headlines based on the tags that apply
2244to them and collect them into an ageenda buffer. 2254to them and collect them into an agenda buffer.
2245 2255
2246@table @kbd 2256@table @kbd
2247@kindex C-c a m 2257@kindex C-c a m
2248@item C-c a m 2258@item C-c a m
2249Produce a list of all headlines that match a given set of tags. The 2259Produce a list of all headlines that match a given set of tags. The
2250command prompts for a selection criterion, which is a simple list of 2260command prompts for a selection criterion, which is a boolean logic
2251TAGS with positive and negative selection, like 2261expression with tags, like @samp{+WORK+URGENT-WITHBOSS} or
2252@samp{+WORK+URGENT-WITHBOSS}. 2262@samp{WORK|HOME} (@pxref{Tags}).
2253@kindex C-c a M 2263@kindex C-c a M
2254@item C-c a M 2264@item C-c a M
2255Like @kbd{C-c a m}, but only select headlines that are also TODO 2265Like @kbd{C-c a m}, but only select headlines that are also TODO
@@ -2396,6 +2406,10 @@ Digit argument.
2396Change the TODO state of the item, both in the agenda and in the 2406Change the TODO state of the item, both in the agenda and in the
2397original org file. 2407original org file.
2398 2408
2409@kindex :
2410@item :
2411Set tags for the current headline.
2412
2399@kindex , 2413@kindex ,
2400@item , 2414@item ,
2401Set the priority for the current item. Org-mode prompts for the 2415Set the priority for the current item. Org-mode prompts for the
@@ -2900,7 +2914,7 @@ After @samp{\}, complete @TeX{} symbols supported by the exporter.
2900After @samp{*}, complete CamelCase versions of all headlines in the 2914After @samp{*}, complete CamelCase versions of all headlines in the
2901buffer. 2915buffer.
2902@item 2916@item
2903After @samp{:}, complete tags used elswhere in the buffer. 2917After @samp{:}, complete tags used elsewhere in the buffer.
2904@item 2918@item
2905After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or 2919After @samp{#+}, complete the special keywords like @samp{TYP_TODO} or
2906@samp{OPTIONS} which set file-specific options for Org-mode. When the 2920@samp{OPTIONS} which set file-specific options for Org-mode. When the
@@ -2917,11 +2931,11 @@ Elsewhere, complete dictionary words using ispell.
2917@cindex options, for customization 2931@cindex options, for customization
2918@cindex variables, for customization 2932@cindex variables, for customization
2919 2933
2920There is a large number of variables which can be used to customize 2934There are more than 100 variables that can be used to customize
2921Org-mode. For the sake of compactness of the manual, we are not 2935Org-mode. For the sake of compactness of the manual, we are not
2922describing the variables here. For an overview of customization 2936describing the variables here. A structured overview of customization
2923variables, use @kbd{M-x org-customize}. Or select @code{Browse Org 2937variables is available with @kbd{M-x org-customize}. Or select
2924Group} from the @code{Org->Customization} menu. 2938@code{Browse Org Group} from the @code{Org->Customization} menu.
2925 2939
2926@node FAQ, Interaction, Customization, Miscellaneous 2940@node FAQ, Interaction, Customization, Miscellaneous
2927@section Frequently asked questions 2941@section Frequently asked questions
@@ -3167,59 +3181,63 @@ The exporters work well, but could be made more efficient.
3167 3181
3168Org-mode was written by Carsten Dominik, who still maintains it at the 3182Org-mode was written by Carsten Dominik, who still maintains it at the
3169Org-mode homepage @uref{http://www.astro.uva.nl/~dominik/Tools/org/}. 3183Org-mode homepage @uref{http://www.astro.uva.nl/~dominik/Tools/org/}.
3170The following people have helped the development along with ideas, 3184The following people (in alphabetic order) have helped the development
3171suggestions and patches. 3185along with ideas, suggestions and patches. Many thanks to all of you,
3186Org-mode would not be what it is without your input.
3172 3187
3173@itemize @bullet 3188@itemize @bullet
3174@item 3189@item
3175Matthias Rempe (Oelde) provided ideas, a patch introducing Windows 3190Pavel Chalmoviansky reported bugs and suggested improvements
3176NT/2000 support, and quality control. 3191related to the agenda treatment of items with specified time.
3177@item
3178Kevin Rogers contributed code to access VM files on remote hosts.
3179@item 3192@item
3180Juergen Vollmer contributed code generating the table of contents 3193Sacha Chua, the current maintainer of Planner, suggested to copy
3181in HTML output, and other export improvements. 3194linking code from Planner (I took code for RMAIL and Wanderlust).
3182@item 3195@item
3183Christian Egli converted the documentation into TeXInfo format and 3196Christian Egli converted the documentation into TeXInfo format and
3184patched basic CSS formatting support into the HTML exporter. He also 3197patched basic CSS formatting support into the HTML exporter. He also
3185inspired the agenda by showing me his plans for a multifile summary. 3198inspired the agenda by showing me his plans for a multifile summary.
3186@item 3199@item
3200Kai Grossjohann pointed out that a number of key bindings in Org-mode
3201conflict with other packages.
3202@item
3203Stefan Monnier provided a patch with lots of little fixes to keep the
3204Emacs-Lisp compiler happy.
3205@item
3206Tim O'Callaghan suggested in-file links, search options for
3207general file links, and TAGS.
3208@item
3209Oliver Oppitz made useful suggestions.
3210@item
3211Pete Phillips helped the development of the TAGS feature with beta
3212testing and suggestions.
3213@item
3214Matthias Rempe (Oelde) provided ideas, a patch introducing Windows
3215NT/2000 support, and quality control.
3216@item
3217Kevin Rogers contributed code to access VM files on remote hosts.
3218@item
3187Philip Rooke created the Org-mode reference card. He also helped with 3219Philip Rooke created the Org-mode reference card. He also helped with
3188beta testing and contributed a number of very useful ideas. 3220beta testing and contributed a number of very useful ideas.
3189@item 3221@item
3190Christian Schlauer proposed angular brackets around links, among other 3222Christian Schlauer proposed angular brackets around links, among other
3191things. 3223things.
3192@item 3224@item
3193David Wainberg suggested to implement an archiving mechanism and helped
3194testing.
3195@item
3196Linking to VM/BBDB/GNUS was inspired by Tom Shannon's 3225Linking to VM/BBDB/GNUS was inspired by Tom Shannon's
3197@file{organizer-mode.el}. 3226@file{organizer-mode.el}.
3198@item 3227@item
3199Scheduling TODO items was inspired by John Wiegley's @file{planner.el}. 3228Juergen Vollmer contributed code generating the table of contents
3229in HTML output, and other export improvements.
3200@item 3230@item
3201Sacha Chua, the current maintainer of Planner, suggested to copy 3231David Wainberg suggested to implement an archiving mechanism and helped
3202linking code from Planner (I took code for RMAIL and Wanderlust). 3232testing.
3203@item 3233@item
3204Oliver Oppitz made useful suggestions. 3234Scheduling TODO items was inspired by John Wiegley's @file{planner.el}.
3205@item 3235@item
3206Carsten Wimmer suggested some changes and helped fix a bug in linking 3236Carsten Wimmer suggested some changes and helped fix a bug in linking
3207to GNUS. 3237to GNUS.
3208@item
3209Pavel Chalmoviansky reported bugs and suggested improvements related
3210to the agenda treatment of items with specified time.
3211@item
3212Stefan Monnier provided a patch with lots of little fixes to keep the
3213Emacs-Lisp compiler happy.
3214@item
3215Kai Grossjohann pointed out that a number of key bindings in Org-mode
3216conflict with other packages.
3217@item 3238@item
3218Roland Winkler pointed out that additional keybindings are needed to 3239Roland Winkler pointed out that additional keybindings are needed to
3219use Org-mode on a tty. 3240use Org-mode on a tty.
3220@item
3221Tim O'Callaghan suggested in-file links, search options for
3222general file links, and TAGS.
3223@c @item 3241@c @item
3224@c Nic Ferrier and Christian Egli implemented XML export. 3242@c Nic Ferrier and Christian Egli implemented XML export.
3225@end itemize 3243@end itemize