Org mode does not maintain TODO lists as separate documents37. Instead, TODO items are an integral part of the notes file, because TODO items usually come up while taking notes! With Org mode, simply mark any entry in a tree as being a TODO item. In this way, information is not duplicated, and the entire context from which the TODO item emerged is always present.
说得真好, to do items usually come up while taking notes. scatter
Of course, this technique for managing TODO items scatters them throughout your notes file. Org mode compensates for this by providing methods to give you an overview of all the things that you have to do.
• TODO Basics: | Marking and displaying TODO entries. |
---|---|
• TODO Extensions: | Workflow and assignments. |
• Progress Logging: | Dates and notes for progress. |
• Priorities: | Some things are more important than others. |
• Breaking Down Tasks: | Splitting a task into manageable pieces. |
• Checkboxes: | Tick-off lists. |
5.1 Basic TODO Functionality
没啥东西, 略过.
Any headline becomes a TODO item when it starts with the word ‘TODO’, for example:
1 | *** TODO Write letter to Sam Fortune |
The most important commands to work with TODO entries are:
C-c C-t (
org-todo
)Rotate the TODO state of the current item among
,-> (unmarked) -> TODO -> DONE --. '--------------------------------'
If TODO keywords have fast access keys (see Fast access to TODO states), prompt for a TODO keyword through the fast selection interface; this is the default behavior whenorg-use-fast-todo-selection
is non-nil
.The same rotation can also be done “remotely” from the agenda buffer with the t command key (see Agenda Commands).C-u C-c C-t
When TODO keywords have no selection keys, select a specific keyword using completion; otherwise force cycling through TODO states with no prompt. When
org-use-fast-todo-selection
is set toprefix
, use the fast selection interface.S-RIGHT S-LEFT
Select the following/preceding TODO state, similar to cycling. Useful mostly if more than two TODO states are possible (see TODO Extensions). See also Conflicts, for a discussion of the interaction with
shift-selection-mode
. See also the variableorg-treat-S-cursor-todo-selection-as-state-change
.C-c / t (
org-show-todo-tree
)View TODO items in a sparse tree (see Sparse Trees). Folds the entire buffer, but shows all TODO items—with not-DONE state—and the headings hierarchy above them. With a prefix argument, or by using C-c / T, search for a specific TODO. You are prompted for the keyword, and you can also give a list of keywords like ‘KWD1|KWD2|…’ to list entries that match any one of these keywords. With a numeric prefix argument N, show the tree for the Nth keyword in the variable
org-todo-keywords
. With two prefix arguments, find all TODO states, both un-done and done.M-x org-agenda t (
org-todo-list
)Show the global TODO list. Collects the TODO items (with not-DONE states) from all agenda files (see Agenda Views) into a single buffer. The new buffer is in Org Agenda mode, which provides commands to examine and manipulate the TODO entries from the new buffer (see Agenda Commands). See Global TODO list, for more information.
S-M-RET (
org-insert-todo-heading
)Insert a new TODO entry below the current one.
Changing a TODO state can also trigger tag changes. See the docstring of the option org-todo-state-tags-triggers
for details.
5.2 Extended Use of TODO Keywords
todo list的多种状态.
By default, marked TODO entries have one of only two states: TODO and DONE. Org mode allows you to classify TODO items in more complex ways with TODO keywords (stored in org-todo-keywords
). With special setup, the TODO keyword system can work differently in different files.
Note that tags are another way to classify headlines in general and TODO items in particular (see Tags).
• Workflow states: | From TODO to DONE in steps. |
---|---|
• TODO types: | I do this, Fred does the rest. |
• Multiple sets in one file: | Mixing it all, still finding your way. |
• Fast access to TODO states: | Single letter selection of state. |
• Per-file keywords: | Different files, different requirements. |
• Faces for TODO keywords: | Highlighting states. |
• TODO dependencies: | When one task needs to wait for others. |
从2.1到2.7说来说去, 就只有一件事情:更多的关键词,采纳默认设置即可,不必要浪费时间。
总结前面这两章, 核心思想便是从note中写todo。
5.2.1 TODO keywords as workflow states
You can use TODO keywords to indicate different sequential states in the process of working on an item, for example38:1
2
3
4
5
6
7(setq org-todo-keywords
'((sequence "TODO" "FEEDBACK" "VERIFY" "|" "DONE" "DELEGATED")))
Its value is
((sequence "TODO(t)" "NEXT(n)" "|" "DONE(d!/!)")
(sequence "PROJECT(p)" "|" "DONE(d!/!)" "CANCELLED(c@/!)")
(sequence "WAITING(w@/!)" "DELEGATED(e!)" "HOLD(h)" "|" "CANCELLED(c@/!)"))
The vertical bar separates the TODO keywords (states that need action) from the DONE states (which need no further action). If you do not provide the separator bar, the last state is used as the DONE state.
With this setup, the command C-c C-t cycles an entry from ‘TODO’ to ‘FEEDBACK’, then to ‘VERIFY’, and finally to ‘DONE’ and ‘DELEGATED’. You may also use a numeric prefix argument to quickly select a specific state. For example C-3 C-c C-t changes the state immediately to ‘VERIFY’. Or you can use S-LEFT to go backward through the sequence. If you define many keywords, you can use in-buffer completion (see Completion) or even a special one-key selection scheme (see Fast access to TODO states) to insert these words into the buffer. Changing a TODO state can be logged with a timestamp, see Tracking TODO state changes, for more information.
5.2.2 TODO keywords as types
The second possibility is to use TODO keywords to indicate different types of action items. For example, you might want to indicate that items are for “work” or “home”. Or, when you work with several people on a single project, you might want to assign action items directly to persons, by using their names as TODO keywords. This would be set up like this:
1 | (setq org-todo-keywords '((type "Fred" "Sara" "Lucy" "|" "DONE"))) |
In this case, different keywords do not indicate a sequence, but rather different types. So the normal work flow would be to assign a task to a person, and later to mark it DONE. Org mode supports this style by adapting the workings of the command C-c C-t39. When used several times in succession, it still cycles through all names, in order to first select the right type for a task. But when you return to the item after some time and execute C-c C-t again, it will switch from any name directly to ‘DONE’. Use prefix arguments or completion to quickly select a specific name. You can also review the items of a specific TODO type in a sparse tree by using a numeric prefix to C-c / t. For example, to see all things Lucy has to do, you would use C-3 C-c / t. To collect Lucy’s items from all agenda files into a single buffer, you would use the numeric prefix argument as well when creating the global TODO list: C-3 M-x org-agenda t.
5.2.3 Multiple keyword sets in one file
Sometimes you may want to use different sets of TODO keywords in parallel. For example, you may want to have the basic TODO/DONE, but also a workflow for bug fixing, and a separate state indicating that an item has been canceled—so it is not DONE, but also does not require action. Your setup would then look like this:
1 | (setq org-todo-keywords |
The keywords should all be different, this helps Org mode keep track of which subsequence should be used for a given entry. In this setup, C-c C-t only operates within a sub-sequence, so it switches from ‘DONE’ to (nothing) to ‘TODO’, and from ‘FIXED’ to (nothing) to ‘REPORT’. Therefore you need a mechanism to initially select the correct sequence. In addition to typing a keyword or using completion (see Completion), you may also apply the following commands:
C-u C-u C-c C-t
C-S-RIGHT
C-S-LEFT
These keys jump from one TODO sub-sequence to the next. In the above example, C-u C-u C-c C-t or C-S-RIGHT would jump from ‘TODO’ or ‘DONE’ to ‘REPORT’, and any of the words in the second row to ‘CANCELED’. Note that the C-S- key binding conflict with
shift-selection-mode
(see Conflicts).S-RIGHT
S-LEFT
S-LEFT and S-RIGHT walk through all keywords from all sub-sequences, so for example S-RIGHT would switch from ‘DONE’ to ‘REPORT’ in the example above. For a discussion of the interaction with
shift-selection-mode
, see Conflicts.
5.2.4 Fast access to TODO states
If you would like to quickly change an entry to an arbitrary TODO state instead of cycling through the states, you can set up keys for single-letter access to the states. This is done by adding the selection character after each keyword, in parentheses40. For example:
1 | (setq org-todo-keywords |
If you then press C-c C-t followed by the selection key, the entry is switched to this state. SPC can be used to remove any TODO keyword from an entry41.
5.2.5 Setting up keywords for individual files
本节目前用不着.
It can be very useful to use different aspects of the TODO mechanism in different files. For file-local settings, you need to add special lines to the file which set the keywords and interpretation for that file only. For example, to set one of the two examples discussed above, you need one of the following lines, starting in column zero anywhere in the file:
1 | #+TODO: TODO FEEDBACK VERIFY | DONE CANCELED |
You may also write ‘#+SEQ_TODO’ to be explicit about the interpretation, but it means the same as ‘#+TODO’, or
1 | #+TYP_TODO: Fred Sara Lucy Mike | DONE |
A setup for using several sets in parallel would be:
1 | #+TODO: TODO | DONE |
To make sure you are using the correct keyword, type ‘#+’ into the buffer and then use M-TAB to complete it (see Completion).
Remember that the keywords after the vertical bar—or the last keyword if no bar is there—must always mean that the item is DONE, although you may use a different word. After changing one of these lines, use C-c C-c with point still in the line to make the changes known to Org mode42.
5.2.6 Faces for TODO keywords
Org mode highlights TODO keywords with special faces: org-todo
for keywords indicating that an item still has to be acted upon, and org-done
for keywords indicating that an item is finished. If you are using more than two different states, you might want to use special faces for some of them. This can be done using the variable org-todo-keyword-faces
. For example:
1 | (setq org-todo-keyword-faces |
While using a list with face properties as shown for ‘CANCELED’ should work, this does not always seem to be the case. If necessary, define a special face and use that. A string is interpreted as a color. The variable org-faces-easy-properties
determines if that color is interpreted as a foreground or a background color.
5.2.7 TODO dependencies
The structure of Org files—hierarchy and lists—makes it easy to define TODO dependencies. Usually, a parent TODO task should not be marked DONE until all TODO subtasks, or children tasks, are marked as DONE. Sometimes there is a logical sequence to (sub)tasks, so that one subtask cannot be acted upon before all siblings above it have been marked DONE. If you customize the variable org-enforce-todo-dependencies
, Org blocks entries from changing state to DONE while they have TODO children that are not DONE. Furthermore, if an entry has a property ‘ORDERED’, each of its TODO children is blocked until all earlier siblings are marked DONE. Here is an example:
1 | * TODO Blocked until (two) is done |
You can ensure an entry is never blocked by using the ‘NOBLOCKING’ property (see Properties and Columns):
1 | * This entry is never blocked |
C-c C-x o (
org-toggle-ordered-property
)Toggle the ‘ORDERED’ property of the current entry. A property is used for this behavior because this should be local to the current entry, not inherited from entries above like a tag (see Tags). However, if you would like to track the value of this property with a tag for better visibility, customize the variable
org-track-ordered-property-with-tag
.C-u C-u C-u C-c C-t
Change TODO state, regardless of any state blocking.
If you set the variable org-agenda-dim-blocked-tasks
, TODO entries that cannot be marked DONE because of unmarked children are shown in a dimmed font or even made invisible in agenda views (see Agenda Views).
You can also block changes of TODO states by using checkboxes (see Checkboxes). If you set the variable org-enforce-todo-checkbox-dependencies
, an entry that has unchecked checkboxes is blocked from switching to DONE.
If you need more complex dependency structures, for example dependencies between entries in different trees or files, check out the contributed module ‘org-depend.el’.
5.3 Progress Logging
不需要阅读就会应用的章节。 是todo最重要的部分。
Org mode can automatically record a timestamp and optionally a note when you mark a TODO item as DONE, or even each time you change the state of a TODO item. This system is highly configurable, settings can be on a per-keyword basis and can be localized to a file or even a subtree. For information on how to clock working time for a task, see Clocking Work Time.
• Closing items: | When was this entry marked DONE? |
---|---|
• Tracking TODO state changes: | When did the status change? |
• Tracking your habits: | How consistent have you been? |
只有一句话, 有habit这个property.
5.3.1 Closing items
The most basic logging is to keep track of when a certain TODO item was marked DONE. This can be achieved with43
1 | (setq org-log-done 'time) |
Then each time you turn an entry from a TODO (not-done) state into any of the DONE states, a line ‘CLOSED: [timestamp]’ is inserted just after the headline. If you turn the entry back into a TODO item through further state cycling, that line is removed again. If you turn the entry back to a non-TODO state (by pressing C-c C-t SPC for example), that line is also removed, unless you set org-closed-keep-when-no-todo
to non-nil
. If you want to record a note along with the timestamp, use44
1 | (setq org-log-done 'note) |
You are then be prompted for a note, and that note is stored below the entry with a ‘Closing Note’ heading.
5.3.2 Tracking TODO state changes
目前我用不着.
When TODO keywords are used as workflow states (see *Workflow states), you might want to keep track of when a state change occurred and maybe take a note about this change. You can either record just a timestamp, or a time-stamped note. These records are inserted after the headline as an itemized list, newest first45. When taking a lot of notes, you might want to get the notes out of the way into a drawer (see Drawers). Customize the variable org-log-into-drawer
to get this behavior—the recommended drawer for this is called ‘LOGBOOK’46. You can also overrule the setting of this variable for a subtree by setting a ‘LOG_INTO_DRAWER’ property.
Since it is normally too much to record a note for every state, Org mode expects configuration on a per-keyword basis for this. This is achieved by adding special markers ‘!’ (for a timestamp) or ‘@’ (for a note with timestamp) in parentheses after each keyword. For example, with the setting
1 | (setq org-todo-keywords |
to record a timestamp without a note for TODO keywords configured with ‘@’, just type C-c C-c to enter a blank note when prompted.
You not only define global TODO keywords and fast access keys, but also request that a time is recorded when the entry is set to ‘DONE’, and that a note is recorded when switching to ‘WAIT’ or ‘CANCELED’47. The setting for ‘WAIT’ is even more special: the ‘!’ after the slash means that in addition to the note taken when entering the state, a timestamp should be recorded when leaving the ‘WAIT’ state, if and only if the target state does not configure logging for entering it. So it has no effect when switching from ‘WAIT’ to ‘DONE’, because ‘DONE’ is configured to record a timestamp only. But when switching from ‘WAIT’ back to ‘TODO’, the ‘/!’ in the ‘WAIT’ setting now triggers a timestamp even though ‘TODO’ has no logging configured.
You can use the exact same syntax for setting logging preferences local to a buffer:
1 | #+TODO: TODO(t) WAIT(w@/!) | DONE(d!) CANCELED(c@) |
In order to define logging settings that are local to a subtree or a single item, define a ‘LOGGING’ property in this entry. Any non-empty ‘LOGGING’ property resets all logging settings to nil
. You may then turn on logging for this specific tree using ‘STARTUP’ keywords like ‘lognotedone’ or ‘logrepeat’, as well as adding state specific settings like ‘TODO(!)’. For example:
1 | * TODO Log each state with only a time |
5.3.3 Tracking your habits
了解到有habit这个property即可, 使用heading处理更方便.
Org has the ability to track the consistency of a special category of TODO, called “habits.” To use habits, you have to enable the habits
module by customizing the variable org-modules
.
A habit has the following properties:
- The habit is a TODO item, with a TODO keyword representing an open state.
- The property ‘STYLE’ is set to the value ‘habit’ (see Properties and Columns).
- The TODO has a scheduled date, usually with a ‘.+’ style repeat interval. A ‘++’ style may be appropriate for habits with time constraints, e.g., must be done on weekends, or a ‘+’ style for an unusual habit that can have a backlog, e.g., weekly reports.
- The TODO may also have minimum and maximum ranges specified by using the syntax ‘.+2d/3d’, which says that you want to do the task at least every three days, but at most every two days.
- State logging for the DONE state is enabled (see Tracking TODO state changes), in order for historical data to be represented in the consistency graph. If it is not enabled it is not an error, but the consistency graphs are largely meaningless.
To give you an idea of what the above rules look like in action, here’s an actual habit with some history:
1 | ** TODO Shave |
What this habit says is: I want to shave at most every 2 days—given by the ‘SCHEDULED’ date and repeat interval—and at least every 4 days. If today is the 15th, then the habit first appears in the agenda (see Agenda Views) on Oct 17, after the minimum of 2 days has elapsed, and will appear overdue on Oct 19, after four days have elapsed.
What’s really useful about habits is that they are displayed along with a consistency graph, to show how consistent you’ve been at getting that task done in the past. This graph shows every day that the task was done over the past three weeks, with colors for each day. The colors used are:
Blue
If the task was not to be done yet on that day.
Green
If the task could have been done on that day.
Yellow
If the task was going to be overdue the next day.
Red
If the task was overdue on that day.
In addition to coloring each day, the day is also marked with an asterisk if the task was actually done that day, and an exclamation mark to show where the current day falls in the graph.
There are several configuration variables that can be used to change the way habits are displayed in the agenda.
org-habit-graph-column
The buffer column at which the consistency graph should be drawn. This overwrites any text in that column, so it is a good idea to keep your habits’ titles brief and to the point.
org-habit-preceding-days
The amount of history, in days before today, to appear in consistency graphs.
org-habit-following-days
The number of days after today that appear in consistency graphs.
org-habit-show-habits-only-for-today
If non-
nil
, only show habits in today’s agenda view. The default value ist
.
Lastly, pressing K in the agenda buffer causes habits to temporarily be disabled and do not appear at all. Press K again to bring them back. They are also subject to tag filtering, if you have habits which should only be done in certain contexts, for example.
5.4 Priorities
可以用作四象限时间管理.
If you use Org mode extensively, you may end up with enough TODO items that it starts to make sense to prioritize them. Prioritizing can be done by placing a priority cookie into the headline of a TODO item, like this
1 | *** TODO [#A] Write letter to Sam Fortune |
By default, Org mode supports three priorities: ‘A’, ‘B’, and ‘C’. ‘A’ is the highest priority. An entry without a cookie is treated as equivalent if it had priority ‘B’. Priorities make a difference only for sorting in the agenda (see Weekly/daily agenda); outside the agenda, they have no inherent meaning to Org mode. The cookies are displayed with the face defined by the variable org-priority-faces
, which can be customized.
Priorities can be attached to any outline node; they do not need to be TODO items.
C-c , (
org-priority
)Set the priority of the current headline. The command prompts for a priority character ‘A’, ‘B’ or ‘C’. When you press SPC instead, the priority cookie, if one is set, is removed from the headline. The priorities can also be changed “remotely” from the agenda buffer with the , command (see Agenda Commands).
S-UP (
org-priority-up
)S-DOWN (
org-priority-down
)Increase/decrease the priority of the current headline48. Note that these keys are also used to modify timestamps (see Creating Timestamps). See also Conflicts, for a discussion of the interaction with
shift-selection-mode
.
You can change the range of allowed priorities by setting the variables org-highest-priority
, org-lowest-priority
, and org-default-priority
. For an individual buffer, you may set these values (highest, lowest, default) like this (please make sure that the highest priority is earlier in the alphabet than the lowest priority):
1 | #+PRIORITIES: A C B |
5.5 Breaking Down Tasks into Subtasks
需要记住的属性,cookie data
It is often advisable to break down large tasks into smaller, manageable subtasks. You can do this by creating an outline tree below a TODO item, with detailed subtasks on the tree49. To keep an overview of the fraction of subtasks that have already been marked DONE, insert either ‘[/]’ or ‘[%]’ anywhere in the headline. These cookies are updated each time the TODO status of a child changes, or when pressing C-c C-c on the cookie. For example:
1 | * Organize Party [33%] |
If a heading has both checkboxes and TODO children below it, the meaning of the statistics cookie become ambiguous. Set the property ‘COOKIE_DATA’ to either ‘checkbox’ or ‘todo’ to resolve this issue.
这里的含义是如果不设置则二者都会自动显示出来.
If you would like to have the statistics cookie count any TODO entries in the subtree (not just direct children), configure the variable org-hierarchical-todo-statistics
. To do this for a single subtree, include the word ‘recursive’ into the value of the ‘COOKIE_DATA’ property.
1 | #修改为recursive这一点很不错. |
If you would like a TODO entry to automatically change to DONE when all children are done, you can use the following setup:
1 | (defun org-summary-todo (n-done n-not-done) |
Another possibility is the use of checkboxes to identify (a hierarchy of) a large number of subtasks (see Checkboxes).
5.6 Checkboxes
应用分数表示, 并且随时更新.
键入checkbox即可.
Every item in a plain list50 (see Plain Lists) can be made into a checkbox by starting it with the string ‘[ ]’. This feature is similar to TODO items (see TODO Items), but is more lightweight. Checkboxes are not included into the global TODO list, so they are often great to split a task into a number of simple steps. Or you can use them in a shopping list. To toggle a checkbox, use C-c C-c, or use the mouse (thanks to Piotr Zielinski’s ‘org-mouse.el’).
Here is an example of a checkbox list.
1 | * TODO Organize party [2/4] |
Checkboxes work hierarchically, so if a checkbox item has children that are checkboxes, toggling one of the children checkboxes makes the parent checkbox reflect if none, some, or all of the children are checked.
The ‘[2/4]’ and ‘[1/3]’ in the first and second line are cookies indicating how many checkboxes present in this entry have been checked off, and the total number of checkboxes present. This can give you an idea on how many checkboxes remain, even without opening a folded entry. The cookies can be placed into a headline or into (the first line of) a plain list item. Each cookie covers checkboxes of direct children structurally below the headline/item on which the cookie appears51. You have to insert the cookie yourself by typing either ‘[/]’ or ‘[%]’. With ‘[/]’ you get an ‘n out of m’ result, as in the examples above. With ‘[%]’ you get information about the percentage of checkboxes checked (in the above example, this would be ‘[50%]’ and ‘[33%]’, respectively). In a headline, a cookie can count either checkboxes below the heading or TODO states of children, and it displays whatever was changed last. Set the property ‘COOKIE_DATA’ to either ‘checkbox’ or ‘todo’ to resolve this issue.
If the current outline node has an ‘ORDERED’ property, checkboxes must be checked off in sequence, and an error is thrown if you try to check off a box while there are unchecked boxes above it.
The following commands work with checkboxes:
C-c C-c (
org-toggle-checkbox
)Toggle checkbox status or—with prefix argument—checkbox presence at point. With a single prefix argument, add an empty checkbox or remove the current one52. With a double prefix argument, set it to ‘[-]’, which is considered to be an intermediate state.
C-c C-x C-b (
org-toggle-checkbox
) 快捷键的含义是checkboxToggle checkbox status or—with prefix argument—checkbox presence at point. With double prefix argument, set it to ‘[-]’, which is considered to be an intermediate state.If there is an active region, toggle the first checkbox in the region and set all remaining boxes to the same status as the first. With a prefix argument, add or remove the checkbox for all items in the region.If point is in a headline, toggle checkboxes in the region between this headline and the next—so not the entire subtree.If there is no active region, just toggle the checkbox at point.
M-S-RET (
org-insert-todo-heading
)Insert a new item with a checkbox. This works only if point is already in a plain list item (see Plain Lists).
C-c C-x o (
org-toggle-ordered-property
)Toggle the ‘ORDERED’ property of the entry, to toggle if checkboxes must be checked off in sequence. A property is used for this behavior because this should be local to the current entry, not inherited like a tag. However, if you would like to track the value of this property with a tag for better visibility, customize
org-track-ordered-property-with-tag
.C-c # (
org-update-statistics-cookies
)Update the statistics cookie in the current outline entry. When called with a C-u prefix, update the entire file. Checkbox statistic cookies are updated automatically if you toggle checkboxes with C-c C-c and make new ones with M-S-RET. TODO statistics cookies update when changing TODO states. If you delete boxes/entries or add/change them by hand, use this command to get things back into sync.
总结
两个要点: 一是breakdown 二是priority,
Logging的部分放在clock那里
特殊的的property是cookie-data, 用的时候再来查询.
其余内容无需关注.