aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOliver Seidel1997-08-06 08:12:03 +0000
committerOliver Seidel1997-08-06 08:12:03 +0000
commit579e1c678006753b5ffa3ca63acf08ae1dff955f (patch)
tree082fce2281c1f5a9eb5f65e08dea246da283d237
parent829a5736b99738193a56f98fb2d5a5e1c04c17f7 (diff)
downloademacs-579e1c678006753b5ffa3ca63acf08ae1dff955f.tar.gz
emacs-579e1c678006753b5ffa3ca63acf08ae1dff955f.zip
Improved documentation. Broke some lines to comply with
Richard M. Stallman's email to please keep in sync with the rest of the Emacs distribution files.
-rw-r--r--lisp/calendar/todo-mode.el194
1 files changed, 139 insertions, 55 deletions
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index af81c6d7ca4..1b0065ce15b 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -1,4 +1,6 @@
1; todomode.el -- major mode for editing TODO list files 1;; todomode.el -- major mode for editing TODO list files
2
3;; $Id: todomode.el,v 1.8 1997/08/05 22:39:04 os10000 Exp os10000 $
2 4
3;; --------------------------------------------------------------------------- 5;; ---------------------------------------------------------------------------
4 6
@@ -23,52 +25,43 @@
23 25
24;; --------------------------------------------------------------------------- 26;; ---------------------------------------------------------------------------
25 27
26;; Contact information: (address) O Seidel, Lessingstr 8, Eschborn, FRG
27;; (e-mail ) Oliver.Seidel@cl.cam.ac.uk (2 Aug 1997)
28
29;; $Id: todomode.el,v 1.7 1997/08/05 22:34:14 os10000 Exp os10000 $
30;; 28;;
31;; $Log: todomode.el,v $ 29;; Quickstart Installation:
32;; Revision 1.7 1997/08/05 22:34:14 os10000 30;; ========================
33;; Fixed insertion routine with help from Trey Jackson
34;; <tjackson@ichips.intel.com>; added todo-ins-thresh;
35;; fixed keyboard layout to remove unwanted keys.
36;; 31;;
37;; Revision 1.6 1997/08/05 16:47:01 os10000 32;; To get this to work, make emacs execute the line
38;; Incorporated menus for XEmacs from Allan.Cochrane@soton.sc.philips.com,
39;; fixed TYPO, fixed todo-file-cmd, cleaned up rcs history.
40;; 33;;
41;; Revision 1.5 1997/08/05 14:43:39 os10000 34;; (require 'todomode) ;; load the TODO package
42;; Added improvements from Ron Gut <rgut@aware.com>.
43;; Added category management.
44;; 35;;
45;; Revision 1.4 1997/08/04 16:18:45 os10000 36;; I would also recommend executing the following commands
46;; Added Raise/Lower item. 37;; so as to extend the bindings in your global keymap:
47;; 38;;
48;; Revision 1.3 1997/08/03 12:47:26 os10000 39;; (global-set-key "\C-ct" 'todo-show) ;; switch to TODO buffer
49;; Cleaned up variables, prefix and cursor position. 40;; (global-set-key "\C-ci" 'todo-cmd-inst) ;; insert new item
50;; 41;;
51;; Revision 1.2 1997/08/03 12:15:28 os10000
52;; It appears to work.
53;; 42;;
54;; Revision 1.1 1997/08/03 12:15:13 os10000
55;; Initial revision
56;; 43;;
57
58;; ---------------------------------------------------------------------------
59
60;; Description: 44;; Description:
45;; ============
61;; 46;;
62;; To get this to work, make emacs execute the line "(require 'todomode)" 47;; TODO is a major mode for EMACS which offers functionality to treat
63;; and maybe initialise the variables below on startup. 48;; most lines in one buffer as a list of items one has to do. There
49;; are facilities to add new items, which are categorised, to edit or
50;; even delete items from the buffer. The buffer contents are currently
51;; compatible with the diary, so that the list of todo-items will show
52;; up in the FANCY diary mode.
64;; 53;;
65;; Just for the case that you are wondering about the ugly name of this 54;; Notice: Besides the major mode, this file also exports the function
66;; package: I am one of those unfortunate people who have DOS, LINUX and 55;; "todo-show" which will change to the one specific TODO file that has
67;; OS/2 on one of their computers, so part of my home-filespace is shared 56;; been specified in the todo-file-do variable. If this file does not
68;; and stored on a DOS partition, which is accessible to all systems. If 57;; conform to the TODO mode conventions, the todo-show function will add
69;; you wish, you can of course rename the name of the file (and the last 58;; the appropriate header and footer. I don't anticipate this to cause
70;; command) to something more aisthetically (please don't argue about 59;; much grief, but be warned, in case you attempt to read a plain text file.
71;; this spelling ...) pleasing, like i.e. todo-mode. 60;;
61;;
62;;
63;; Operation:
64;; ==========
72;; 65;;
73;; You will have the following facilities available: 66;; You will have the following facilities available:
74;; 67;;
@@ -95,24 +88,49 @@
95;; name of a category which didn't exist before, an empty category of the 88;; name of a category which didn't exist before, an empty category of the
96;; desired name will be added. 89;; desired name will be added.
97;; 90;;
98;; I would recommend to add the following bindings to your global keymap:
99;; 91;;
100;; (global-set-key "\C-ct" 'todo-show)
101;; (global-set-key "\C-ci" 'todo-cmd-inst)
102;; 92;;
103;; This will enable you to quickly find the todo-list, or to simply add an 93;; Configuration:
104;; entry, without changing to it and getting sidetracked from your current 94;; ==============
105;; project.
106;; 95;;
107;; I would also recommend that use the prefix "*/*" (by leaving the 96;; --- todo-prefix
108;; variable 'todo-prefix' untouched) so that the diary displays 97;;
109;; each entry every day. 98;; I would like to recommend that you use the prefix "*/*" (by
99;; leaving the variable 'todo-prefix' untouched) so that the diary
100;; displays each entry every day.
110;; 101;;
111;; For this, please read the documentation that goes with the calendar 102;; For this, please read the documentation that goes with the calendar
112;; since that will tell you how you can set up the fancy diary display 103;; since that will tell you how you can set up the fancy diary display
113;; and use the #include command to include your todo list file as part 104;; and use the #include command to include your todo list file as part
114;; of your diary. 105;; of your diary.
115;; 106;;
107;;
108;; --- todo-file-do
109;;
110;; This variable is fairly self-explanatory. You have to store your TODO
111;; list somewhere. This variable tells the package where to go and find
112;; this file.
113;;
114;;
115;; --- todo-file-done
116;;
117;; Even when you're done, you may wish to retain the entries. Given
118;; that they're timestamped and you are offered to add a comment, this
119;; can make a useful diary of past events. It will even blend in with
120;; the EMACS diary package. So anyway, this variable holds the name
121;; of the file for the filed todo-items.
122;;
123;;
124;; --- todo-mode-hook
125;;
126;; Just like other modes, too, this mode offers to call your functions
127;; before it goes about its business. This variable will be inspected
128;; for any functions you may wish to have called once the other TODO
129;; mode preparations have been completed.
130;;
131;;
132;; --- todo-ins-thresh
133;;
116;; Another nifty feature is the insertion accuracy. If you have 8 items 134;; Another nifty feature is the insertion accuracy. If you have 8 items
117;; in your TODO list, then you may get asked 4 questions by the binary 135;; in your TODO list, then you may get asked 4 questions by the binary
118;; insertion algorithm. However, you may not really have a need for such 136;; insertion algorithm. However, you may not really have a need for such
@@ -128,10 +146,65 @@
128;; who corrected some of my awful coding and pointed me towards some good 146;; who corrected some of my awful coding and pointed me towards some good
129;; reading. Thanks Trey! 147;; reading. Thanks Trey!
130;; 148;;
149;;
150;;
151;; History and Gossip:
152;; ===================
153;;
154;; Just for the case that you are wondering about the ugly name of this
155;; package: I am one of those unfortunate people who have DOS, LINUX and
156;; OS/2 on one of their computers, so part of my home-filespace is shared
157;; and stored on a DOS partition, which is accessible to all systems. If
158;; you wish, you can of course rename the name of the file (and the "provide"
159;; command near the end of this package) to something more aisthetically
160;; (please don't argue about this spelling ...) pleasing, like i.e. todo-mode.
161;;
131;; Enjoy this package and express your gratitude by sending valuables 162;; Enjoy this package and express your gratitude by sending valuables
132;; to my parents' address as listed above!!! 163;; to my parents' address as listed above!!!
133;; 164;;
134;; Oliver Seidel 165;; Oliver Seidel
166;;
167;;
168;;
169;; Contact information:
170;; ====================
171;;
172;; address ....: O Seidel, Lessingstr 8, Eschborn, FRG
173;; e-mail .....: Oliver.Seidel@cl.cam.ac.uk (was valid on 2 Aug 1997)
174;;
175
176;; ---------------------------------------------------------------------------
177
178;;
179;; $Log: todomode.el,v $
180;; Revision 1.8 1997/08/05 22:39:04 os10000
181;; Made todomode.el available under GPL.
182;;
183;; Revision 1.7 1997/08/05 22:34:14 os10000
184;; Fixed insertion routine with help from Trey Jackson
185;; <tjackson@ichips.intel.com>; added todo-ins-thresh;
186;; fixed keyboard layout to remove unwanted keys.
187;;
188;; Revision 1.6 1997/08/05 16:47:01 os10000
189;; Incorporated menus for XEmacs from Allan.Cochrane@soton.sc.philips.com,
190;; fixed TYPO, fixed todo-file-cmd, cleaned up rcs history.
191;;
192;; Revision 1.5 1997/08/05 14:43:39 os10000
193;; Added improvements from Ron Gut <rgut@aware.com>.
194;; Added category management.
195;;
196;; Revision 1.4 1997/08/04 16:18:45 os10000
197;; Added Raise/Lower item.
198;;
199;; Revision 1.3 1997/08/03 12:47:26 os10000
200;; Cleaned up variables, prefix and cursor position.
201;;
202;; Revision 1.2 1997/08/03 12:15:28 os10000
203;; It appears to work.
204;;
205;; Revision 1.1 1997/08/03 12:15:13 os10000
206;; Initial revision
207;;
135 208
136;; --------------------------------------------------------------------------- 209;; ---------------------------------------------------------------------------
137 210
@@ -140,7 +213,7 @@
140(defvar todo-prefix "*/*" "TODO mode prefix when creating entries") 213(defvar todo-prefix "*/*" "TODO mode prefix when creating entries")
141(defvar todo-file-do "~/.todo-do" "TODO mode filename of list file") 214(defvar todo-file-do "~/.todo-do" "TODO mode filename of list file")
142(defvar todo-file-done "~/.todo-done" "TODO mode filename of archive file") 215(defvar todo-file-done "~/.todo-done" "TODO mode filename of archive file")
143(defvar todo-mode-hook nil "Hooks invoked when the *TODO* buffer is created.") 216(defvar todo-mode-hook nil "Hooks invoked when the TODO mode is entered.")
144(defvar todo-ins-thresh 0 "TODO mode insertion accuracy.") 217(defvar todo-ins-thresh 0 "TODO mode insertion accuracy.")
145 218
146;; --------------------------------------------------------------------------- 219;; ---------------------------------------------------------------------------
@@ -168,7 +241,8 @@
168 241
169(defun todo-cat-slct () 242(defun todo-cat-slct ()
170 (let ((todo-category-name (nth todo-category-number todo-cats))) 243 (let ((todo-category-name (nth todo-category-number todo-cats)))
171 (setq mode-line-buffer-identification (concat "Category: " todo-category-name)) 244 (setq mode-line-buffer-identification
245 (concat "Category: " todo-category-name))
172 (widen) 246 (widen)
173 (goto-char (point-min)) 247 (goto-char (point-min))
174 (search-forward (concat "--- " todo-category-name)) 248 (search-forward (concat "--- " todo-category-name))
@@ -225,7 +299,8 @@
225 (bury-buffer) 299 (bury-buffer)
226 ) 300 )
227 301
228(defun todo-line () "Find current line in buffer." (buffer-substring (point-at-bol) (point-at-eol))) 302(defun todo-line () "Find current line in buffer."
303 (buffer-substring (point-at-bol) (point-at-eol)))
229 304
230(defun todo-cmd-edit () "Edit current TODO list entry." 305(defun todo-cmd-edit () "Edit current TODO list entry."
231 (interactive) 306 (interactive)
@@ -249,11 +324,15 @@
249 (goto-char (point-min)) 324 (goto-char (point-min))
250 (let ((posn (search-forward "-*- mode: todo; " 17 t))) 325 (let ((posn (search-forward "-*- mode: todo; " 17 t)))
251 (if (not (null posn)) (goto-char posn)) 326 (if (not (null posn)) (goto-char posn))
252 (if (equal posn nil) (progn (insert "-*- mode: todo; \n") (forward-char -1)) (kill-line)) 327 (if (equal posn nil)
253 ) 328 (progn
329 (insert "-*- mode: todo; \n")
330 (forward-char -1))
331 (kill-line)))
254 (insert (format "todo-cats: %S; -*-" todo-cats)) 332 (insert (format "todo-cats: %S; -*-" todo-cats))
255 (forward-char 1) 333 (forward-char 1)
256 (insert (format "%s --- %s\n--- End\n%s %s\n" todo-prefix cat todo-prefix (make-string 75 ?-))) 334 (insert (format "%s --- %s\n--- End\n%s %s\n"
335 todo-prefix cat todo-prefix (make-string 75 ?-)))
257 ) 336 )
258 0 337 0
259 ) 338 )
@@ -262,7 +341,8 @@
262 "Insert new TODO list entry." 341 "Insert new TODO list entry."
263 (interactive) 342 (interactive)
264 (beginning-of-line nil) 343 (beginning-of-line nil)
265 (let* ((todo-entry (concat todo-prefix " " (read-from-minibuffer "New TODO entry: "))) 344 (let* ((todo-entry (concat todo-prefix " "
345 (read-from-minibuffer "New TODO entry: ")))
266 (temp-catgs todo-cats) 346 (temp-catgs todo-cats)
267 (todo-hstry (cons 'temp-catgs (+ todo-category-number 1)))) 347 (todo-hstry (cons 'temp-catgs (+ todo-category-number 1))))
268 (save-window-excursion 348 (save-window-excursion
@@ -283,7 +363,8 @@
283 (todo-lst (+ 1 (count-lines (point-min) (point-max))))) 363 (todo-lst (+ 1 (count-lines (point-min) (point-max)))))
284 (while (> (- todo-lst todo-fst) todo-ins-thresh) 364 (while (> (- todo-lst todo-fst) todo-ins-thresh)
285 (let* ((todo-cur (/ (+ todo-fst todo-lst) 2)) 365 (let* ((todo-cur (/ (+ todo-fst todo-lst) 2))
286 (todo-ans (if (< todo-cur todo-lst) (todo-ask todo-cur) nil))) 366 (todo-ans (if (< todo-cur todo-lst)
367 (todo-ask todo-cur) nil)))
287 (if todo-ans 368 (if todo-ans
288 (setq todo-lst todo-cur) 369 (setq todo-lst todo-cur)
289 (setq todo-fst (+ todo-cur 1))))) 370 (setq todo-fst (+ todo-cur 1)))))
@@ -306,7 +387,9 @@
306 (setq todo-prv-lne lne) 387 (setq todo-prv-lne lne)
307 (goto-char (point-min)) 388 (goto-char (point-min))
308 (forward-line (- todo-prv-lne 1)) 389 (forward-line (- todo-prv-lne 1))
309 (setq todo-prv-ans (y-or-n-p (concat "More important than '" (todo-line) "'? "))))) 390 (setq todo-prv-ans (y-or-n-p
391 (concat "More important than '"
392 (todo-line) "'? ")))))
310 todo-prv-ans) 393 todo-prv-ans)
311 394
312(defun todo-cmd-kill () "Delete current TODO list entry." 395(defun todo-cmd-kill () "Delete current TODO list entry."
@@ -314,7 +397,8 @@
314 (if (> (count-lines (point-min) (point-max)) 0) 397 (if (> (count-lines (point-min) (point-max)) 0)
315 (progn 398 (progn
316 (let* ((todo-entry (todo-line)) 399 (let* ((todo-entry (todo-line))
317 (todo-answer (y-or-n-p (concat "Permanently remove '" todo-entry "'? ")))) 400 (todo-answer (y-or-n-p (concat "Permanently remove '"
401 todo-entry "'? "))))
318 (if todo-answer 402 (if todo-answer
319 (progn 403 (progn
320 (delete-region (point-at-bol) (+ 1 (point-at-eol))) 404 (delete-region (point-at-bol) (+ 1 (point-at-eol)))