Mercurial > emacs
comparison lisp/textmodes/org.el @ 67692:f30b7a47672e
(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.
author | Carsten Dominik <dominik@science.uva.nl> |
---|---|
date | Tue, 20 Dec 2005 08:05:16 +0000 |
parents | 58d7532b2ef1 |
children | f556787bf755 |
comparison
equal
deleted
inserted
replaced
67691:5e3db5999d74 | 67692:f30b7a47672e |
---|---|
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, 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 ;; |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | 12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
13 ;; it under the terms of the GNU General Public License as published by | 13 ;; it under the terms of the GNU General Public License as published by |
79 ;; excellent reference card made by Philip Rooke. This card can be found | 79 ;; excellent reference card made by Philip Rooke. This card can be found |
80 ;; in the etc/ directory of Emacs 22. | 80 ;; in the etc/ directory of Emacs 22. |
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. |
87 ;; - `org-agenda' has now become a dispatcher that will produce the agenda | 94 ;; - `org-agenda' has now become a dispatcher that will produce the agenda |
88 ;; and other views on org-mode data with an additional keypress. | 95 ;; and other views on org-mode data with an additional keypress. |
197 ;; - "|" no longer allowed as part of a link, to allow links in tables. | 204 ;; - "|" no longer allowed as part of a link, to allow links in tables. |
198 ;; - The prefix of items in the agenda buffer can be configured. | 205 ;; - The prefix of items in the agenda buffer can be configured. |
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 ;; |
206 ;; Version 3.06 | 213 ;; Version 3.06 |
207 ;; - M-S-RET inserts a new TODO heading. | 214 ;; - M-S-RET inserts a new TODO heading. |
264 (defvar calc-embedded-open-formula) | 271 (defvar calc-embedded-open-formula) |
265 (defvar font-lock-unfontify-region-function) | 272 (defvar font-lock-unfontify-region-function) |
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) |
273 (message "Org-mode version %s" org-version)) | 280 (message "Org-mode version %s" org-version)) |
274 | 281 |
592 Entries are added to this list with \\[org-agenda-file-to-front] and removed with | 599 Entries are added to this list with \\[org-agenda-file-to-front] and removed with |
593 \\[org-remove-file]. You can also use customize to edit the list." | 600 \\[org-remove-file]. You can also use customize to edit the list." |
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. | |
608 These commands will be offered on the splash screen displayed by the | |
609 agenda dispatcher \\[org-agenda]. Each entry is a list of 3 items: | |
610 | |
611 key The key (as a string) to be associated with the command. | |
612 type The command type, either `todo' for a todo list with a specific | |
613 todo keyword, or `tags' for a tags search. | |
614 match 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. |
599 When nil, cursor will remain in the current window." | 623 When nil, cursor will remain in the current window." |
600 :group 'org-agenda | 624 :group 'org-agenda |
601 :type 'boolean) | 625 :type 'boolean) |
979 (defgroup org-tags nil | 1003 (defgroup org-tags nil |
980 "Options concerning startup of Org-mode." | 1004 "Options concerning startup of Org-mode." |
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. |
986 If this number is positive, it specified the column. If it is negative, | 1010 If this number is positive, it specified the column. If it is negative, |
987 it means that the tags should be flushright to that column. For example, | 1011 it means that the tags should be flushright to that column. For example, |
988 -79 works well for a normal 80 character screen." | 1012 -79 works well for a normal 80 character screen." |
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. | |
1018 These operations change the length of a headline and therefore shift | |
1019 the tags around. With this options turned on, after each such operation | |
1020 the 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. |
994 When nil, only the tags directly give in a specific line apply there." | 1026 When nil, only the tags directly give in a specific line apply there. |
1027 If you turn off this option, you very likely want to turn on the | |
1028 companion option `org-tags-match-list-sublevels'." | |
995 :group 'org-tags | 1029 :group 'org-tags |
996 :type 'boolean) | 1030 :type 'boolean) |
997 | 1031 |
998 (defcustom org-tags-match-list-sublevels nil | 1032 (defcustom org-tags-match-list-sublevels nil |
999 "Non-nil means list also sublevels of headlines matching tag search. | 1033 "Non-nil means list also sublevels of headlines matching tag search. |
1000 Because of tag inheritance (see variable `org-use-tag-inheritance'), | 1034 Because of tag inheritance (see variable `org-use-tag-inheritance'), |
1001 the sublevels of a headline matching a tag search often also match | 1035 the sublevels of a headline matching a tag search often also match |
1002 the same search. Listing all of them can create very long lists. | 1036 the same search. Listing all of them can create very long lists. |
1003 Setting this variable to nil causes subtrees to be skipped." | 1037 Setting this variable to nil causes subtrees to be skipped. |
1038 This option is off by default, because inheritance in on. If you turn | |
1039 inheritance 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 |
1007 (defvar org-tags-history nil | 1043 (defvar org-tags-history nil |
1008 "History of minibuffer reads for tags.") | 1044 "History of minibuffer reads for tags.") |
2719 (org-back-to-heading t) | 2755 (org-back-to-heading t) |
2720 (let* ((level (save-match-data (funcall outline-level))) | 2756 (let* ((level (save-match-data (funcall outline-level))) |
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 |
2727 (defun org-demote () | 2765 (defun org-demote () |
2728 "Demote the current heading lower down the tree. | 2766 "Demote the current heading lower down the tree. |
2730 in the region." | 2768 in the region." |
2731 (org-back-to-heading t) | 2769 (org-back-to-heading t) |
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 |
2738 (defun org-map-tree (fun) | 2778 (defun org-map-tree (fun) |
2739 "Call FUN for every heading underneath the current one." | 2779 "Call FUN for every heading underneath the current one." |
3465 (when org-log-done | 3505 (when org-log-done |
3466 (if (equal state org-done-string) | 3506 (if (equal state org-done-string) |
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) |
3473 (not (bolp)) | 3515 (not (bolp)) |
3474 (save-excursion (beginning-of-line 1) | 3516 (save-excursion (beginning-of-line 1) |
4224 (define-key org-agenda-mode-map " " 'org-agenda-show) | 4266 (define-key org-agenda-mode-map " " 'org-agenda-show) |
4225 (define-key org-agenda-mode-map "\C-c\C-t" 'org-agenda-todo) | 4267 (define-key org-agenda-mode-map "\C-c\C-t" 'org-agenda-todo) |
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) |
4232 (define-key org-agenda-mode-map (org-key 'S-right) 'org-agenda-date-later) | 4275 (define-key org-agenda-mode-map (org-key 'S-right) 'org-agenda-date-later) |
4233 (define-key org-agenda-mode-map (org-key 'S-left) 'org-agenda-date-earlier) | 4276 (define-key org-agenda-mode-map (org-key 'S-left) 'org-agenda-date-earlier) |
4291 ["Go To (one window)" org-agenda-switch-to t] | 4334 ["Go To (one window)" org-agenda-switch-to t] |
4292 ["Follow Mode" org-agenda-follow-mode | 4335 ["Follow Mode" org-agenda-follow-mode |
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] |
4299 "--" | 4343 "--" |
4300 ["Reschedule to ..." org-agenda-date-prompt t]) | 4344 ["Reschedule to ..." org-agenda-date-prompt t]) |
4336 | 4380 |
4337 ;;;###autoload | 4381 ;;;###autoload |
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. |
4340 Prompts for a character to select a command. Any prefix arg will be passed | 4384 Prompts for a character to select a command. Any prefix arg will be passed |
4341 on to the selected command. Possible selections are: | 4385 on to the selected command. The default selections are: |
4342 | 4386 |
4343 a Call `org-agenda' to display the agenda for the current day or week. | 4387 a Call `org-agenda' to display the agenda for the current day or week. |
4344 t Call `org-todo-list' to display the global todo list. | 4388 t Call `org-todo-list' to display the global todo list. |
4345 T Call `org-todo-list' to display the global todo list, put | 4389 T Call `org-todo-list' to display the global todo list, put |
4346 select only entries with a specific TODO keyword. | 4390 select only entries with a specific TODO keyword. |
4347 m Call `org-tags-view' to display headlines with tags matching | 4391 m Call `org-tags-view' to display headlines with tags matching |
4348 a condition. The tags condition is a list of positive and negative | 4392 a condition. The tags condition is a list of positive and negative |
4349 selections, like `+WORK+URGENT-WITHBOSS'. | 4393 selections, like `+WORK+URGENT-WITHBOSS'. |
4350 M like `m', but select only TODO entries, no ordinary headlines. | 4394 M like `m', but select only TODO entries, no ordinary headlines. |
4351 | 4395 |
4396 More commands can be added by configuring the variable | |
4397 `org-agenda-custom-commands'. | |
4398 | |
4352 If the current buffer is in Org-mode and visiting a file, you can also | 4399 If the current buffer is in Org-mode and visiting a file, you can also |
4353 first press `1' to indicate that the agenda should be temporarily | 4400 first press `1' to indicate that the agenda should be temporarily |
4354 restricted to the current file." | 4401 restricted 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)) | 4415 a Agenda for current week or day |
4369 (message "")) | 4416 t List of all TODO entries T Entries with special TODO kwd |
4370 (cond | 4417 m Match a TAGS query M Like m, but only TODO entries. |
4371 ((equal c ?a) (call-interactively 'org-agenda-list)) | 4418 C 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." |
4384 (and org-fit-agenda-window | 4463 (and org-fit-agenda-window |
4385 (fboundp 'fit-window-to-buffer) | 4464 (fboundp 'fit-window-to-buffer) |
4665 (date (calendar-gregorian-from-absolute today)) | 4744 (date (calendar-gregorian-from-absolute today)) |
4666 (win (selected-window)) | 4745 (win (selected-window)) |
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 |
4674 (completing-read "Keyword: " (mapcar 'list org-todo-keywords) | 4754 (completing-read "Keyword: " (mapcar 'list org-todo-keywords) |
4675 nil t))) | 4755 nil t))) |
6003 (end-of-line 1) | 6083 (end-of-line 1) |
6004 (setq newhead (org-get-heading))) | 6084 (setq newhead (org-get-heading))) |
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") |
6011 (org-agenda-check-no-diary) | 6115 (org-agenda-check-no-diary) |
6012 (let* ((marker (or (get-text-property (point) 'org-marker) | 6116 (let* ((marker (or (get-text-property (point) 'org-marker) |
6267 (org-scan-tags 'sparse-tree (cdr (org-make-tags-matcher match))))) | 6371 (org-scan-tags 'sparse-tree (cdr (org-make-tags-matcher match))))) |
6268 | 6372 |
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) |
6290 "Show all headlines for all `org-agenda-files' matching a TAGS criterions. | 6407 "Show all headlines for all `org-agenda-files' matching a TAGS criterions. |
6291 The prefix arg TODO-ONLY limits the search to TODO entries." | 6408 The prefix arg TODO-ONLY limits the search to TODO entries." |
6366 (org-set-tags nil t)) | 6483 (org-set-tags nil t)) |
6367 (message "All tags realigned to column %d" org-tags-column)) | 6484 (message "All tags realigned to column %d" org-tags-column)) |
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)) |
6400 (cond | 6520 (cond |
6401 ((eq flag nil) | 6521 ((eq flag nil) |
11608 ["Deadline" org-deadline t] | 11728 ["Deadline" org-deadline t] |
11609 "--" | 11729 "--" |
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] |
11629 ["Insert Link" org-insert-link t] | 11743 ["Insert Link" org-insert-link t] |
11630 ["Follow Link" org-open-at-point t]) | 11744 ["Follow Link" org-open-at-point t]) |
12009 | 12123 |
12010 (run-hooks 'org-load-hook) | 12124 (run-hooks 'org-load-hook) |
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 |