]> code.delx.au - gnu-emacs/blob - lisp/calendar/todo-mode.el
(quail-update-leim-list-file): Fix message syntax.
[gnu-emacs] / lisp / calendar / todo-mode.el
1 ;; todo-mode.el -- Major mode for editing TODO list files
2
3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
4
5 ;; Author: Oliver.Seidel@cl.cam.ac.uk (was valid on Aug 2, 1997)
6 ;; Created: 2 Aug 1997
7 ;; Version: $Id: todo-mode.el,v 1.33 1997/12/04 17:45:22 os10000 Exp os10000 $
8 ;; Keywords: Categorised TODO list editor, todo-mode
9
10 ;; This file is part of GNU Emacs.
11
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; any later version.
16
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
26
27 ;; ---------------------------------------------------------------------------
28
29 ;;; Commentary:
30
31 ;; Mode Description
32 ;;
33 ;; TODO is a major mode for EMACS which offers functionality to
34 ;; treat most lines in one buffer as a list of items one has to
35 ;; do. There are facilities to add new items, which are
36 ;; categorised, to edit or even delete items from the buffer.
37 ;; The buffer contents are currently compatible with the diary,
38 ;; so that the list of todo-items will show up in the FANCY diary
39 ;; mode.
40 ;;
41 ;; Notice: Besides the major mode, this file also exports the
42 ;; function `todo-show' which will change to the one specific
43 ;; TODO file that has been specified in the todo-file-do
44 ;; variable. If this file does not conform to the TODO mode
45 ;; conventions, the todo-show function will add the appropriate
46 ;; header and footer. I don't anticipate this to cause much
47 ;; grief, but be warned, in case you attempt to read a plain text
48 ;; file.
49 ;;
50 ;; Preface, Quickstart Installation
51 ;;
52 ;; To get this to work, make emacs execute the line
53 ;;
54 ;; (autoload 'todo-mode "todo-mode"
55 ;; "Major mode for editing TODO lists." t)
56 ;; (autoload 'todo-show "todo-mode"
57 ;; "Show TODO items." t)
58 ;; (autoload 'todo-insert-item "todo-mode"
59 ;; "Add TODO item." t)
60 ;;
61 ;; You may now enter new items by typing "M-x todo-insert-item",
62 ;; or enter your TODO list file by typing "M-x todo-show".
63 ;;
64 ;; The TODO list file has a special format and some auxiliary
65 ;; information, which will be added by the todo-show function if
66 ;; it attempts to visit an un-initialised file. Hence it is
67 ;; recommended to use the todo-show function for the first time,
68 ;; in order to initialise the file, but it is not necessary
69 ;; afterwards.
70 ;;
71 ;; As these commands are quite long to type, I would recommend
72 ;; the addition of two bindings to your to your global keymap. I
73 ;; personally have the following in my initialisation file:
74 ;;
75 ;; (global-set-key "\C-ct" 'todo-show) ;; switch to TODO buffer
76 ;; (global-set-key "\C-ci" 'todo-insert-item) ;; insert new item
77 ;;
78 ;; Note, however, that this recommendation has prompted some
79 ;; criticism, since the keys C-c LETTER are reserved for user
80 ;; functions. I believe my recommendation is acceptable, since
81 ;; the Emacs Lisp Manual *Tips* section also details that the
82 ;; mode itself should not bind any functions to those keys. The
83 ;; express aim of the above two bindings is to work outside the
84 ;; mode, which doesn't need the show function and offers a
85 ;; different binding for the insert function. They serve as
86 ;; shortcuts and are not even needed (since the TODO mode will be
87 ;; entered by visiting the TODO file, and later by switching to
88 ;; its buffer).
89 ;;
90 ;; If you are an advanced user of this package, please consult
91 ;; the whole source code for autoloads, because there are several
92 ;; extensions that are not explicitly listed in the above quick
93 ;; installation.
94 ;;
95 ;; Version
96 ;;
97 ;; Which version of todo-mode.el does this documentation refer to?
98 ;;
99 ;; $Id: todo-mode.el,v 1.33 1997/12/04 17:45:22 os10000 Exp os10000 $
100 ;;
101 ;; Pre-Requisites
102 ;;
103 ;; This package will require the following packages to be
104 ;; available on the load-path:
105 ;;
106 ;; time-stamp
107 ;; easymenu
108 ;;
109 ;; Operation
110 ;;
111 ;; You will have the following facilities available:
112 ;;
113 ;; M-x todo-show will enter the todo list screen, here type
114 ;;
115 ;; + to go to next category
116 ;; - to go to previous category
117 ;; d to file the current entry, including a
118 ;; comment and timestamp
119 ;; e to edit the current entry
120 ;; E to edit a multi-line entry
121 ;; f to file the current entry, including a
122 ;; comment and timestamp
123 ;; i to insert a new entry, with prefix, omit category
124 ;; I to insert a new entry at current cursor position
125 ;; j jump to category
126 ;; k to kill the current entry
127 ;; l to lower the current entry's priority
128 ;; n for the next entry
129 ;; p for the previous entry
130 ;; P print
131 ;; q to save the list and exit the buffer
132 ;; r to raise the current entry's priority
133 ;; s to save the list
134 ;; S to save the list of top priorities
135 ;; t show top priority items for each category
136 ;;
137 ;; When you add a new entry, you are asked for the text and then
138 ;; for the category. I for example have categories for things
139 ;; that I want to do in the office (like mail my mum), that I
140 ;; want to do in town (like buy cornflakes) and things I want to
141 ;; do at home (move my suitcases). The categories can be
142 ;; selected with the cursor keys and if you type in the name of a
143 ;; category which didn't exist before, an empty category of the
144 ;; desired name will be added and filled with the new entry.
145 ;;
146 ;; Configuration
147 ;;
148 ;; Variable todo-prefix
149 ;;
150 ;; I would like to recommend that you use the prefix "*/*" (by
151 ;; leaving the variable 'todo-prefix' untouched) so that the
152 ;; diary displays each entry every day.
153 ;;
154 ;; To understand what I mean, please read the documentation that
155 ;; goes with the calendar since that will tell you how you can
156 ;; set up the fancy diary display and use the #include command to
157 ;; include your todo list file as part of your diary.
158 ;;
159 ;; If you have the diary package set up to usually display more
160 ;; than one day's entries at once, consider using
161 ;;
162 ;; "&%%(equal (calendar-current-date) date)"
163 ;;
164 ;; as the value of `todo-prefix'. Please note that this may slow
165 ;; down the processing of your diary file some.
166 ;;
167 ;; Carsten Dominik <dominik@strw.LeidenUniv.nl> suggested that
168 ;;
169 ;; "&%%(todo-cp)"
170 ;;
171 ;; might be nicer and to that effect a function has been declared
172 ;; further down in the code. You may wish to auto-load this.
173 ;;
174 ;; Carsten also writes that that *changing* the prefix after the
175 ;; todo list is already established is not as simple as changing
176 ;; the variable - the todo files have to be changed by hand.
177 ;;
178 ;; Variable todo-file-do
179 ;;
180 ;; This variable is fairly self-explanatory. You have to store
181 ;; your TODO list somewhere. This variable tells the package
182 ;; where to go and find this file.
183 ;;
184 ;; Variable todo-file-done
185 ;;
186 ;; Even when you're done, you may wish to retain the entries.
187 ;; Given that they're timestamped and you are offered to add a
188 ;; comment, this can make a useful diary of past events. It will
189 ;; even blend in with the EMACS diary package. So anyway, this
190 ;; variable holds the name of the file for the filed todo-items.
191 ;;
192 ;; Variable todo-file-top
193 ;;
194 ;; File storing the top priorities of your TODO list when
195 ;; todo-save-top-priorities is non-nil. Nice to include in your
196 ;; diary instead of the complete TODO list.
197 ;;
198 ;; Variable todo-mode-hook
199 ;;
200 ;; Just like other modes, too, this mode offers to call your
201 ;; functions before it goes about its business. This variable
202 ;; will be inspected for any functions you may wish to have
203 ;; called once the other TODO mode preparations have been
204 ;; completed.
205 ;;
206 ;; Variable todo-insert-threshold
207 ;;
208 ;; Another nifty feature is the insertion accuracy. If you have
209 ;; 8 items in your TODO list, then you may get asked 4 questions
210 ;; by the binary insertion algorithm. However, you may not
211 ;; really have a need for such accurate priorities amongst your
212 ;; TODO items. If you now think about the binary insertion
213 ;; halfing the size of the window each time, then the threshhold
214 ;; is the window size at which it will stop. If you set the
215 ;; threshhold to zero, the upper and lower bound will coincide at
216 ;; the end of the loop and you will insert your item just before
217 ;; that point. If you set the threshhold to, e.g. 8, it will stop
218 ;; as soon as the window size drops below that amount and will
219 ;; insert the item in the approximate centre of that window. I
220 ;; got the idea for this feature after reading a very helpful
221 ;; e-mail reply from Trey Jackson <trey@cs.berkeley.edu> who
222 ;; corrected some of my awful coding and pointed me towards some
223 ;; good reading. Thanks Trey!
224 ;;
225 ;; Things to do
226 ;;
227 ;; These originally were my ideas, but now also include all the
228 ;; suggestions that I included before forgetting them:
229 ;;
230 ;; o Fancy fonts for todo/top-priority buffer
231 ;; o Remove todo-prefix option in todo-top-priorities
232 ;; o Rename category
233 ;; o Move entry from one category to another one
234 ;; o Entries which both have the generic */* prefix and a
235 ;; "deadline" entry which are understood by diary, indicating
236 ;; an event (unless marked by &)
237 ;; o The optional COUNT variable of todo-forward-item should be
238 ;; applied to the other functions performing similar tasks
239 ;; o Modularization could be done for repeaded elements of
240 ;; the code, like the completing-read lines of code.
241 ;; o license / version function
242 ;; o export to diary file
243 ;; o todo-report-bug
244 ;; o GNATS support
245 ;; o elide multiline (as in bbdb, or, to a lesser degree, in
246 ;; outline mode)
247 ;; o rewrite complete package to store data as lisp objects
248 ;; and have display modes for display, for diary export,
249 ;; etc. (Richard Stallman pointed out this is a bad idea)
250 ;; o so base todo-mode.el on generic-mode.el instead
251 ;;
252 ;; History and Gossip
253 ;;
254 ;; Many thanks to all the ones who have contributed to the
255 ;; evolution of this package! I hope I have listed all of you
256 ;; somewhere in the documentation or at least in the RCS history!
257 ;;
258 ;; Enjoy this package and express your gratitude by sending nice
259 ;; things to my parents' address!
260 ;;
261 ;; Oliver Seidel
262 ;; (Lessingstr. 8, 65760 Eschborn, Federal Republic of Germany)
263 ;;
264
265 ;; ---------------------------------------------------------------------------
266
267 ;;; Change Log:
268
269 ;; $Log: todo-mode.el,v $
270 ;; Revision 1.33 1997/12/04 17:45:22 os10000
271 ;; Another patch by Michael Cook to fix annotation.
272 ;;
273 ;; Revision 1.32 1997/12/03 12:18:20 os10000
274 ;; Added category patch by Michael R Cook <mcook@cognex.com>.
275 ;;
276 ;; Revision 1.31 1997/10/28 22:16:24 os10000
277 ;; Three insertion options:
278 ;; i without prefix: ask for category, do binary insertion
279 ;; i with prefix: do binary insertion in current category
280 ;; uppercase I: insert directly under cursor
281 ;;
282 ;; Revision 1.30 1997/10/28 21:59:48 os10000
283 ;; Improved documentation, fixed insertion with prefix.
284 ;;
285 ;; Revision 1.29 1997/10/28 21:47:12 os10000
286 ;; Implemented "insert-under-cursor" as suggested by
287 ;; Kai Grossjohann <grossjohann@ls6.cs.uni-dortmund.de>.
288 ;;
289 ;; Revision 1.28 1997/10/28 21:37:05 os10000
290 ;; Incorporated simplifying suggestions from
291 ;; Carsten Dominik <dominik@strw.LeidenUniv.nl>.
292 ;;
293 ;; Revision 1.27 1997/10/28 21:26:55 os10000
294 ;; Patch from Paul Stodghill <stodghil@CS.Cornell.EDU>:
295 ;; The patch below fixes todo-insert-item so that it will
296 ;; insert the item in place, instead of at the top of the
297 ;; buffer, when invoked with a prefix argument.
298 ;;
299 ;; Revision 1.26 1997/10/28 21:14:51 os10000
300 ;; Improvements sent in by Dave Love <d.love@dl.ac.uk>:
301 ;; todo-mode.el: Doc fixes. Customization.
302 ;; (todo-add-item-non-interactively): New arg -- don't dynamically bind ARG.
303 ;; (todo-insert-item): Use it.
304 ;;
305 ;; Revision 1.25 1997/10/28 20:03:27 os10000
306 ;; Harald Backer <harald.backer@fou.telenor.no> sent the following:
307 ;; Added `todo-save-top-priorities' and option to automatically save top
308 ;; priorities file when saving todo-file. Changed some default values.
309 ;; Bug fixes.
310 ;;
311 ;; Revision 1.24 1997/10/28 19:41:53 os10000
312 ;; Added fix from Frank Ridderbusch <ridderbusch.pad@sni.de>,
313 ;; an apostrophe was missing.
314 ;;
315 ;; Revision 1.23 1997/10/24 17:30:54 os10000
316 ;; Added three suggestions from Carsten
317 ;; Dominik <dominik@strw.LeidenUniv.nl>:
318 ;;
319 ;; - recommend autoloading instead of require
320 ;; - inserting from different buffer didn't work
321 ;; (now fixed -- I pray)
322 ;; - provided public entry point to insert items
323 ;; from normal lisp code
324 ;;
325 ;; Revision 1.22 1997/10/24 16:53:20 os10000
326 ;; Paul Stodghill <stodghil@CS.Cornell.EDU> writes:
327 ;;
328 ;; When invoked with a prefix, todo-insert-item
329 ;; should not prompt for a category. (He adds:
330 ;; At least that's what I think.)
331 ;;
332 ;; Revision 1.21 1997/10/24 16:51:02 os10000
333 ;; Rafael Laboissiere <rafael@icp.inpg.fr> writes:
334 ;;
335 ;; I was just annoyed with the fact that there is no way
336 ;; to dynamically control the insertion accuracy. I mean:
337 ;; the variable `todo-insert-threshold' does the job, but
338 ;; it is not very handy if one wants to mix the two
339 ;; behaviors (bisection and "insert right here under the
340 ;; cursor").
341 ;;
342 ;; Therefore I did a quick hack in the function
343 ;; `todo-insert-item'. Now by giving a prefix argument to
344 ;; the insert command (i.e. by typing "C-u i"), entries
345 ;; are inserted exactly at the line where the cursor is.
346 ;; It would be better to give the value of
347 ;; `todo-insert-threshold' as a numeric argument of
348 ;; `todo-insert-item' (like "M-8 i"), but it's too late
349 ;; now for continuing to hack.
350 ;;
351 ;; Revision 1.20 1997/10/17 15:41:57 os10000
352 ;; Thanks to Harald Backer <harald.backer@fou.telenor.no>, we now have
353 ;; the following facilities available:
354 ;;
355 ;; Added todo-print, todo-top-priorities and todo-jump with matching
356 ;; variables; Parameterized todo-header, todo-category-beg,
357 ;; todo-category-end and todo-category-sep; Added autoload comments;
358 ;; todo-category-select: Modified regexp to make category names unique;
359 ;; todo-forward-item: Added optional COUNT vaiable; todo-insert-item:
360 ;; Rewrote completing read entry.
361 ;;
362 ;; Also, check out the extended list of things left to be done to this
363 ;; package at the end of the documentation!
364 ;;
365 ;; Revision 1.19 1997/10/16 21:21:16 os10000
366 ;; Jari Aalto <jari.aalto@poboxes.com> writes:
367 ;;
368 ;; I just downloaded your package and after reading the docs I
369 ;; decided to do some reformatting. Hope you don't mind. Now
370 ;; they are in such a format that the html page can be
371 ;; automatically generated from the source file. As an example, I
372 ;; generated the attached page using the following command:
373 ;; ripdoc.pls < todo-mode.el | t2html.pls -a "Oliver.Seidel" -e \
374 ;; Oliver.Seidel@cl.cam.ac.uk -simple -base
375 ;;
376 ;; And of course I appreciate it. Jari's stuff can be found at:
377 ;; ftp://cs.uta.fi/pub/ssjaaa/, while I'm making the rev 1.18 page
378 ;; available at http://www.cl.cam.ac.uk/users/os10000/doc/todo-mode.html
379 ;; (That link will be valid until 10/1998 or slightly longer.)
380 ;;
381 ;; Revision 1.18 1997/10/15 17:18:11 os10000
382 ;; Everything seems to work in Harald Melands Emacs 20.02 and
383 ;; my Emacs 19.34. Beware of the spelling in some of the
384 ;; variable names. I looked up "threshold" in a dictionary
385 ;; and here in Britain this appears to be the way to spell it.
386 ;;
387 ;; Revision 1.17 1997/10/15 14:30:41 os10000
388 ;; Attempted to reconcile Harald's changes with mine since 1.15.
389 ;;
390 ;; Revision 1.16 1997/10/15 14:00:12 os10000
391 ;; Fixed 'file-item' and added 20.02 split-string function.
392 ;;
393 ;; Revision 1.15 1997/10/14 22:22:35 os10000
394 ;; Added string-split (which I stole from ediff-util), changed
395 ;; pop-to-buffer to switch-to-buffer and added message on how
396 ;; to exit the multi-line-edit mode.
397 ;;
398 ;; Revision 1.14 1997/10/09 09:24:50 os10000
399 ;; Harald Meland <harald.meland@usit.uio.no> asked for
400 ;; the latest version, got 1.13, and returned this.
401 ;; He writes:
402 ;;
403 ;; Thanks a lot for the new version of todo-mode.el. As you will see I
404 ;; have messed it up a bit, hopefully for the better -- I don't like
405 ;; short, cryptic names for variables and functions, so I renamed most of
406 ;; them, and `defalias'ed the old function names. I hope you don't mind
407 ;; too much, I just kinda couldn't stop myself.
408 ;;
409 ;; Additionally, I included some support for multiline entries, cleaned
410 ;; up (IMHO :) a lot of the code, included completion-support for which
411 ;; category to install a new entry in, and possibly some other changes I
412 ;; can't remember :)
413 ;;
414 ;; It's getting rather late, and I have just done some preliminary
415 ;; testing on whether all of this really works, but so far it looks
416 ;; good.
417 ;;
418 ;; Revision 1.13 1997/08/19 14:00:36 seidel
419 ;; - changed name to todo-mode
420 ;; - fixed menu descriptions
421 ;; - fixed "pressing abort while filing"
422 ;; - attempted Emacs Lisp Manual *Tips* section compliance
423 ;;
424 ;; Revision 1.12 1997/08/06 10:56:15 os10000
425 ;; Fixed header, typos, layout, documentation.
426 ;;
427 ;; Revision 1.11 1997/08/06 09:14:25 os10000
428 ;; Applied patch from Istvan Marko <istvan@cmdmail.amd.com>
429 ;; to make menus work anywhere.
430 ;;
431 ;; Revision 1.10 1997/08/06 08:56:03 os10000
432 ;; Acted upon suggestion from Shane Holder <holder@rsn.hp.com>:
433 ;; Cancelling the editing of an entry will not delete it any more.
434 ;;
435 ;; Revision 1.9 1997/08/06 08:12:03 os10000
436 ;; Improved documentation. Broke some lines to comply with
437 ;; Richard Stallman's email to please keep in sync with the
438 ;; rest of the Emacs distribution files.
439 ;;
440 ;; Revision 1.8 1997/08/05 22:39:04 os10000
441 ;; Made todo-mode.el available under GPL.
442 ;;
443 ;; Revision 1.7 1997/08/05 22:34:14 os10000
444 ;; Fixed insertion routine with help from Trey Jackson
445 ;; <trey@cs.berkeley.edu>; added todo-inst-tresh;
446 ;; fixed keyboard layout to remove unwanted keys.
447 ;;
448 ;; Revision 1.6 1997/08/05 16:47:01 os10000
449 ;; Incorporated menus for XEmacs from Allan.Cochrane@soton.sc.philips.com,
450 ;; fixed TYPO, fixed todo-file-cmd, cleaned up rcs history.
451 ;;
452 ;; Revision 1.5 1997/08/05 14:43:39 os10000
453 ;; Added improvements from Ron Gut <rgut@aware.com>.
454 ;; Added category management.
455 ;;
456 ;; Revision 1.4 1997/08/04 16:18:45 os10000
457 ;; Added Raise/Lower item.
458 ;;
459 ;; Revision 1.3 1997/08/03 12:47:26 os10000
460 ;; Cleaned up variables, prefix and cursor position.
461 ;;
462 ;; Revision 1.2 1997/08/03 12:15:28 os10000
463 ;; It appears to work.
464 ;;
465 ;; Revision 1.1 1997/08/03 12:15:13 os10000
466 ;; Initial revision
467 ;;
468
469 ;; ---------------------------------------------------------------------------
470
471 ;;; Code:
472
473 (eval-and-compile ; Removable for installation in
474 ; Emacs 20.
475 (condition-case ()
476 (require 'custom)
477 (error nil))
478 (if (and (featurep 'custom) (fboundp 'custom-declare-variable))
479 nil ;; We've got what we needed
480 ;; We have the old custom-library, hack around it!
481 (defmacro defgroup (&rest args)
482 nil)
483 (defmacro defcustom (var value doc &rest args)
484 (` (defvar (, var) (, value) (, doc))))))
485
486 ;; User-configurable variables:
487
488 (defgroup todo nil
489 "Maintain a list of todo items."
490 :group 'calendar)
491
492 (defcustom todo-prefix "*/*"
493 "*TODO mode prefix for entries.
494
495 This is useful in conjunction with `calendar' and `diary' if you use
496
497 #include \"~/.todo-do\"
498
499 in your diary file to include your todo list file as part of your
500 diary. With the default value \"*/*\" the diary displays each entry
501 every day and it may also be marked on every day of the calendar.
502 Using \"&%%(equal (calendar-current-date) date)\" instead will only
503 show and mark todo entreis for today, but may slow down processing of
504 the diary file somewhat."
505 :type 'string
506 :group 'todo)
507 (defcustom todo-file-do "~/.todo-do"
508 "*TODO mode list file."
509 :type 'file
510 :group 'todo)
511 (defcustom todo-file-done "~/.todo-done"
512 "*TODO mode archive file."
513 :type 'file
514 :group 'todo)
515 (defcustom todo-mode-hook nil
516 "*TODO mode hooks."
517 :type 'hook
518 :group 'todo)
519 (defcustom todo-edit-mode-hook nil
520 "*TODO Edit mode hooks."
521 :type 'hook
522 :group 'todo)
523 (defcustom todo-insert-threshold 0
524 "*TODO mode insertion accuracy.
525
526 If you have 8 items in your TODO list, then you may get asked 4
527 questions by the binary insertion algorithm. However, you may not
528 really have a need for such accurate priorities amongst your TODO
529 items. If you now think about the binary insertion halfing the size
530 of the window each time, then the threshhold is the window size at
531 which it will stop. If you set the threshhold to zero, the upper and
532 lower bound will coincide at the end of the loop and you will insert
533 your item just before that point. If you set the threshhold to,
534 e.g. 8, it will stop as soon as the window size drops below that
535 amount and will insert the item in the approximate centre of that
536 window."
537 :type 'integer
538 :group 'todo)
539 (defvar todo-edit-buffer " *TODO Edit*" "TODO Edit buffer name.")
540 (defcustom todo-file-top "~/.todo-top"
541 "*TODO mode top priorities file.
542
543 Not in TODO format, but diary compatible.
544 Automatically generated when `todo-save-top-priorities' is non-nil."
545 :type 'string
546 :group 'todo)
547
548 (defcustom todo-print-function 'ps-print-buffer-with-faces
549 "*Function to print the current buffer."
550 :type 'symbol
551 :group 'todo)
552 (defcustom todo-show-priorities 1
553 "*Default number of priorities to show by \\[todo-top-priorities].
554 0 means show all entries."
555 :type 'integer
556 :group 'todo)
557 (defcustom todo-print-priorities 0
558 "*Default number of priorities to print by \\[todo-print].
559 0 means print all entries."
560 :type 'integer
561 :group 'todo)
562 (defcustom todo-remove-separator t
563 "*Non-nil to remove category separators in\
564 \\[todo-top-priorities] and \\[todo-print]."
565 :type 'boolean
566 :group 'todo)
567 (defcustom todo-save-top-priorities-too t
568 "*Non-nil makes todo-save automatically save top-priorities in
569 `todo-file-top'."
570 :type 'boolean
571 :group 'todo)
572
573 ;; Thanks for the ISO time stamp format go to Karl Eichwalder <ke@suse.de>
574 ;; My format string for the appt.el package is "%3b %2d, %y, %02I:%02M%p".
575 ;;
576 (defcustom todo-time-string-format
577 "%:y-%02m-%02d %02H:%02M"
578 "*TODO mode time string format for done entries.
579 For details see the variable `time-stamp-format'."
580 :type 'string
581 :group 'todo)
582
583 (defcustom todo-entry-prefix-function 'todo-entry-timestamp-initials
584 "*Function producing text to insert at start of todo entry."
585 :type 'symbol
586 :group 'todo)
587 (defcustom todo-initials (or (getenv "INITIALS") (user-login-name))
588 "*Initials of todo item author."
589 :type 'string
590 :group 'todo)
591
592 (defun todo-entry-timestamp-initials ()
593 "Prepend timestamp and your initials to the head of a TODO entry."
594 (let ((time-stamp-format todo-time-string-format))
595 (concat (time-stamp-string) " " todo-initials ": ")))
596
597 ;; ---------------------------------------------------------------------------
598
599 ;; Get some outside help ...
600
601 (require 'time-stamp)
602 (require 'easymenu)
603
604 ;; ---------------------------------------------------------------------------
605
606 ;; Set up some helpful context ...
607
608 (defvar todo-categories nil "TODO categories.")
609 (defvar todo-cats nil
610 "Old variable for holding the TODO categories.
611 Use `todo-categories' instead.")
612 (defvar todo-previous-line 0 "Previous line that I asked about.")
613 (defvar todo-previous-answer 0 "Previous answer that I got.")
614 (defvar todo-mode-map nil "TODO mode keymap.")
615 (defvar todo-category-number 0 "TODO category number.")
616
617 (defvar todo-tmp-buffer-name "*Tmp*")
618
619 (defvar todo-category-sep (make-string 75 ?-)
620 "Category separator.")
621 (defvar todo-category-beg " --- "
622 "Category start separator to be prepended onto category name.")
623 (defvar todo-category-end "--- End"
624 "Separator after a category.")
625 (defvar todo-header "-*- mode: todo; "
626 "Header of todo files.")
627
628
629
630 ;; ---------------------------------------------------------------------------
631
632 (if todo-mode-map
633 nil
634 (let ((map (make-keymap)))
635 (suppress-keymap map t)
636 (define-key map "+" 'todo-forward-category)
637 (define-key map "-" 'todo-backward-category)
638 (define-key map "d" 'todo-file-item) ;done/delete
639 (define-key map "e" 'todo-edit-item)
640 (define-key map "E" 'todo-edit-multiline)
641 (define-key map "f" 'todo-file-item)
642 (define-key map "i" 'todo-insert-item)
643 (define-key map "I" 'todo-insert-item-here)
644 (define-key map "j" 'todo-jump-to-category)
645 (define-key map "k" 'todo-delete-item)
646 (define-key map "l" 'todo-lower-item)
647 (define-key map "n" 'todo-forward-item)
648 (define-key map "p" 'todo-backward-item)
649 (define-key map "P" 'todo-print)
650 (define-key map "q" 'todo-quit)
651 (define-key map "r" 'todo-raise-item)
652 (define-key map "s" 'todo-save)
653 (define-key map "S" 'todo-save-top-priorities)
654 (define-key map "t" 'todo-top-priorities)
655 (setq todo-mode-map map)))
656
657 (defun todo-category-select ()
658 "Make TODO mode display the current category correctly."
659 (let ((name (nth todo-category-number todo-categories)))
660 (setq mode-line-buffer-identification
661 ;; (concat "Category: " name))
662 (concat "Category: " (format "%18s" name)))
663 (widen)
664 (goto-char (point-min))
665 (search-forward-regexp
666 (concat "^"
667 (regexp-quote (concat todo-prefix todo-category-beg name))
668 "$"))
669 (let ((begin (1+ (point-at-eol))))
670 (search-forward-regexp (concat "^" todo-category-end))
671 (narrow-to-region begin (point-at-bol))
672 (goto-char (point-min)))))
673 (defalias 'todo-cat-slct 'todo-category-select)
674
675 (defun todo-forward-category () "Go forward to TODO list of next category."
676 (interactive)
677 (setq todo-category-number
678 (mod (1+ todo-category-number) (length todo-categories)))
679 (todo-category-select))
680 (defalias 'todo-cmd-forw 'todo-forward-category)
681
682 (defun todo-backward-category () "Go back to TODO list of previous category."
683 (interactive)
684 (setq todo-category-number
685 (mod (1- todo-category-number) (length todo-categories)))
686 (todo-category-select))
687 (defalias 'todo-cmd-back 'todo-backward-category)
688
689 (defun todo-backward-item () "Select previous entry of TODO list."
690 (interactive)
691 (search-backward-regexp (concat "^" (regexp-quote todo-prefix)) nil t)
692 (message ""))
693 (defalias 'todo-cmd-prev 'todo-backward-item)
694
695 (defun todo-forward-item (&optional count)
696 "Select COUNT-th next entry of TODO list."
697 (interactive "P")
698 (if (listp count) (setq count (car count)))
699 (end-of-line)
700 (search-forward-regexp (concat "^" (regexp-quote todo-prefix))
701 nil 'goto-end count)
702 (beginning-of-line)
703 (message ""))
704 (defalias 'todo-cmd-next 'todo-forward-item)
705
706 (defun todo-save () "Save the TODO list."
707 (interactive)
708 (save-buffer)
709 (if todo-save-top-priorities-too (todo-save-top-priorities))
710 )
711 (defalias 'todo-cmd-save 'todo-save)
712
713 (defun todo-quit () "Done with TODO list for now."
714 (interactive)
715 (widen)
716 (todo-save)
717 (message "")
718 (bury-buffer))
719 (defalias 'todo-cmd-done 'todo-quit)
720
721 (defun todo-edit-item () "Edit current TODO list entry."
722 (interactive)
723 (let ((item (todo-item-string)))
724 (if (todo-string-multiline-p item)
725 (todo-edit-multiline)
726 (let ((new (read-from-minibuffer "Edit: " item)))
727 (todo-remove-item)
728 (insert new "\n")
729 (todo-backward-item)
730 (message "")))))
731 (defalias 'todo-cmd-edit 'todo-edit-item)
732
733 (defun todo-edit-multiline ()
734 "Set up a buffer for editing a multiline TODO list entry."
735 (interactive)
736 (let ((buffer-name (generate-new-buffer-name todo-edit-buffer)))
737 (switch-to-buffer
738 (make-indirect-buffer
739 (file-name-nondirectory todo-file-do) buffer-name))
740 (message "To exit, simply kill this buffer and return to list.")
741 (todo-edit-mode)
742 (narrow-to-region (todo-item-start) (todo-item-end))))
743
744 ;;;### autoload
745 (defun todo-add-category (cat)
746 "Add new category CAT to the TODO list."
747 (interactive "sCategory: ")
748 (save-window-excursion
749 (setq todo-categories (cons cat todo-categories))
750 (find-file todo-file-do)
751 (widen)
752 (goto-char (point-min))
753 (let ((posn (search-forward "-*- mode: todo; " 17 t)))
754 (if (not (null posn)) (goto-char posn))
755 (if (equal posn nil)
756 (progn
757 (insert "-*- mode: todo; \n")
758 (forward-char -1))
759 (kill-line)))
760 (insert (format "todo-categories: %S; -*-" todo-categories))
761 (forward-char 1)
762 (insert (format "%s%s%s\n%s\n%s %s\n"
763 todo-prefix todo-category-beg cat
764 todo-category-end
765 todo-prefix todo-category-sep)))
766 0)
767
768 ;;;### autoload
769 (defun todo-add-item-non-interactively (new-item category)
770 "Insert NEW-ITEM in TODO list as a new entry in CATEGORY."
771 (save-excursion
772 (todo-show))
773 (save-excursion
774 (if (string= "" category)
775 (setq category (nth todo-category-number todo-categories)))
776 (let ((cat-exists (member category todo-categories)))
777 (setq todo-category-number
778 (if cat-exists
779 (- (length todo-categories) (length cat-exists))
780 (todo-add-category category))))
781 (todo-show)
782 (setq todo-previous-line 0)
783 (let ((top 1)
784 (bottom (1+ (count-lines (point-min) (point-max)))))
785 (while (> (- bottom top) todo-insert-threshold)
786 (let* ((current (/ (+ top bottom) 2))
787 (answer (if (< current bottom)
788 (todo-more-important-p current) nil)))
789 (if answer
790 (setq bottom current)
791 (setq top (1+ current)))))
792 (setq top (/ (+ top bottom) 2))
793 ;; goto-line doesn't have the desired behavior in a narrowed buffer
794 (goto-char (point-min))
795 (forward-line (1- top)))
796 (insert new-item "\n")
797 (todo-backward-item)
798 (todo-save)
799 (message "")))
800
801 ;;;### autoload
802 (defun todo-insert-item (ARG)
803 "Insert new TODO list entry.
804 With a prefix argument solicit the category, otherwise use the current
805 category."
806 (interactive "P")
807 (save-excursion
808 (if (not (string-equal mode-name "TODO")) (todo-show))
809 (let* ((new-item (concat todo-prefix " "
810 (read-from-minibuffer
811 "New TODO entry: "
812 (if todo-entry-prefix-function
813 (funcall todo-entry-prefix-function)))))
814 (categories todo-categories)
815 (history (cons 'categories (1+ todo-category-number)))
816 (current-category (nth todo-category-number todo-categories))
817 (category
818 (if ARG
819 current-category
820 (completing-read
821 (concat "Category ["
822 current-category "]: ")
823 (todo-category-alist) nil nil nil history))))
824 (todo-add-item-non-interactively new-item category))))
825
826 (defalias 'todo-cmd-inst 'todo-insert-item)
827
828 ;;;### autoload
829 (defun todo-insert-item-here ()
830 "Insert new TODO list entry under the cursor."
831 (interactive "")
832 (save-excursion
833 (if (not (string-equal mode-name "TODO")) (todo-show))
834 (let* ((new-item (concat todo-prefix " "
835 (read-from-minibuffer
836 "New TODO entry: "
837 (if todo-entry-prefix-function
838 (funcall todo-entry-prefix-function))))))
839 (insert (concat new-item "\n")))))
840
841 (defun todo-more-important-p (line)
842 "Ask whether entry is more important than the one at LINE."
843 (if (not (equal todo-previous-line line))
844 (progn
845 (setq todo-previous-line line)
846 (goto-char (point-min))
847 (forward-line (1- todo-previous-line))
848 (let ((item (todo-item-string-start)))
849 (setq todo-previous-answer
850 (y-or-n-p (concat "More important than '" item "'? "))))))
851 todo-previous-answer)
852 (defalias 'todo-ask-p 'todo-more-important-p)
853
854 (defun todo-delete-item () "Delete current TODO list entry."
855 (interactive)
856 (if (> (count-lines (point-min) (point-max)) 0)
857 (let* ((todo-entry (todo-item-string-start))
858 (todo-answer (y-or-n-p (concat "Permanently remove '"
859 todo-entry "'? "))))
860 (if todo-answer
861 (progn
862 (todo-remove-item)
863 (todo-backward-item)))
864 (message ""))
865 (error "No TODO list entry to delete")))
866 (defalias 'todo-cmd-kill 'todo-delete-item)
867
868 (defun todo-raise-item () "Raise priority of current entry."
869 (interactive)
870 (if (> (count-lines (point-min) (point)) 0)
871 (let ((item (todo-item-string)))
872 (todo-remove-item)
873 (todo-backward-item)
874 (save-excursion
875 (insert item "\n"))
876 (message ""))
877 (error "No TODO list entry to raise")))
878 (defalias 'todo-cmd-rais 'todo-raise-item)
879
880 (defun todo-lower-item () "Lower priority of current entry."
881 (interactive)
882 (if (> (count-lines (point) (point-max)) 1)
883 ;; Assume there is a final newline
884 (let ((item (todo-item-string)))
885 (todo-remove-item)
886 (todo-forward-item)
887 (save-excursion
888 (insert item "\n"))
889 (message ""))
890 (error "No TODO list entry to lower")))
891 (defalias 'todo-cmd-lowr 'todo-lower-item)
892
893 (defun todo-file-item (&optional comment)
894 "File the current TODO list entry away,
895 annotated with an optional COMMENT."
896 (interactive "sComment: ")
897 (or (> (count-lines (point-min) (point-max)) 0)
898 (error "No TODO list entry to file away"))
899 (let ((time-stamp-format todo-time-string-format))
900 (if (and comment (> (length comment) 0))
901 (progn
902 (goto-char (todo-item-end))
903 (insert
904 (if (save-excursion (beginning-of-line)
905 (looking-at (regexp-quote todo-prefix)))
906 " "
907 "\n\t")
908 "(" comment ")")))
909 (goto-char (todo-item-end))
910 (insert " [" (nth todo-category-number todo-categories) "]")
911 (goto-char (todo-item-start))
912 (let ((temp-point (point)))
913 (if (looking-at (regexp-quote todo-prefix))
914 (replace-match (time-stamp-string))
915 ;; Standard prefix -> timestamp
916 ;; Else prefix non-standard item start with timestamp
917 (insert (time-stamp-string)))
918 (append-to-file temp-point (1+ (todo-item-end)) todo-file-done)
919 (delete-region temp-point (1+ (todo-item-end))))
920 (todo-backward-item)
921 (message "")))
922
923 ;; ---------------------------------------------------------------------------
924
925 ;; Utility functions:
926
927
928 ;;;###autoload
929 (defun todo-top-priorities (&optional nof-priorities category-pr-page)
930 "List top priorities for each category.
931
932 Number of entries for each category is given by NOF-PRIORITIES which
933 defaults to \'todo-show-priorities\'.
934
935 If CATEGORY-PR-PAGE is non-nil, a page separator \'^L\' is inserted
936 between each category."
937
938 (interactive "P")
939 (or nof-priorities (setq nof-priorities todo-show-priorities))
940 (if (listp nof-priorities) ;universal argument
941 (setq nof-priorities (car nof-priorities)))
942 (let ((todo-print-buffer-name "*Tmp*")
943 ;;(todo-print-category-number 0)
944 (todo-category-break (if category-pr-page "\f" ""))
945 (cat-end
946 (concat
947 (if todo-remove-separator
948 (concat todo-category-end "\n"
949 (regexp-quote todo-prefix) " " todo-category-sep "\n")
950 (concat todo-category-end "\n"))))
951 beg end)
952 (todo-show)
953 (save-excursion
954 (save-restriction
955 (widen)
956 (copy-to-buffer todo-print-buffer-name (point-min) (point-max))
957 (set-buffer todo-print-buffer-name)
958 (goto-char (point-min))
959 (if (re-search-forward (regexp-quote todo-header) nil t)
960 (progn
961 (beginning-of-line 1)
962 (kill-line))) ;Remove mode line
963 (while (re-search-forward ;Find category start
964 (regexp-quote (concat todo-prefix todo-category-beg))
965 nil t)
966 (setq beg (+ (point-at-eol) 1)) ;Start of first entry.
967 (re-search-forward cat-end nil t)
968 (setq end (match-beginning 0))
969 (replace-match todo-category-break)
970 (narrow-to-region beg end) ;In case we have too few entries.
971 (goto-char (point-min))
972 (if (= 0 nof-priorities) ;Traverse entries.
973 (goto-char end) ;All entries
974 (todo-forward-item nof-priorities))
975 (setq beg (point))
976 (delete-region beg end)
977 (widen))
978 (and (looking-at "\f") (replace-match "")) ;Remove trailing form-feed.
979 (goto-char (point-min)) ;Due to display buffer
980 ))
981 ;; Could have used switch-to-buffer as it has a norecord argument,
982 ;; which is nice when we are called from e.g. todo-print.
983 ;; Else we could have used pop-to-buffer.
984 (display-buffer todo-print-buffer-name)
985 (message "Type C-x 1 to remove %s window. M-C-v to scroll the help."
986 todo-print-buffer-name)
987 ))
988
989 ;;;###autoload
990 (defun todo-save-top-priorities (&optional nof-priorities)
991 "Save top priorities for each category in `todo-file-top'.
992
993 Number of entries for each category is given by NOF-PRIORITIES which
994 defaults to `todo-show-priorities'."
995 (interactive "P")
996 (save-window-excursion
997 (save-excursion
998 (save-restriction
999 (todo-top-priorities nof-priorities)
1000 (set-buffer todo-tmp-buffer-name)
1001 (write-file todo-file-top)
1002 (kill-this-buffer)
1003 ))))
1004
1005 ;;;###autoload
1006 (defun todo-print (&optional category-pr-page)
1007 "Print todo summary using \\\[todo-print-function].
1008 If CATEGORY-PR-PAGE is non-nil, a page separator \'^L\' is inserted
1009 between each category.
1010
1011 Number of entries for each category is given by
1012 \'todo-print-priorities\'."
1013 (interactive "P")
1014 (if todo-print-function
1015 (progn
1016 (save-window-excursion
1017 (save-excursion
1018 (save-restriction
1019 (todo-top-priorities todo-print-priorities
1020 category-pr-page)
1021 (set-buffer todo-tmp-buffer-name)
1022 (and (funcall todo-print-function)
1023 (kill-this-buffer))
1024 (message "Todo printing done."))
1025 )))
1026 (message "todo-print-function undefinded")
1027 ))
1028
1029 (defun todo-jump-to-category ()
1030 "Jump to a category. Default is previous category."
1031 (interactive)
1032 (let* ((categories todo-categories)
1033 (history (cons 'categories (1+ todo-category-number)))
1034 (category (completing-read
1035 (concat "Category ["
1036 (nth todo-category-number todo-categories) "]: ")
1037 (todo-category-alist) nil nil nil history)))
1038 (if (string= "" category)
1039 (setq category (nth todo-category-number todo-categories)))
1040 (setq todo-category-number
1041 (if (member category todo-categories)
1042 (- (length todo-categories)
1043 (length (member category todo-categories)))
1044 (todo-add-category category)))
1045 (todo-show)))
1046
1047 (defun todo-line-string () "Return current line in buffer as a string."
1048 (buffer-substring (point-at-bol) (point-at-eol)))
1049
1050 (defun todo-item-string-start ()
1051 "Return the start of this TODO list entry as a string."
1052 ;; Suitable for putting in the minibuffer when asking the user
1053 (let ((item (todo-item-string)))
1054 (if (> (length item) 60)
1055 (setq item (concat (substring item 0 56) "...")))
1056 item))
1057
1058 (defun todo-item-start () "Return point at start of current TODO list item."
1059 (save-excursion
1060 (beginning-of-line)
1061 (if (not (looking-at (regexp-quote todo-prefix)))
1062 (search-backward-regexp
1063 (concat "^" (regexp-quote todo-prefix)) nil t))
1064 (point)))
1065
1066 (defun todo-item-end () "Return point at end of current TODO list item."
1067 (save-excursion
1068 (end-of-line)
1069 (search-forward-regexp
1070 (concat "^" (regexp-quote todo-prefix)) nil 'goto-end)
1071 (1- (point-at-bol))))
1072
1073 (defun todo-remove-item () "Delete the current entry from the TODO list."
1074 (delete-region (todo-item-start) (1+ (todo-item-end))))
1075
1076 (defun todo-item-string () "Return current TODO list entry as a string."
1077 (buffer-substring (todo-item-start) (todo-item-end)))
1078
1079 (defun todo-string-count-lines (string)
1080 "Return the number of lines STRING spans."
1081 (length (split-string string "\n")))
1082
1083 (defun todo-string-multiline-p (string)
1084 "Return non-nil if STRING spans several lines."
1085 (> (todo-string-count-lines string) 1))
1086
1087 (defun todo-category-alist ()
1088 "Generate an alist for use in `completing-read' from `todo-categories'."
1089 (mapcar (lambda (cat) (cons cat nil))
1090 todo-categories))
1091
1092 ;; utility functions: These are available in XEmacs, but not in Emacs 19.34
1093
1094 (if (not (fboundp 'point-at-bol))
1095 (defun point-at-bol () "Return value of point at beginning of line."
1096 (save-excursion
1097 (beginning-of-line)
1098 (point))))
1099
1100 (if (not (fboundp 'point-at-eol))
1101 (defun point-at-eol () "Return value of point at end of line."
1102 (save-excursion
1103 (end-of-line)
1104 (point))))
1105
1106 ;; splits at a white space, returns a list
1107 (if (not (fboundp 'split-string))
1108 (defun split-string (string &optional separators)
1109 "Splits STRING into substrings where there are matches for SEPARATORS.
1110 Each match for SEPARATORS is a splitting point.
1111 The substrings between the splitting points are made into a list
1112 which is returned.
1113 If SEPARATORS is absent, it defaults to \"[ \\f\\t\\n\\r\\v]+\"."
1114 (let ((rexp (or separators "[ \f\t\n\r\v]+"))
1115 (start 0)
1116 (list nil))
1117 (while (string-match rexp string start)
1118 (or (eq (match-beginning 0) 0)
1119 (setq list
1120 (cons (substring string start (match-beginning 0))
1121 list)))
1122 (setq start (match-end 0)))
1123 (or (eq start (length string))
1124 (setq list
1125 (cons (substring string start)
1126 list)))
1127 (nreverse list))))
1128
1129 ;; ---------------------------------------------------------------------------
1130
1131 (easy-menu-define todo-menu todo-mode-map "Todo Menu"
1132 '("Todo"
1133 ["Next category" todo-forward-category t]
1134 ["Previous category" todo-backward-category t]
1135 ["Jump to category" todo-jump-to-category t]
1136 ["Show top priority items" todo-top-priorities t]
1137 ["Print categories" todo-print t]
1138 "---"
1139 ["Edit item" todo-edit-item t]
1140 ["File item" todo-file-item t]
1141 ["Insert new item" todo-insert-item t]
1142 ["Insert item here" todo-insert-item-here t]
1143 ["Kill item" todo-delete-item t]
1144 "---"
1145 ["Lower item priority" todo-lower-item t]
1146 ["Raise item priority" todo-raise-item t]
1147 "---"
1148 ["Next item" todo-forward-item t]
1149 ["Previous item" todo-backward-item t]
1150 "---"
1151 ["Save" todo-save t]
1152 ["Save Top Priorities" todo-save-top-priorities t]
1153 "---"
1154 ["Quit" todo-quit t]
1155 ))
1156
1157 ;; As calendar reads .todo-do before todo-mode is loaded.
1158 ;;;### autoload
1159 (defun todo-mode () "Major mode for editing TODO lists.\n\n\\{todo-mode-map}"
1160 (interactive)
1161 (setq major-mode 'todo-mode)
1162 (setq mode-name "TODO")
1163 (use-local-map todo-mode-map)
1164 (easy-menu-add todo-menu)
1165 (run-hooks 'todo-mode-hook))
1166
1167 ;; Read about this function in the setup instructions above!
1168 ;;;### autoload
1169 (defun todo-cp ()
1170 "Make a diary entry appear only in the current date's diary"
1171 (if (equal (calendar-current-date) date)
1172 entry
1173 nil))
1174
1175 (defun todo-edit-mode ()
1176 "Major mode for editing items in the TODO list\n\n\\{todo-edit-mode-map}"
1177 (text-mode)
1178 (setq major-mode 'todo-edit-mode)
1179 (setq mode-name "TODO Edit")
1180 (run-hooks 'todo-edit-mode-hook))
1181
1182 ;;;### autoload
1183 (defun todo-show () "Show TODO list."
1184 (interactive)
1185 (if (file-exists-p todo-file-do)
1186 (find-file todo-file-do)
1187 (todo-initial-setup))
1188 (if (null todo-categories)
1189 (if (null todo-cats)
1190 (error "Error in %s: No categories in list `todo-categories'"
1191 todo-file-do)
1192 (goto-char (point-min))
1193 (and (search-forward "todo-cats:" nil t)
1194 (replace-match "todo-categories:"))
1195 (make-local-variable 'todo-categories)
1196 (setq todo-categories todo-cats)))
1197 (beginning-of-line)
1198 (todo-category-select))
1199
1200 (defun todo-initial-setup () "Set up things to work properly in TODO mode."
1201 (find-file todo-file-do)
1202 (erase-buffer)
1203 (todo-mode)
1204 (todo-add-category "Todo"))
1205
1206 (provide 'todo-mode)
1207
1208 ;; ---------------------------------------------------------------------------
1209 ;;; todo-mode.el ends here
1210 ;; ---------------------------------------------------------------------------