Spelling fixes.
[bpt/emacs.git] / doc / misc / todo-mode.texi
CommitLineData
016d3f7d
SB
1\input texinfo.tex @c -*-texinfo-*-
2@c %**start of header
3@setfilename ../../info/todo-mode
4@settitle Todo Mode User Manual
5@syncodeindex fn cp
6@syncodeindex vr cp
7@syncodeindex ky cp
8@c %**end of header
9
10@copying
11Copyright @copyright{} 2013 Free Software Foundation, Inc.
12
13@quotation
14Permission is granted to copy, distribute and/or modify this document
15under the terms of the GNU Free Documentation License, Version 1.3 or
16any later version published by the Free Software Foundation; with no
17Invariant Sections, with the Front-Cover texts being ``A GNU Manual'',
18and with the Back-Cover Texts as in (a) below. A copy of the license
19is included in the section entitled ``GNU Free Documentation License''.
20
21(a) The FSF's Back-Cover Text is: ``You have the freedom to copy and
22modify this GNU manual.''
23@end quotation
24@end copying
25
2a024334 26@dircategory Emacs misc features
016d3f7d
SB
27@direntry
28* Todo Mode: (todo-mode). Make and maintain todo lists.
29@end direntry
30
31@titlepage
32@title Todo Mode User Manual
33@subtitle Facilities for making and maintaining todo lists.
34
35@author Stephen Berman
36@page
37
38@vskip 0pt plus 1filll
39@insertcopying
40@end titlepage
41
42@contents
43
44@ifnottex
45
46@node Top
47@top Todo Mode User Manual
48
49This manual describes the version of Todo mode first appearing in
50Emacs 24.4.
51
52@insertcopying
53@end ifnottex
54
55@menu
56* Overview::
57* Todo Mode Entry Points::
58* Key Binding Conventions::
59* Navigation:: Moving within and between categories.
60* Editing:: Adding, deleting and changing todo
61 files, categories and items.
62* Todo Archives:: Files of done todo items.
63* Marked Items:: Acting on multiple items simultaneously.
64* Todo Categories Mode:: Table of categories and item counts.
65* Searching for Items::
66* Todo Filtered Items Mode:: Making virtual categories of items from
67 different categories and files.
68* Todo Display Features::
69* Printing Todo Buffers::
70* Legacy Todo Mode Files:: Converting old-style todo files.
71
72* GNU Free Documentation License::
73
74@detailmenu
75--- The Detailed Node Listing ---
76
77Overview
78
79* Levels of Organization::
80* Todo Items as Diary Entries::
81
82Editing
83
84* File Editing::
85* Category Editing::
86* Item Editing::
87
88Item Editing
89
90* Inserting New Items::
91* Editing Item Headers and Text::
92* Relocating and Removing Items::
93
94Relocating and Removing Items
95
96* Reprioritizing Items::
97* Moving and Deleting Items::
98* Done Items::
99
100Todo Archives
101
102* Creating and Visiting Archives::
103* Todo Archive Mode::
104
105Todo Categories Mode
106
107* Table of Item Counts::
108* Reordering Categories::
109
110Todo Filtered Items Mode
111
112* Filtering Items::
113* Todo Filtered Items Mode Commands::
114* Files of Filtered Items::
115
116Todo Display Features
117
118* Faces::
119* Item Prefix::
120* Other Display Commands and Options::
121@end detailmenu
122@end menu
123
124@node Overview, Todo Mode Entry Points, Top, Top
125@chapter Overview
126
127The Todo mode package provides facilities for making and maintaining
128todo lists. A todo list is a list of todo items---things to do (in the
129widest sense)---arranged in order of priority, with the highest priority
130item at the top of the list and the lowest priority item at the bottom.
131
132This manual describes the Todo mode user interface. Todo mode comprises
133a large number of commands and user options for creating, displaying,
134navigating and editing todo lists, distributed across five major modes.
135The principle major mode is Todo mode; the other four (Todo Edit mode,
136Todo Archive mode, Todo Categories mode, and Todo Filtered Items mode)
137are subsidiary to and accessible from Todo mode.
138
139This version of Todo mode greatly expands on, and in significant ways
140differs from, the original version; for details and consequences of the
2a024334 141most important differences, @ref{Legacy Todo Mode Files}.
016d3f7d
SB
142
143@menu
144* Levels of Organization::
145* Todo Items as Diary Entries::
146@end menu
147
148@node Levels of Organization, Todo Items as Diary Entries, , Overview
149@section Levels of Organization
150
151In Todo mode each todo list is identified with a named category, so you
152can group together thematically related todo items. Each category is
153stored in a file, which thus provides a further level of organization.
154You can create as many todo files, and in each as many categories, as
155you want.
156
157All todo files reside in a single directory, whose location is specified
158by the user option @code{todo-directory}. This directory may also
159contain other types of Todo files, which are discussed later
160(@pxref{Todo Archive Mode} and @ref{Todo Filtered Items Mode}). Emacs
161recognizes Todo files by their extension, so when you visit the files
162the buffer is in the appropriate mode and the current category is
163correctly displayed.
164
165When you use a Todo mode command to create a todo file, the extension
166@samp{.todo} is automatically added to the base name you choose (as a
167rule, this name is also used for the other types of Todo files, which
168have their own extensions). As a user, you only have to deal with the
169base name of a Todo file.
170
171When you create a new todo file, you must also add at least one category
172to it, and each todo item belongs to a category. It is not possible to
173have an uncategorized todo list, but you can always make a catch-all
174category with a generic name like ``Todo'', which is in fact the default
175name assigned to the first category when you create a new todo file, if
176you don't provide a different name; you can change the default by
177customizing @code{todo-initial-category}.
178
179The most basic level of organization is the todo item itself, since it
180contains the information about what you want to do. As detailed in
181subsequent sections of this manual, most Todo mode commands and user
182options concern ways of classifying and deploying this information by
183associating various kinds of metadata with it, e.g., the category it
184belongs to, its priority, whether it is to be included in the Emacs
185diary, date and time stamps, whether it is done or still to do.
186
187@node Todo Items as Diary Entries, , Levels of Organization, Overview
188@section Todo Items as Diary Entries
189
190Each todo item is also a potential diary item: if you include a todo
191file in the Emacs diary file (@pxref{Fancy Diary Display,,, emacs}), the
192Fancy Diary display will show those todo items that are not marked with
193@code{todo-nondiary-marker}. This effectively augments the Emacs diary
194with categorized diary entries. For the various options available for
2a024334
EZ
195making a todo item a diary entry, see @ref{Inserting New Items} and
196@ref{Editing Item Headers and Text}.
016d3f7d
SB
197
198To ensure the proper display of todo items in the Fancy Diary display,
199they must have the format of diary entries, i.e., they have to begin
200with a date string recognized by the Emacs diary,@footnote{Two types of
201dates recognized by the Emacs diary are not supported in the current
202Todo mode implementation: sexp diary entries and date strings in which
203the year is omitted (however, the latter type is equivalent to using
204@samp{*} for an arbitrary year, which Todo mode does support).} and if
205they are longer than one line, all lines but the first must begin with
206white space. Todo mode ensures that these requirements are satisfied
207(@pxref{Other Display Commands and Options}).
208
209The Fancy Diary display is also Todo mode aware: if it contains an item
210from a Todo mode file, clicking or typing @key{RET} on this item will
211switch to the buffer visiting that file and properly display the item's
212category, with point on the item.
213
214@node Todo Mode Entry Points, Key Binding Conventions, Overview, Top
215@chapter Todo Mode Entry Points
216
217To initialize your first todo file, invoke the command @code{todo-show}.
218This prompts you for a file name (defaulting to the value of
219@code{todo-initial-file}), prompts you for the name of the first
220category (defaulting to the value of @code{todo-initial-category}),
221creates and visits the file and displays the category in Todo mode, and
222then prompts you to enter the first item. If you choose not to enter an
223item now, simply type @kbd{C-g}, which leaves the category empty but
224otherwise well-formed. If you prefer not to be prompted to enter an
225item on adding a new category, disable the option
226@code{todo-add-item-if-new-category}.
227
228Once at least one todo file exists, invoking @code{todo-show} enters
229Todo mode. Invoked with a prefix argument, the command prompts for
230which todo file to visit. Otherwise, the first invocation of this
231command after loading the Todo mode package visits the default todo file
232(option @code{todo-default-todo-file}) and shows its first category.
233(You can get a different display with the first invocation of
234@code{todo-show} by customizing the option @code{todo-show-first};
235@pxref{Todo Categories Mode} and @ref{Files of Filtered Items}.)
236
237If you leave Todo mode and later invoke @code{todo-show} to re-enter it,
238by default this returns you to the current (i.e., last displayed)
239category of the current todo file, which is the one in the most recently
240selected and still live buffer visiting a todo file. If you disable the
241option @code{todo-show-current-file}, then non-initial invocations of
242@code{todo-show} always return to the first or current category of the
243default todo file.
244
245If you want to enter Todo mode and go directly to a specific category
246instead the first or current category in the current or default todo
2a024334 247file, use the command @code{todo-jump-to-category}; @ref{Navigation}, for
016d3f7d 248details. You can also enter Todo mode by invoking a todo item insertion
2a024334 249command; @ref{Inserting New Items}, for details.
016d3f7d
SB
250
251The most convenient way to use these commands to enter Todo mode is to
252define global key bindings for them in your init file. Good choices are
253for @code{todo-show} and @code{todo-jump-to-category} are @kbd{C-c t}
254and @kbd{C-c j}, since these commands are bound to @kbd{t} and @kbd{j},
255respectively, in Todo mode. For invoking item insertion from outside of
256Todo mode, it is useful to bind @code{todo-insertion-map}, which is the
257key map containing the bindings of all Todo item insertion commands, to
258@kbd{C-c i}, since it is bound to @kbd{i} in Todo mode; to complete the
259invocation, supply the rest of the key sequence (@pxref{Inserting New
260Items}).
261
262You can also visit a Todo file via @code{find-file} or Dired, like any
263other file, and since Emacs recognizes it, the buffer will automatically
264be in the appropriate Todo mode. Moreover, as long as the command you
265use to visit the file is listed in the option
266@code{todo-visit-files-commands} (which by default contains
267@code{find-file} and @code{dired-find-file}), it will also correctly
268display the file's first category on first visiting the file (otherwise
269you have to use one of the commands for navigating between categories in
270order to get a proper display).
271
272You can leave Todo mode by typing @kbd{q} (@code{todo-quit}), which
273buries the current todo file buffer. Doing this also saves any changes
274you have made to the file, and leaves both the file and the category
275that was displayed on quitting current for subsequent Todo mode commands
276(unless the buffer made current by quitting is visiting another file and
277category in Todo mode, in which case the latter become current for Todo
278mode commands).
279
280@node Key Binding Conventions, Navigation, Todo Mode Entry Points, Top
281@chapter Key Binding Conventions
282
283For Todo mode commands to function properly, it is essential to maintain
284the correct format at all three levels of organization---item, category,
285and file. Todo mode tries to minimize the risk of format corruption by
286hiding certain parts of the format from the user, making the buffer
287read-only and suppressing the self-insertion keys. Consequently, it is
288normally impossible to make changes to your todo files without
289explicitly invoking Todo mode commands.
290
291A beneficial side effect of this restrictiveness is that you can invoke
292almost all Todo commands by typing ordinary printing characters, either
293singly or in specified sequences, without using modifier keys, except
294for the shift key for capitalization and the raw prefix argument
295@kbd{C-u}; numeric prefix arguments can be entered just by typing a
296number key.
297
298The predefined key bindings in Todo are more or less mnemonic. As a
299rule, key sequences beginning with @kbd{C} are bound to commands
300applying to categories, sequences beginning with @kbd{F} apply to
301(non-archive) file-level commands, and those beginning with @kbd{A}
302apply to archives (a special type of Todo file; @ref{Todo Archive
303Mode}). Todo commands applying to items, which constitute the majority,
304are bound to lower case key sequences.
305
306@node Navigation, Editing, Key Binding Conventions, Top
307@chapter Navigation
308
309The navigation commands are for making another todo file, category, or
310item the current one by moving point to it.@footnote{Many editing
311commands can also do this by side effect, but since that is not their
312main function, they are not included in this section.} Since these
313commands are likely to be used frequently and repetitively, it is
314convenient for their key bindings to be single lower case keys, even for
315navigation commands applying to categories and files.
316
317Two of the navigation commands were already mentioned in the section on
318Todo mode entry points:
319
320@table @kbd
321
322@item t
323Display another todo file in the selected window (@code{todo-show}).
324When you invoke this command in Todo mode, it prompts for a file name,
325which you can choose via minibuffer completion (like invoking
326@code{todo-show} with a prefix argument outside of Todo mode). If a
327buffer is already visiting that file, it displays its current category;
328if invoking @kbd{t} opens the file, it display its first category (by
329default; see the option @code{todo-show-first} for other possibilities).
330
331@item j
332Display another todo category in the selected window
333(@code{todo-jump-to-category}). When you invoke this command, it
334prompts for a category name, which you can choose via minibuffer
335completion. The candidates for completion include the categories in the
336current todo file as well as those in the files listed in the option
337@code{todo-category-completions-files}. If you type @key{RET} without
338choosing a category, the current category of the current todo file is
339automatically selected (this can be a useful shortcut when you invoke
340@code{todo-jump-to-category} outside of Todo mode). If you type the
341name of a non-existing category, you can add this to the file as a new
342category and jump to it. If you invoke this command with a prefix
343argument, it first you prompts for which todo file to jump to (which you
344can also choose with minibuffer completion) and then for which category
345from that file; in this case, completion is only against the categories
346in the selected file.
347@end table
348
349It is also convenient to navigate back and forth sequentially between
350the categories of a single todo file. The categories of a todo file are
351numbered consecutively starting with @samp{1}.@footnote{A category's
352number is automatically assigned when the category is created: the
353category is appended to the end of the file, so its number is simply the
354highest until another category is added. There is no command in Todo
355mode to reorder the numbering of the categories in a todo file, but this
356is possible from the file's table of categories; @ref{Todo Categories
357Mode}.} The current category's number and name appear in the mode line.
358
359@table @kbd
360
361@item f
362Move point to the first item of the category numerically directly
363following the current category (@code{todo-forward-category}).
364
365@item b
366Move point to the first item of the category numerically directly
367preceding the current category (@code{todo-backward-category}).
368@end table
369
370With @kbd{f} and @kbd{b} you can cycle through the categories, so for example,
371if the last category is current and you type @kbd{f}, then the first
372category becomes current.
373
374You can also navigate between the items in the current category:
375
376@table @kbd
377
378@item n
379Move point down to the next item below the current one (i.e., to the
380item with the next lower priority) (@code{todo-next-item}).
381
382@item p
383Move point up to the item directly above the current one (i.e., to the
384item with the next higher priority) (@code{todo-previous-item}).
385@end table
386
387These commands also accept a positive numeric prefix argument; e.g.,
388typing @kbd{5 n} or @kbd{5 p} navigates in one step to the item five items lower
389or higher than the current one.
390
391Navigation to other types of Todo files is discussed in the relevant
392sections below.
393
394@node Editing, Todo Archives, Navigation, Top
395@chapter Editing
396
397Editing in Todo mode means making structural or textual changes at one
398of the levels of organization (file, category, or item). Structural
399editing includes adding, relocating and removing, textual editing includes
400renaming files or categories and changing an item's content or date, or
401adding certain kinds of marks or tags to items. To save changes you
402make to the current todo file, type @kbd{s} (@code{todo-save}). Changes
403are also saved on quitting Todo mode with @kbd{q}.
404
405@menu
406* File Editing::
407* Category Editing::
408* Item Editing::
409@end menu
410
411@node File Editing, Category Editing, , Editing
412@section File Editing and Todo Edit Mode
413
414There are four file-level editing commands:
415
416@table @kbd
417
418@item F a
419Add a new todo file (@code{todo-add-file}). This command prompts for a
420name and creates the file in @code{todo-directory}, adding the
421@samp{.todo} extension (so you should not include the extension in the
422name you enter). The command also prompts for the file's first category and, if
423option @code{todo-add-item-if-new-category} is enabled (the default),
2a024334 424for that category's first item.
016d3f7d
SB
425
426@item F r
427Rename the current todo file (@code{todo-rename-file}). If called with
428a prefix argument, prompt for a todo file and rename it. If the todo
429file has an archive (@pxref{Todo Archive Mode}) or there are
430corresponding filtered items files (@pxref{Todo Filtered Items Mode}),
431this command renames these accordingly. If there are live buffers
432visiting any of these files, the command also rename them accordingly.
433
434@item F k
435Delete the current todo file (@code{todo-delete-file}).@footnote{The key
526e5233 436binding of this command is mnemonic for ``kill'' to parallel the binding
016d3f7d
SB
437@kbd{k} for item deletion, since @kbd{d} is bound to another item
438editing command (@pxref{Done Items}).} If the todo file has an archive
439(@pxref{Todo Archive Mode}), prompt whether to delete that as well.
440This command also kill the buffers visiting the deleted files.
441
442@item F e
443This command (@code{todo-edit-file}) changes the buffer's major mode to
444Todo Edit mode. In this mode the entire file is visible, the buffer is
445writeable and you can use the self-insertion keys and standard Emacs
446editing commands to make changes. To return to Todo mode, type @kbd{C-x
447C-q} (@code{todo-edit-quit}).
448
449The command @kbd{F e} is not intended for normal editing of items and
450categories, as it circumvents the restrictions that Todo imposes to
451protect against file format corruption (i.e., all categories, not just
452the current one, and all internal formatting are exposed and editable).
453It is provided primarily as a convenience for two types of use cases
454that are likely to arise infrequently. One is to be able to use
455standard Emacs commands like @code{query-replace} to replace a piece of
456text that occurs in different categories throughout the file. The other
457use case is to recover from a mistake, such as accidentally deleting an
458item, since this cannot be undone in Todo mode.
459
460Using @kbd{C-x C-q} to quit Todo Edit mode provides a measure of safety,
461since it runs a file format check, signaling an error if the format has
462become invalid. However, this check cannot tell if the number of items
463changed, which could result in the file containing inconsistent
2a024334 464information (see the cautionary note in @ref{Reordering Categories}, for
016d3f7d
SB
465more details). For this reason @kbd{F e} should be used with caution.
466@end table
467
468@node Category Editing, Item Editing, File Editing, Editing
469@section Category Editing
470
471The following commands are available for editing at the category level
472(for additional category-editing commands, which are extensions of item
473commands, @pxref{Editing Item Headers and Text}):
474
475@table @kbd
476
477@item C a
478Add a new category to the current todo file and make that category
479current (@code{todo-add-category}). If called with a prefix argument,
480prompt for a file name and add the new category to that file. This
481command is similar to using @kbd{j}, but it only accepts category names
482that are not the name of an existing category in the file.
483
484@item C r
485Rename the current category (@code{todo-rename-category}). If this
486category's file has an archive (@pxref{Todo Archive Mode}) with a
487corresponding category, rename the category there as well.
488
489@item C m
490Move the current category (with all its items) to another todo file
491(@code{todo-move-category}). If this category's file has an archive
492(@pxref{Todo Archive Mode}) with a corresponding category, this command
493also moves that category to the archive file corresponding to the moved
494to todo file; if there is no such archive file, the command creates it
495and adds the category.
496
497@item C k
498Delete the current category (@code{todo-delete-category}).@footnote{This
526e5233 499binding is mnemonic for ``kill'' to parallel the binding @kbd{k} for
016d3f7d
SB
500item deletion, since @kbd{d} is bound to another item editing command
501(@pxref{Done Items}).} To delete a category that contains items, you
502have to confirm your intent; if the category is empty, deletion is
503immediate.
504
505@item C g
506Merge the items of one category into another category, delete the first
507category and make the second category current
508(@code{todo-merge-category}). If both the first and second categories
509also have archived items (@pxref{Todo Archive Mode}), merge the former
510to the latter. If only the first category has archived items, rename
511the archive category to the merged to category. Minibuffer completion
512of the name of the category merged to works as with the navigation
513command @kbd{j}, and as with that command, passing a prefix argument,
514i.e., typing @kbd{C-u C g}, prompts for a file and confines merging to a
515category in that file.
516@end table
517
518@node Item Editing, , Category Editing, Editing
519@section Item Editing
520
521Todo mode provides a wide variety of commands for adding and textually
522changing items, as well as for deleting and relocating items.
523
524@menu
525* Inserting New Items::
526* Editing Item Headers and Text::
527* Relocating and Removing Items::
528@end menu
529
530@node Inserting New Items, Editing Item Headers and Text, , Item Editing
531@subsection Inserting New Items
532
533There are many commands for adding new todo items. The command names
534contain the word ``insert'' instead of ``add'' and their key bindings are
535sequences beginning with @kbd{i}. The motivation for this terminology is
536that speaking of adding an item to a category suggests appending it to
537the top or bottom, whereas you can insert an item into the category
538anywhere, giving each new item any priority in the list.
539
540@table @kbd
541
542@item i i
543This is the basic command for inserting new items into a category
544(@code{todo-insert-item}). Called without a prefix argument, it prompts
545for the text of the item and its priority (a number between 1 and one
546more than the number of items already in the category), both of which
547you enter in the minibuffer, and inserts the item into the current
548category of the current todo file at the position in the list
549corresponding to the priority you chose. Called with one prefix
550argument, it also prompts for a category, and called with two prefix
551arguments, it prompts for both a file and a category from that file, and
552inserts the item accordingly. Category name completion works as with
553the navigation command @kbd{j}.
554@end table
555
556Each invocation of @kbd{i i} adds a header string to the item, which
557includes at least the current date in the same format used by
558@code{diary-insert-entry} (@pxref{Date Formats,,, emacs}). You can
559control what other information is included in the header by customizing
560the following options:
561
562@itemize @bullet
563
564@item
565@code{todo-always-add-time-string} is for including or omitting the
566current time. The time string is omitted by default.
567
568@item
569@code{todo-include-in-diary} is for specifying whether the item appears
570in the Fancy Diary display by adding or omitting
571@code{todo-nondiary-marker}. By default, new todo items are marked for
572exclusion from the diary.
573
574@item
575@code{todo-diary-nonmarking} is for adding or omitting
576@code{diary-nonmarking-symbol} to items displayed in the diary, to
577control whether they are marked in the calendar (@pxref{Format of Diary
578File,,, emacs}). By default, todo items that are diary entries are
579marked in the calendar.
580@end itemize
581
582Instead of always adding the same header information to a new item, you
583can use more specific insertion commands that let you decide what to
584include in the item header each time you insert a new item. And instead
585of always being prompted to choose the new item's priority, you can
586invoke a command to insert it at the position (hence with the priority)
587of the item at point. Finally, instead of always typing the text of the
588new item in the minibuffer, you can invoke a command that makes the
589selected region in an Emacs buffer automatically become the new item's
590text. The following paragraphs discuss how to invoke these commands by
591typing certain key sequences.
592
593There are eight parameters of item insertion in Todo mode, six
594concerning the item header, and one each concerning its priority and its
595text. Each unique combination of these parameters produces a different
596insertion command. The command @kbd{i i} realizes one of these
597combinations. For the commands that realize the remaining combinations
526e5233 598it is convenient to associate each parameter with a mnemonically chosen
016d3f7d
SB
599key. Then by typing certain sequences of these keys, you complete the
600insertion command invocation that realizes the specified combination.
601As with @kbd{i i}, the effect of many of these commands also depends on
602the values of the item insertion options mentioned above (see the
603examples below).
604
605Here is a list of the parameters and their associated keys, in the order
606in which you must type them when building a key sequence (this order
607roughly reflects the order in which the corresponding parts of the item
608occur in a category listing):
609
610@enumerate
611
612@item
526e5233 613@kbd{y} for diary (non)inclusion;
016d3f7d
SB
614@item
615@kbd{k} for adding or omitting `diary-nonmarking-symbol';
616@item
617@kbd{c} for adding the date header by clicking a date in the Emacs
618calendar, or@*
619@kbd{d} for interactively entering the date header as a string of year,
620month and day number components in the minibuffer, or@*
621@kbd{n} for interactively entering the date header as a weekday name in
622the minibuffer;
623@item
624@kbd{t} for adding a time string to the header in the minibuffer
625(including the empty string, which amounts to omitting the time);
626@item
627@kbd{h} for inserting the new item in the position of the item at point
628(``here''), or@*
629@kbd{r} to use the text of the selected region as the item's text.
630@end enumerate
631
632Each insertion command key sequence begins (disregarding prefix
633arguments) with @kbd{i}, followed by one or more of these eight keys, in
634the order listed. But as you can see in the above table, since some of
635the insertion parameters are mutually exclusive, they occupy only five
636positions, so the complete (unprefixed) sequences are maximally six keys
637long. Shorter sequences are also possible, since a parameter may be
638omitted. But since the order in any key sequence is fixed, if the last
639key in the sequence could be followed by another insertion key, i.e., if
640the last key is not @kbd{h} or @kbd{r}, it has to be doubled to complete
641the sequence, otherwise it would be interpreted as a prefix sequence
642(this is why the binding for the basic item insertion command is @kbd{i
643i} and not @kbd{i}).
644
645Here are some examples of item insertion command key sequences:
646
647@itemize @bullet
648
649@item
650@kbd{i h} inserts a new item at the position of the item at point (pushing
651the latter down) with a header containing the current date and,
652depending on the values of the mentioned options, possibly the current
653time and diary-related markings.
654@item
655@kbd{i y h} does the same as the preceding command, except that
656@code{todo-nondiary-marker} is added if @code{todo-include-in-diary} is
657non-nil and omitted if that option is nil; that is, the diary key @kbd{y}
658overrides the setting of this option.
659@item
660@kbd{i y t h} does the same as the preceding command, except that it
661prompts for a time string instead of automatically inserting the
662current time; however, typing @key{RET} at the prompt returns the
663current time if @code{todo-always-add-time-string} is non-nil, otherwise
664the empty string (i.e., no time string).
665@item
666@kbd{i y t t} does the same as the preceding command, except that it
667prompts for the item's priority and inserts it accordingly.
668@end itemize
669
670Note that the commands whose key sequences include @kbd{y}, @kbd{k} or @kbd{t}
671reverse the effect of the options @code{todo-include-in-diary},
672@code{todo-diary-nonmarking} and @code{todo-always-add-time-string},
673respectively, thus temporarily overriding their values.
674
675The names of the item insertion commands correspond to their key
676bindings, e.g., @kbd{i h} is bound to @code{todo-insert-item-here}, @kbd{i y h} to
677@code{todo-insert-item-diary-here}, etc. But since there are so many
678combinations, instead of trying to memorize either the names or the key
679sequences, you can, as usual, just type an initial part of a key
680sequence (minimally @kbd{i}), followed by @kbd{C-h} to see the valid
681completions.
682
683An alternative to using the key @kbd{c} for choosing the item's date
684from the calendar is also available: if point is on a date in the
685calendar, typing @kbd{i t} (@code{todo-insert-item-from-calendar}) will
686prompt for a new item and its priority and insert it in the current
687category. Like @kbd{i i} and the other item insertion commands, this
688also accepts one or two prefix arguments for choosing the category via
689minibuffer completion. Note, however, that the key sequence @kbd{i t}
690is not defined in Todo mode but in the Calendar mode keymap. It is a
691convenient shortcut if you happen to be using the calendar when you
692decide to make a new todo item. (Contrast this with a command like
693@kbd{i c c}, which pops open the calendar after you have entered the
694item's text, and then you can choose a date from the calendar.)
695
696There is one more item insertion command, which does not derive from the
697item insertion parameters:
698
699@table @kbd
700
701@item i p
702This command (@code{todo-copy-item}) makes a complete copy of the item
703at point, including its header, prompts for its priority in the current
704category and inserts it accordingly.
705@end table
706
707@noindent
708This command is useful for quickly adding a todo item whose text or
709header you want to differ only partly from that of an existing item:
710after inserting the copy, you can quickly edit it as needed by using
711commands described in the next section.
712
713@node Editing Item Headers and Text, Relocating and Removing Items, Inserting New Items, Item Editing
714@subsection Editing Item Headers and Text
715
716There are a number of commands for editing an existing item's text or
717header; these commands are bound to key sequences with @kbd{e}.
718
719There are two commands for editing an item's text (and manually editing
720its header), one appropriate for short items and simple edits and one
721better suited for more complex changes or for editing lengthy items:
722
723@table @kbd
724
725@item e e
726Edit the text of the current item in the minibuffer
727(@code{todo-edit-item}). If called with a prefix argument (@kbd{C-u e
728e}), the item's header is also included in the minibuffer and so can be
729edited manually.
730
731@item e m
732Edit the text of the current item in a special buffer in Todo Edit mode
733(@code{todo-edit-multiline-item}). When you have finished editing, type
734@kbd{C-x C-q} to return to Todo mode; this runs a format check to ensure
735the item is well-formed.@footnote{Unlike the command @kbd{F e}
736(@pxref{File Editing}), @kbd{e m} does not expose you to the risk of
737putting the file in an inconsistent state, since it puts only the
738current item in Todo Edit mode.}
739@end table
740
741A number of commands are available for interactively editing all or part
742of the item header, permitting quick edits and helping avoid formatting
743errors.
744
745The following three commands are for editing any or all of the year,
746month and day components of a date header:
747
748@table @kbd
749
750@item e d t
751Successively prompt for changes to the date's year, month and
752day number, and if the option @code{todo-always-add-time-string} is
753non-nil, also for editing the time string (see also @kbd{e t} below).
754
755@item e d a
756Change the date to today's date.
757
758@item e d c
759This command pops up the Emacs calendar, and after you type @key{RET} on
760a date in the calendar makes that date the item's date.
761@end table
762
763@noindent
764You can also use these commands on items whose date header consists of a
765weekday name, which then changes to a header with year, month and day
766components.
767
768Each of the following three commands, in contrast to the preceding
769three, changes only a single date component and has no effect on a date
770header consisting of a weekday name:
771
772@table @kbd
773@item e d y
774@itemx e d m
775@itemx e d d
776Prompt for changing just the year, month or day number, respectively; if
777invoked with a positive or negative numeric prefix argument, directly
778increment or decrement the date component accordingly and automatically
779adjust the other date component if necessary. For example, if the date
780string is ``January 1, 2013'', typing @kbd{- 3 e d d} results in
781``December 29, 2012''.
782@end table
783
784@table @kbd
785@item e d n
786Prompt for a weekday name and make it the item's date header. Note that
787this replaces an existing date string, it does not add the day name to
788the date string.
789
790@item e t
791Edit just the item's time string. A time string can be added both to a
792date string and to a weekday name. If you type @key{RET} at the
793prompt, this omits a time string from the header, or deletes an existing
794time string.
795
796@item e y y
797Change the item's diary inclusion status by adding or removing
798@code{todo-nondiary-marker}.
799
800@item e y k
801Change the item's diary marking status by adding or removing
802@code{diary-nonmarking-symbol} (this command has an effect only if the
803item is not marked for exclusion from the diary).
804@end table
805
806@noindent
807Parallel to the latter two item-level commands are the
808following category-level commands:
809
810@table @kbd
811
812@item C e y
813@itemx C e k
814Add @code{todo-nondiary-marker} and @code{diary-nonmarking-symbol},
815respectively, to all todo items in the current category; if invoked with
816a prefix argument, these markings are removed from all items in the
817category.
818@end table
819
820@node Relocating and Removing Items, , Editing Item Headers and Text, Item Editing
821@subsection Relocating and Removing Items
822
823In addition to inserting a new todo item and changing the text or header
824of an existing item, you can also move an item to another category
825(i.e., recategorize it), change its priority within its category, delete
826it from the category and file, or mark it as a ``done'' item, which
827removes it from the todo list but does not delete it.
828
829@menu
830* Reprioritizing Items::
831* Moving and Deleting Items::
832* Done Items::
833@end menu
834
835@node Reprioritizing Items, Moving and Deleting Items, , Relocating and Removing Items
836@subsubsection Reprioritizing Items
837
838There are three ways to change a todo item's priority:
839
840@table @kbd
841
842@item r
843Raise the current item's priority by one, exchanging its position in the list
844with that of the item directly above it (@code{todo-raise-item-priority}).
845
846@item l
847Lower the current item's priority by one, exchanging its position in the list
848with that of the item directly below it (@code{todo-lower-item-priority}).
849
850@item #
851Prompt for a number and relocate the item to the corresponding position
852in the list (@code{todo-set-item-priority}). For example, entering
853@kbd{3} at the prompt makes the item the third in the category, i.e.,
854gives it third highest priority. You can also pass the desired priority
855as a numeric prefix argument, e.g., @kbd{3 #} gives the item third
856highest priority without prompting. (Prefix arguments have no effect
857with @kbd{r} or @kbd{l}.)
858@end table
859
860@node Moving and Deleting Items, Done Items, Reprioritizing Items, Relocating and Removing Items
861@subsubsection Moving and Deleting Items
862
863You can move an item to another category, thereby recategorizing it:
864
865@table @kbd
866
867@item m
868Move the item at point to another category (@code{todo-move-item}).
869This prompts for a category to move the item to, displays that category,
870prompts for the priority of the moved item in the category moved to and
871inserts the item accordingly. Minibuffer completion of the name of the
872category moved to works as with the navigation command @kbd{j}, and as
873with that command, passing a prefix argument prompts for a file and
874moves the item to a category in that file; and if the category name you
875enter is new, then you are asked whether to add the category to the
876file, and if you affirm, the item is moved to the new category.
877@end table
878
879You delete an item, thereby permanently removing it:
880
881@table @kbd
882
883@item k
884Delete the todo item at point (@code{todo-delete-item}; the binding is
526e5233 885mnemonic for ``kill'', since @kbd{d} is used for marking items as done
016d3f7d
SB
886(@pxref{Done Items}); but note that @kbd{k} does not put the item into
887the kill ring). This command requires confirmation that you want to
888delete the item, since you cannot undo the deletion in Todo mode. (You
889could use @kbd{F e} to recover the item, but be aware that this would
890put the file in an inconsistent state, which you can recover from, but
891not without a risk; cf.@: the cautionary note in @ref{Reordering
892Categories}.)
893@end table
894
895@quotation Note
896Todo commands that require user confirmation, such as @kbd{k}, use a
897modified form of @code{y-or-n-p}, which by default only accepts @kbd{y}
898or @kbd{Y}, but not @key{SPC}, as an affirmative answer. This is to
899diminish the risk of unintentionally executing the command, which is
900especially important with commands that do deletion, since there is no
901Todo command to undo a deletion. If you want to be able to use SPC for
902confirmation, enable the option @code{todo-y-with-space}.
903@end quotation
904
905@node Done Items, , Moving and Deleting Items, Relocating and Removing Items
906@subsubsection Done Items
907
908When the activity or thing that a todo item is about has been done, it
909is natural to eliminate the item from the todo list. But instead of
910deleting it permanently, you may prefer to keep a record of your
911accomplishments by marking the item as done. In Todo mode, this removes
912the done item from the todo list, so as not to clutter it up, and stores
913it elsewhere. Such stored items form a record or diary of things done.
914The Todo package provides two such stores: the ``done items'' section of
915a Todo category, described here, and done item archives (@pxref{Todo
916Archive Mode}).
917
918@table @kbd
919
920@item d
921This command (@code{todo-item-done}) removes the todo item at point from
922the todo list, appends to the original header a header consisting of
923@code{todo-done-string} (by default ``DONE '') and the current date, and
924if @code{todo-always-add-time-string} is enabled, also the current time,
925and adds the resulting done item to the top of the done items section of
926the category. Invoked with a prefix argument, it also prompts you to
927enter a comment, which is appended to the end of the done item, prefixed
928with @code{todo-comment-string} (by default ``COMMENT: '').
929@end table
930
931A category's done items section is located below the last todo (i.e.,
932not done) item in the category. By default this section is hidden from
933view. There are two commands for viewing and hiding done items; since
934these are toggle commands, for convenience they also have a single key
935binding:
936
937@table @kbd
938
939@item C v
940@itemx v
941Make the done items section of the current category visible if it is
942hidden, or hide it if it is visible
943(@code{todo-toggle-view-done-items}). If you always want to see the
944done items section on entering a category, enable the option
945@code{todo-show-with-done}; you can still use @kbd{C v} or @kbd{v} to
946hide (and unhide) it.
947
948@item F V
949@itemx V
950Toggle the standard category display in the current todo file, i.e.,
951display only the done items section of each category in the file, or if
952this is visible, hide it again and display only the todo items section
953(@code{todo-toggle-view-done-only}).
954@end table
955
956Three editing commands for done items are available:
957
958@table @kbd
959
960@item e c
961If you type this command (@code{todo-edit-done-item-comment}) when point is
962on a done item that has a comment, you can edit the text of the
963comment. If you invoke it with a prefix argument (@kbd{C-u e c}), the
964comment is deleted on confirmation. If the done item does not have a
965comment, this command allows you to add one.
966
967@item m
968Move the done item at point to the top of the done items section of
969another category (@code{todo-move-item}). This is useful in case, after
970having relocated an item to its category's done items section, you
971create a category that is better suited to the content of the done item
972than its current category, so you can recategorize the done item.
973
974@item u
975If you decide the done item at point is not done after all, this command
976``undoes'' it, i.e., restores it to the todo list of its category, with
977the priority you choose for it (@code{todo-item-undone}). If the done
978item has a comment, you are asked whether to delete it from the restored
979item.
980@end table
981
982@node Todo Archives, Marked Items, Editing, Top
983@chapter Todo Archives
984
985When the done items section of a category itself starts to become
986cluttered, or if you just want to store some accomplished todo items in
987a separate file, you can move them to a Todo archive. This is a file
988with exactly the same structure as a todo file, i.e., divided into
989categories, but differs in that the categories contain only done items.
990Todo archives reside, like todo files, in @code{todo-directory} but have
991the extension @samp{.toda} instead of @samp{.todo}.
992
993@menu
994* Creating and Visiting Archives::
995* Todo Archive Mode::
996@end menu
997
998@node Creating and Visiting Archives, Todo Archive Mode, , Todo Archives
999@section Creating and Visiting Archives
1000
1001Todo mode provides the following command for archiving items:
1002
1003@table @kbd
1004
1005@item A d
1006This command (@code{todo-archive-done-item}) archives the done item at point.
1007Invoked with a prefix argument, it archives all done items in the
1008current todo category. If an archive for the current todo file
1009already exists and contains a category with the same name as the
1010current todo category, then this command moves the done item to the
1011top of the corresponding archive category. If the archive exists but
1012it does not have a corresponding category, this command creates the
1013category in the archive and moves the done item to it. If no archive
1014for the todo file exists, the command creates both the archive file,
1015using the same base name as that of the todo file, as well as the
1016category, and moves the done item to it.
1017@end table
1018
1019Typing @kbd{A d} is also the only way within the Todo mode package to
1020create an archive file and its categories. Consequently, as a rule each
1021archive file corresponds to exactly one todo file and has the same base
1022name as this file, and each category in an archive file corresponds to
1023and has the same name as a category in the corresponding todo file.
1024Exceptions can only arise if you delete a todo file but not the
1025corresponding archive, or if you delete a category in a todo file that
1026has a corresponding category in an archive.
1027
1028You might be inclined to do the latter if you have archived all the
1029items from a given todo category and you don't plan to add new items to
1030it. In particular, if you have numerous such empty categories in a todo
1031file, this can make sequential navigation in the file annoying. You can
1032avoid this annoyance by deleting these categories, but only at the cost
1033of putting the todo file out of synch with the archive file.
1034
1035You may find it preferable not to delete empty todo categories but to
1036enable the option @code{todo-skip-archived-categories}. When this is
1037non-nil, such empty todo categories are skipped over by the sequential
1038category navigation commands @kbd{f} and @kbd{b}, so they don't distract you
1039while navigating and you maintain the structural correspondence between
1040todo and archive files (you can also still jump to empty todo categories
1041with @kbd{j}).
1042
1043If you rename a todo category that has a corresponding category in an
1044archive, the archive category is also automatically identically renamed.
1045Likewise, if you move such a todo category to another file; in this
1046case, if there is no archive file corresponding to the todo file the
1047category is moved to, then the archive is automatically created and the
1048archived category is moved to it.
1049
1050There are two commands in Todo mode for visiting archive files:
1051
1052@table @kbd
1053
1054@item A f
1055Switch to a buffer displaying the archived category corresponding to the
1056current todo category (@code{todo-find-archive}). If the todo category
1057has no archived items, the command asks if you want to visit the archive
1058anyway. If there is no archive for this todo file, it asks if you want
1059to visit another archive, which you can select via minibuffer
1060completion.
1061
1062@item A c
1063Choose an archive to visit, whether or not the current todo file has an
1064archive (@code{todo-choose-archive}).
1065@end table
1066
1067As with todo files, you can also visit a Todo archive by invoking a
1068standard Emacs file-visiting command; this displays the first (on the
1069initial invocation) or current category of the archive.
1070
1071@node Todo Archive Mode, , Creating and Visiting Archives, Todo Archives
1072@section Todo Archive Mode
1073
1074When you visit a Todo archive, the buffer is in Todo Archive mode. It
1075displays categories just as in Todo mode, except that they only contain
1076done items. It provides the same sequential navigation commands as
1077Todo mode: @kbd{f} and @kbd{b} navigate between the categories of the current
1078archive, and @kbd{n} and @kbd{p} navigate between the done items of the current
1079archive category.
1080
1081The commands @kbd{t} and @kbd{j} are also available in Todo Archive
1082mode, and they work the same as in Todo mode, which means they can only
1083be used to return to Todo mode: @kbd{t} prompt for and switch to a todo
1084file, and with @kbd{j} you can only jump to a todo category. These
1085commands exclude archives because an archive file has the same base name
1086as the corresponding todo file, and category name completion uses only
1087the base names, so the commands cannot know which type of file you want
1088to visit. For this reason, there is a special command in Todo Archive
1089mode for jumping to another archive category or visiting another archive
1090file:
1091
1092@table @kbd
1093
1094@item a
1095This command (@code{todo-jump-to-archive-category}) prompts for a category in the
1096current archive and jumps to it. Called with a prefix argument, it
1097prompts for another archive, then for a category in it and jumps to
1098that category.
1099@end table
1100
1101None of the Todo mode editing commands are available in Todo Archive
1102mode, since archives are meant to be static records of accomplished todo
1103items. Should you, however, archive an item by mistake or simply change
1104your mind about the archival status of an item, you can ``unarchive'' it:
1105
1106@table @kbd
1107
1108@item u
1109Restore the done item at point to the top of the done items section of
1110the corresponding category in the corresponding todo file, i.e., an
1111unarchived item remains a done item (@code{todo-unarchive-items}). When
1112the last item in an archive category has been unarchived, the category
1113is automatically deleted from the archive. If this was the only
1114category in the archive, the archive file is also automatically deleted.
1115@end table
1116
1117Since it is natural to visit an archive from the corresponding todo
1118file, it would be convenient to easily return to the todo file when you
1119have finished browsing the archive. If you type `q' to quit Todo
1120Archive mode, this switches to the corresponding todo file and shows the
1121todo category corresponding to the archive category you were just
1122visiting.
1123
1124The command @kbd{F k} (@pxref{File Editing}) is also available in Todo
1125Archive mode. It deletes the current archive file and prompts you
1126whether to delete the corresponding todo file.
1127
1128@node Marked Items, Todo Categories Mode, Todo Archives, Top
1129@chapter Marked Items
1130
1131For many item editing commands it can make sense and be convenient to
1132apply them simultaneously to more than one item in the current category.
1133Todo facilitates this by means of marked items.
1134
1135@table @kbd
1136
1137@item *
1138Mark the item at point if it is unmarked, and remove the mark it is
1139already marked (@code{todo-toggle-mark-item}). The mark is a string
1140specified by the option @code{todo-item-mark} (by default @samp{*})
1141appended in front of the item header (more precisely, in front of the
2a024334 1142item's priority number or prefix; see @ref{Todo Display Features}, for
016d3f7d
SB
1143details of the latter). After marking the current item, the command
1144advances point to the next item. It also accepts a numeric prefix
1145argument, which allows toggling the mark of multiple consecutive items.
1146
1147@item C *
1148Mark all todo items in the current category.
1149
1150@item C u
1151Unmark all todo item in the current category.
1152@end table
1153
1154You can also use the last two commands to mark or unmark all done items in
1155the category, but only when only the done items section is being
1156displayed, i.e., after invoking @kbd{C V} or @kbd{V}.
1157
1158The following commands operate on marked items: @kbd{k} (deleting), @kbd{m}
1159(moving to another category), @kbd{d} (moving to the done items section;
1160note that @kbd{C-u d} adds the same comment to all marked items), @kbd{A d}
1161(archiving), @kbd{u} (both in Todo mode for undoing a done item and in
1162Todo Archive mode for unarchiving an item), as well as the commands for
1163editing the item header (those beginning with the prefix @kbd{e d} as well
1164as @kbd{e t}, @kbd{e y y} and @kbd{e y k}). The item insertion, textual editing and
1165priority changing commands do not operate on marked items.
1166
1167If you use @kbd{m}, @kbd{d}, @kbd{A d} or @kbd{u} on multiple noncontiguous marked
1168items, the relocated items retain their relative order but are now
1169listed consecutively en bloc.
1170
1171You can mark both todo and done items, but note that only @kbd{m} can apply
1172to both; other commands only affect either marked todo or marked done
526e5233 1173items, so if both types of items are marked, invoking these commands
016d3f7d
SB
1174has no effect and informs you of your erroneous attempt.
1175
1176@node Todo Categories Mode, Searching for Items, Marked Items, Top
1177@chapter Todo Categories Mode
1178
1179It can be helpful to have a compact overview of the categories in a todo
1180file and the types of items it contains; Todo provides a tabular view
1181of this information.
1182
1183@table @kbd
1184
1185@item F c
1186Typing this command (@code{todo-show-categories-table}) in Todo mode or Todo
1187Archive mode switches to a buffer displaying a table that gives an
1188overview of the categories in the current todo or archive file. This
1189buffer is in Todo Categories mode.
1190@end table
1191
1192The table consists of a column containing the names of the categories in
1193the file, followed by columns containing counts of certain types of
1194items in each category. With todo files there are four count types: all
1195todo (i.e., not done) items, diary items (i.e., those todo items lacking
1196the @code{todo-nondiary-marker}, which hence can appear in the Fancy Diary
1197display), done (but not archived) items, and archived items. With
1198archive files all items are done, so the table only has a column for
1199this count. The final row of the table gives total item counts across
1200all categories in the file.
1201
1202Aside from explicitly invoking @kbd{F c} to display the table of
1203categories, you can also arrange to have it displayed on the first
1204invocation of @code{todo-show} for a given file (i.e., either using
1205@code{todo-show} to initiate a Todo session, or calling it in Todo mode
1206to visit another todo file). To do this customize the option
1207@code{todo-show-first}.
1208
1209@menu
1210* Table of Item Counts::
1211* Reordering Categories::
1212@end menu
1213
1214@node Table of Item Counts, Reordering Categories, , Todo Categories Mode
1215@section Table of Item Counts
1216
526e5233 1217Above each column of the table is a labeled button you can press by
016d3f7d
SB
1218clicking with the mouse or by typing @key{RET} on it. Pressing an item
1219count button sorts the table alternately in ascending or descending
1220order according to the type of count. Pressing the category button
1221alternates between the initial numerical order of the categories and
1222alphabetical order. In numerical order the column of category names is
1223preceded by a column containing the corresponding category numbers; this
1224column is not displayed in the alphabetical listing. Instead of
1225pressing the buttons, you can also sort the table by typing the
1226following keys:
1227
1228@itemize
1229
1230@item @kbd{c}
1231to sort by category numerically or alphabetically;
1232@item @kbd{t}
1233to sort by todo item counts;
1234@item @kbd{y}
1235to sort by diary item counts;
1236@item @kbd{d}
1237to sort by done item counts;
1238@item @kbd{a}
1239to sort by archived item counts.
1240@end itemize
1241
1242Each row of the table is also buttonized; pressing one of these exits
1243the buffer (killing it), returns to the buffer of the file from which
1244you had invoked `F c', and displays the category that was named in the
1245row button you pressed (i.e., pressing this button jumps to that
1246category). However, if the category named in the row is in a todo file
1247and all of its items have been archived, and you have enabled the option
1248@code{todo-skip-archived-categories}, then pressing the button jumps to
1249the archive category instead of the empty todo category. You can
1250recognize such categories by their items counts in the table---all
1251columns but the archived one have counts of zero---and in addition,
1252their lines in the table are also distinguished from the others by a
1253different face.
1254
1255You can navigate around the table:
1256
1257@table @kbd
1258
1259@item n
1260@itemx @key{TAB}
1261Advance point to the next button.
1262
1263@item p
1264@itemx S-@key{TAB}
1265Put point on the previous button.
1266@end table
1267
1268These commands are cyclic, e.g. when point is on the last button,
1269pressing @kbd{n} moves it to the first button.
1270
1271Typing @kbd{q} exits Todo Categories mode, killing the buffer and returning
1272to the current category in the Todo mode or Todo Archive mode buffer
1273from which you had invoked @kbd{F c}.
1274
1275@node Reordering Categories, , Table of Item Counts, Todo Categories Mode
1276@section Reordering Categories
1277
1278Todo Categories mode provide commands with which you can change the
1279numbering of the categories in the current file. This renumbering has
1280the effect of reordering the categories for sequential navigation by
1281@kbd{f} and @kbd{b} in Todo mode and Todo Archive mode. These commands
1282are only operative when the table displays the categories in their
1283numerical order. They work just like reprioritizing items in Todo mode,
1284hence have the same key bindings:
1285
1286@table @kbd
1287
1288@item r
1289Raise the current line of the table (the one the cursor is on),
1290decreasing the category's number by one (@code{todo-raise-category}).
1291This command exchanges lines, and hence the numbers, of the category at
1292point and the one above it before invoking the command.
1293
1294@item l
1295Lower the current line of the table, increasing the category's number by
1296one (@code{todo-lower-category}). This command exchanges lines, and
1297hence the numbers, of the category at point and the one below it before
1298invoking the command.
1299
1300@item #
1301Prompt for a number between 1 and the number of categories in the file
1302and reorder the table accordingly (@code{todo-set-category-number}). If
1303called with a numeric prefix argument within the allowed range, reorder
1304the table without prompting.
1305@end table
1306
1307The reordering done by these commands remains in effect when you return
1308to Todo mode or Todo Archive mode and, as long as you save the todo
1309or archive file after reordering, in subsequent sessions as well.
1310
1311@quotation @strong{Caution}
1312It is important to be aware that renumbering the categories does not
1313change the textual order of the categories in the file. This is
1314significant if you should invoke @kbd{F e} to edit the entire file
1315manually and in so doing alter the number of items in a category: this
1316will make the item count shown in the table of categories of this file
1317inconsistent with the actual number. You can repair this inconsistency
1318by invoking the command @code{todo-repair-categories-sexp} (which lacks
1319a key binding, since it is meant to be a rarely needed rescue
1320operation). But this will revert any renumbering of the categories you
1321have made, so you will have to renumber them again. This is the reason
1322why you should exercise caution when using @kbd{F e}.
1323@end quotation
1324
1325@node Searching for Items, Todo Filtered Items Mode, Todo Categories Mode, Top
1326@chapter Searching for Items
1327
1328It can be useful to be able to locate and examine all todo items that
1329fit certain criteria, regardless of which category they belong to. One
1330way to do this in Todo mode is by sequentially searching in the file:
1331
1332@table @kbd
1333
1334@item S
2a024334 1335This command (@code{todo-search}; the key is capital @kbd{S}) prompts for a
016d3f7d
SB
1336regular expression, searches from the beginning of the current todo file
1337and displays the category containing the first match it finds, with the
1338match highlighted. If there are further matches, a message saying how
1339many are left is displayed and you are asked if you want to go to the
1340next match. When you reach the last match, or if you decide not to go
1341to further matches, you are asked whether the match highlighting should
1342be removed.
1343
1344@item X
1345This command (@code{todo-clear-matches}) removes any highlighting added by @kbd{S}.
1346This is so you can leave the matches highlighted at the end of the
1347search and remove the highlighting later.
1348@end table
1349
1350These commands are also available in Todo Archive mode.
1351
1352@node Todo Filtered Items Mode, Todo Display Features, Searching for Items, Top
1353@chapter Todo Filtered Items Mode
1354
1355A more powerful alternative to sequential searching is item filtering,
1356by which items from different categories that match specified criteria
1357are gathered and displayed in a new buffer as a kind of virtual
2a024334 1358category in a distinct mode, Todo Filtered Items mode.
016d3f7d
SB
1359
1360@menu
1361* Filtering Items::
1362* Todo Filtered Items Mode Commands::
1363* Files of Filtered Items::
1364@end menu
1365
1366@node Filtering Items, Todo Filtered Items Mode Commands, , Todo Filtered Items Mode
1367@section Filtering Items
1368
1369Todo mode provides three ways to filter items: a general filter for
1370items matching a user-entered regular expression, as with the search
1371command; and two specific filters, one for diary-displayable items
1372(i.e., those lacking @code{todo-nondiary-marker}) and one for top
1373priority items (more on the latter below). The commands for each
1374filter come in pairs, one for filtering just the current todo file and
1375one for filtering a user-specified list of todo files. Thus, there
1376are six item filtering commands:@footnote{The use of @kbd{F} in the key
1377sequences of these commands naturally recalls ``filter'', but is also
526e5233 1378consistent with the Todo mode mnemonic key binding convention, since the
016d3f7d
SB
1379commands involve one or more whole files.}
1380
1381@itemize @bullet
1382
1383@item
1384@kbd{F x x} (@code{todo-filter-regexp-items})
1385@item
1386@kbd{F x m} (@code{todo-filter-regexp-items-multifile})
1387@item
1388@kbd{F y y} (@code{todo-filter-diary-items})
1389@item
1390@kbd{F y m} (@code{todo-filter-diary-items-multifile})
1391@item
1392@kbd{F t t} (@code{todo-filter-top-priorities})
1393@item
1394@kbd{F t m} (@code{todo-filter-top-priorities-multifile})
1395@end itemize
1396
1397There are two ways to specify which files the multifile filtering
1398commands apply to. If there are files you want to filter every time you
1399use these commands, customize the option @code{todo-filter-files}. If you
1400leave this option empty (the default), invoking a multifile filtering
1401command pops up a buffer similar to the Customization buffer for
1402@code{todo-filter-files}, in which you can select files to filter just for
1403this invocation.
1404
1405Diary and top priority items are by definition non-done todo items, but
1406when filtering by regular expression, you can extend the scope of the
1407command to done items by enabling the option @code{todo-filter-done-items}.
1408Then @kbd{F x x} and @kbd{F x m} will gather both matching todo and matching
1409done items (including done items from any archive files corresponding to
1410the selected todo files) into the virtual category of filtered items.
1411
1412There are several ways to specify how many items in each category count
1413as top priorities and hence get filtered by @kbd{F t t} and @kbd{F t m}:
1414
1415@itemize @bullet
1416
1417@item
1418The option @code{todo-top-priorities} specifies a single default number
1419for all categories and all todo files; its default value is 1, which
1420means just the highest priority item in every category is filtered,
1421unless otherwise specified.
1422@item
1423The option @code{todo-top-priorities-overrides} lists file-wide overrides
1424of @code{todo-top-priorities} as well as category-specific overrides. It
1425is empty by default. However, using the Custom facility to set this
1426option would be tedious and error-prone, so instead you should use the
1427commands @kbd{F t s} and @kbd{C t s}. The former sets (i.e., overrides) the
1428default number of top priorities for all categories in the current
1429todo file, and the latter sets the number of top priorities for the
1430current category. To exclude a category or file from filtering by @kbd{F t t}
1431and @kbd{F t m}, set the number to @samp{0}.
1432@item
1433You can invoke `F t t' and `F t m' with a numeric prefix argument,
1434which specifies the number of top priorities in each category just for
1435this invocation, overriding both @code{todo-top-priorities-overrides} and
1436@code{todo-top-priorities}.
1437@end itemize
1438
1439@node Todo Filtered Items Mode Commands, Files of Filtered Items, Filtering Items, Todo Filtered Items Mode
1440@section Todo Filtered Items Mode Commands
1441
1442The output of the item filtering commands looks similar to a regular
1443Todo category, but it is not contained in any todo file and does not
1444have a name on being created, so it is not a ``real'' category but a
1445``virtual'' category. Another difference is the lack of a done items
1446section; either there are no done items in the list (when the filtered
1447items are diary or top priority items), or these are displayed in the
1448same list as todo items (if you filtered by regular expression and
1449allowed done items). A further difference is that the items have an
1450additional header, between the item's date/time header and its text,
1451specifying which category (and if you invoked a multifile command, also
1452which file) the item comes from, and if you filtered by regular
1453expression, also whether the item comes from a Todo archive.
1454
1455The sequential item navigation commands @kbd{n} and @kbd{p} work the same in
1456Todo Filtered Items mode as in Todo mode, as do the file and category
1457jumping commands @kbd{t} and @kbd{j}; however, the sequential category
1458navigation commands are unavailable, since virtual categories of
1459filtered items are not ordered with respect to ``real'' categories. In
1460addition, Todo Filtered Items mode provides a special navigation
1461command:
1462
1463@table @kbd
1464
1465@item g
1466@itemx @key{RET}
1467If you type this command (@code{todo-go-to-source-item}) with point on a
1468filtered item, the buffer switches to the item's source file (in Todo
1469mode or Todo Archive mode, as the case may be) and displays its
1470category, with point on the item.
1471@end table
1472
1473Filtered items cannot be textually edited, moved to another category,
1474marked done or archived like items in a real todo category, since these
1475would then be out of synch with each other. But there is one type of
1476editing command that does work in Todo Filtered Items mode: changing an
1477item's priority:
1478
1479@table @kbd
1480
1481@item r
1482@itemx l
1483@itemx #
1484These commands raise, lower, or set, respectively, the current item's
1485priority in the virtual category.
1486@end table
1487
1488@noindent
1489Using these commands, you can create a cross-category (and even
1490cross-file) prioritized list of filtered items. However, there is a
1491restriction on these commands in Todo Filtered Items mode: you cannot
1492change the relative priorities of items from the same real category,
1493since that would make the filtered list inconsistent with the source
1494todo list.
1495
1496@node Files of Filtered Items, , Todo Filtered Items Mode Commands, Todo Filtered Items Mode
1497@section Files of Filtered Items
1498
1499Typing @kbd{s} in Todo Filtered Items mode saves the buffer of filtered
1500items to a file in @code{todo-directory}. Files of items filtered by
1501regular expression have the extension @samp{.todr}, those with filtered
1502diary items have the extension @samp{.tody} and those with filtered top
1503priorities have the extension @samp{.todt}. The extensions are added
1504automatically the first time you save the buffer to a file.
1505
1506With filtered top priority or diary items, the file is automatically
1507named on first saving it, using as the base name either the same base
1508name as the single todo file it was generated from, or combining the
1509base names of the todo files used in multifile filtering commands.
1510With items filtered by regular expression, it can be useful to save
1511separate lists generated from the same file(s) using different regular
1512expressions, so when saving such a list, you are prompted for a short
1513identifying string to add to the file name.
1514
1515When you invoke one of the item filtering commands without a prefix
1516argument and a corresponding file already exists, the command visits
1517this file (if, for the current file or chosen files, there are multiple
1518files of items filtered by regular expression, you are prompted to
1519choose one). To force generation of a new filtered list, invoke the
1520command with a prefix argument (in the case of top priority items,
1521either numeric as described above, or the raw prefix argument @kbd{C-u} to
1522use the values of @code{todo-top-priorities-overrides} or
1523@code{todo-top-priorities}).
1524
1525Aside from explicitly invoking an item filtering command to display a
1526saved list of items filtered by a given method from given todo files,
1527there are two other ways to visit a saved file of filtered items:
1528
1529@table @kbd
1530@item F f
1531Visit a saved file of filtered items, which you choose via minibuffer
1532completion (@code{todo-find-filtered-items-file}).
1533@end table
1534
1535@itemize @bullet
526e5233 1536@item
016d3f7d
SB
1537As with tables of categories, by customizing @code{todo-show-first} you
1538can have the first invocation of @code{todo-show} for a given todo file
1539display the corresponding saved file of filtered items. If there is
1540no saved filtered items list for the file, @code{todo-show} simply
1541defaults to visiting the file and displaying its first category, as
1542usual.
1543@end itemize
1544
1545The command @kbd{F k} (@pxref{File Editing}) is also available in Todo
1546Filtered Items mode. It deletes the current filtered items file.
1547
1548@node Todo Display Features, Printing Todo Buffers, Todo Filtered Items Mode, Top
1549@chapter Todo Display Features
1550
526e5233 1551You can change the appearance of Todo mode buffers in a variety of ways.
016d3f7d
SB
1552
1553@menu
1554* Faces::
1555* Item Prefix::
1556* Other Display Commands and Options::
1557@end menu
1558
1559@node Faces, Item Prefix, , Todo Display Features
1560@section Faces
1561
1562Each of the Todo modes uses faces to distinguish various aspects of the
1563display, both structural and informational. For example, the faces for
1564the date and time strings of todo item headers by default inherit the
1565attributes of the corresponding faces used by the Emacs diary; but when
1566the date and time of a Todo diary item (i.e., an item lacking
1567@code{todo-nondiary-marker}) is earlier than the current date and time,
1568they are displayed in a different face. In this way, you can readily
1569recognize diary items that have ``expired'' and act accordingly (e.g.,
526e5233 1570by tagging them as done or by updating the deadlines).
016d3f7d
SB
1571
1572Another example of an informational face is the face used to distinguish
1573top priority items. A third case is the face used in Todo Categories
1574mode to mark rows of the table containing categories with only archived
1575items.
1576
1577The @code{todo-faces} customization group contains a complete list of
1578Todo mode faces and brief descriptions of their use.
1579
1580
1581@node Item Prefix, Other Display Commands and Options, Faces, Todo Display Features
1582@section Item Prefix
1583
1584In the default display of (real or virtual) categories in Todo mode,
1585Todo Archive mode and Todo Filtered Item mode the items are visually
1586numbered in ascending order, starting with @samp{1} on the top item,
1587displayed to the left of its header (date/time string). With todo items
1588the numbers indicate each item's priority in the list, so when you
1589reprioritize an item with @kbd{#} or move it with @kbd{m}, these numbers make
1590it easier to choose the item's new priority. The numbering also lets
1591you to see at a glance how many items there are in the list. When an
1592item is inserted, deleted, or moved, the numbering is automatically
1593updated. In Todo mode, the todo and done items sections in each
1594category are separately numbered.
1595
1596If you prefer not to have item numbering displayed, disable the option
1597@code{todo-number-prefix}; then the display of each item starts by default
1598simply with its header. But you can also replace the numbering with a
1599visually distinctive string of your choice by customizing the option
1600@code{todo-prefix} (the empty string by default). Another alternative is to
1601temporarily hide the item numbering:
1602
1603@table @kbd
1604
1605@item F N
1606@itemx N
1607Toggle between displaying item numbering and displaying the
1608@code{todo-prefix} string in the current Todo file (todo, archive, or
1609saved virtual category of filtered items. This command also works in
1610buffers of filtered items that have not yet been written to a file.)
1611@end table
1612
1613In the todo items section of each Todo mode category, the item prefix
1614(whether a priority number or a fixed string) of the top priority items
2a024334 1615(determined as specified in @pxref{Filtering Items}) is displayed in a
016d3f7d
SB
1616different face from the prefix of the other items, so you see at a
1617glance how many items in the category are top priorities.
1618
1619@node Other Display Commands and Options, , Item Prefix, Todo Display Features
1620@section Other Display Commands and Options
1621
1622There are two additional toggle commands that affect display in the
1623current file:
1624
1625@table @kbd
1626
1627@item F h
1628@itemx h
1629Hide the item headers if visible, or show them if they are hidden.
1630With done items, only the done header (i.e. the done tag and date-time
1631string inserted when the item was marked done) is hidden, the original
1632date-time string is not. With filtered items, the category (or
1633category-file) tag is not hidden.
1634
1635@item F H
1636@itemx H
1637Highlight the current item if unhighlighted, or remove its highlighting.
1638When item highlighting is enabled, it follows navigation by @kbd{n} or
1639@kbd{p}. If you want to have current item highlighting by default,
1640enable the option @code{todo-highlight-item}. @kbd{F H} or @kbd{H} will
1641still toggle it.
1642@end table
1643
1644There are two options which affect the display of items whose content is
1645longer than one screen line:
1646
1647@itemize @bullet{}
1648
1649@item
1650@code{todo-indent-to-here} sets the amount of indentation for all lines
1651after the first in multiline todo items, which is necessary in order
1652for todo diary items to be fully visible in the Fancy Diary display.
1653The default indentation is 3 spaces. For a uniform appearance this
1654option applies to all items, i.e., diary and nondiary todo items and
1655also done items.
1656
1657@item
1658@code{todo-wrap-lines} allows you to choose, for the purposes of
1659insertion and editing, between treating multiline todo items as
1660containing multiple logical lines with hard line breaks or as multiple
1661visual lines using Visual Line mode; the latter is the default. Since
1662multiparagraph items also contain hard line breaks in Visual Line mode,
1663for a uniform appearance this display shows indentation on wrapped lines
1664by using a wrap-prefix of @code{todo-indent-to-here} spaces.
1665@end itemize
1666
1667The indentation inserted after a hard newline is actually a tab
1668character, and the Todo modes that display items bind @code{tab-width} to
1669@code{todo-indent-to-here}, so if you change the default value of the
1670latter, the next time you visit a Todo file, the indentation will
1671reflect your change.
1672
1673By default, the todo and done items sections of a todo category are
1674visually separated by a line as wide as the window the buffer is
1675displayed in. You can change the appearance and width of the separator
1676by customizing @code{todo-done-separator-string}; you can also change the
1677face of the separator string.
1678
1679There are also several options for changing the appearance in Todo
1680Categories mode and Todo Filtered Items mode, beyond those mentioned
1681above in the sections on these modes; see the customization groups
1682@code{todo-categories} and @code{todo-filtered} for details.
1683
1684@node Printing Todo Buffers, Legacy Todo Mode Files, Todo Display Features, Top
1685@chapter Printing Todo Buffers
1686
1687If you print a Todo buffer using one of the standard Emacs printing
1688commands, it does not look exactly like what you see in the buffer.
1689This is because some of the display features are non-printable
1690(specifically, those using overlays, word-wrap and wrap-prefix). Todo
1691mode provides two print commands that produce output which includes
1692printable counterparts of such display features:
1693
1694@table @kbd
1695
1696@item P B
1697Send the printable buffer output directly to your printer.
1698
1699@item P F
1700Prompt for a file name and write the printable output to that file.
1701@end table
1702
1703By default, Todo uses @code{ps-print-buffer-with-faces} to make the
1704printable version; you can change this by setting the option
1705@code{todo-print-function}.
1706
1707@node Legacy Todo Mode Files, GNU Free Documentation License, Printing Todo Buffers, Top
1708@chapter Legacy Todo Mode Files
1709
1710Users of the original version of Todo mode will recognize from the
1711description in this user manual that, although the new version shares
1712with the original version the same basic user interface and handling of
1713todo items, there are some incompatible differences between them, such
1714as the done items sections (there are also other file format
1715incompatibilities behind the scenes that are normally not visible to
1716users).
1717
1718The most significant incompatibility concerns the item prefix. In the
1719earlier version of Todo mode the prefix was the initial part of the item
1720string itself, so in order for the item to be displayable in the Emacs
1721diary, the prefix had to be a date/time pattern recognizable by the
1722diary (although the todo item also has its own date/time header).
1723Moreover, since all items had the same prefix string in the original
1724version, this means that either only all or no items could appear in the
1725Fancy Diary display on any given date. This considerably restricts the
1726practicality of including todo items in the diary. In contrast, the
1727current version of Todo mode uses overlays for item priority numbering
1728or prefixes, and item-specific diary-compatible date/time headers and
1729special marks for todo items to be excluded from the diary, so you can
1730determine for each item whether and when it appears in the Fancy Diary
1731display.
1732
1733Due to these incompatibilities, files created with the original version
1734of Todo mode cannot be displayed or edited with the current version.
1735However, this version provides a function that converts the two main
1736types of files used by the original version into new-style valid todo
1737and archive files, respectively, and saves them in
1738@code{todo-directory}.@footnote{The original version of Todo mode also
1739allowed saving a file of top priority items, but since you can readily
1740create such a file with the new version, which is also more flexible,
1741no conversion is provided for this file.}
1742
1743This conversion function is automatically called the first time you
1744invoke @code{todo-show} (i.e., before you have created a todo file with
1745the new version), and if it finds the old-style files, it offers to
1746convert them, making them the first new-style todo and archive files.
1747If you choose not to convert the old-style files at this time, you can
1748do so later by invoking the command @code{todo-convert-legacy-files}
1749(there is no key binding for it, since it shouldn't be necessary to use
1750it often). (A delicate part of the conversion concerns the customizable
1751format of item date/time headers in the old-style; see the documentation
1752string of @code{todo-todo-mode-date-time-regexp} for details.)
1753
1754@node GNU Free Documentation License, , Legacy Todo Mode Files, Top
1755@appendix GNU Free Documentation License
1756@include doclicense.texi
1757
1758@bye
1759
1760@c End: