diff options
| author | Oliver Seidel | 1997-08-06 10:56:15 +0000 |
|---|---|---|
| committer | Oliver Seidel | 1997-08-06 10:56:15 +0000 |
| commit | cf1ebf43909b6574e2f1a31cd7a5b4ef9b379204 (patch) | |
| tree | c7e32d3b5dcdbf996790fe460381554e4fb7688e | |
| parent | 49c48a1b9db7d5e3192360f6945e922bb4001c2b (diff) | |
| download | emacs-cf1ebf43909b6574e2f1a31cd7a5b4ef9b379204.tar.gz emacs-cf1ebf43909b6574e2f1a31cd7a5b4ef9b379204.zip | |
Fixed header, typos, layout, documentation.
| -rw-r--r-- | lisp/calendar/todo-mode.el | 164 |
1 files changed, 72 insertions, 92 deletions
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index 1d787fe8cf3..5f413b348c1 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el | |||
| @@ -1,27 +1,36 @@ | |||
| 1 | ;; todomode.el -- major mode for editing TODO list files | 1 | ;;; todomode.el -- Major mode for editing TODO list files |
| 2 | 2 | ;;; Copyright (C) 1997 by Oliver Seidel | |
| 3 | ;; $Id: todomode.el,v 1.10 1997/08/06 08:56:03 os10000 Exp os10000 $ | ||
| 4 | 3 | ||
| 5 | ;; --------------------------------------------------------------------------- | 4 | ;; --------------------------------------------------------------------------- |
| 6 | 5 | ||
| 7 | ;; Copyright (C) 1997 Oliver Seidel | 6 | ;; |
| 7 | ;; Author: Oliver.Seidel@cl.cam.ac.uk (was valid on Aug 2, 1997) | ||
| 8 | ;; Created: August 2, 1997 | ||
| 9 | ;; Version: $Id: todomode.el,v 1.11 1997/08/06 09:14:25 os10000 Exp os10000 $ | ||
| 10 | ;; Keywords: Categorised TODO list editor, todo-mode | ||
| 11 | ;; Availability: newsgroup "gnu.emacs.sources" and archives thereof | ||
| 12 | ;; | ||
| 8 | 13 | ||
| 9 | ;; Keywords: todo-mode | 14 | ;; --------------------------------------------------------------------------- |
| 10 | 15 | ||
| 11 | ;; todomode.el is free software; you can redistribute it and/or modify | 16 | ;; |
| 17 | ;; This program is intended for use with GNU Emacs. | ||
| 18 | ;; | ||
| 19 | ;; This program is free software; you can redistribute it and/or modify | ||
| 12 | ;; it under the terms of the GNU General Public License as published by | 20 | ;; it under the terms of the GNU General Public License as published by |
| 13 | ;; the Free Software Foundation; either version 2, or (at your option) | 21 | ;; the Free Software Foundation; either version 2, or (at your option) |
| 14 | ;; any later version. | 22 | ;; any later version. |
| 15 | 23 | ;; | |
| 16 | ;; todomode.el is distributed in the hope that it will be useful, | 24 | ;; This program is distributed in the hope that it will be useful, |
| 17 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | 25 | ;; but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 18 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 26 | ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 19 | ;; GNU General Public License for more details. | 27 | ;; GNU General Public License for more details. |
| 20 | 28 | ;; | |
| 21 | ;; You should have received a copy of the GNU General Public License | 29 | ;; You should have received a copy of the GNU General Public License |
| 22 | ;; along with GNU Emacs; see the file COPYING. If not, write to the | 30 | ;; along with GNU Emacs; see the file COPYING. If not, write to the |
| 23 | ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 31 | ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
| 24 | ;; Boston, MA 02111-1307, USA. | 32 | ;; Boston, MA 02111-1307, USA. |
| 33 | ;; | ||
| 25 | 34 | ||
| 26 | ;; --------------------------------------------------------------------------- | 35 | ;; --------------------------------------------------------------------------- |
| 27 | 36 | ||
| @@ -74,11 +83,11 @@ | |||
| 74 | ;; comment and timestamp | 83 | ;; comment and timestamp |
| 75 | ;; i to insert a new entry | 84 | ;; i to insert a new entry |
| 76 | ;; k to kill the current entry | 85 | ;; k to kill the current entry |
| 77 | ;; l lower the current entry's priority | 86 | ;; l to lower the current entry's priority |
| 78 | ;; n for the next entry | 87 | ;; n for the next entry |
| 79 | ;; p for the previous entry | 88 | ;; p for the previous entry |
| 80 | ;; q to save the list and exit the buffer | 89 | ;; q to save the list and exit the buffer |
| 81 | ;; r raise current entryk's priority | 90 | ;; r to raise the current entry's priority |
| 82 | ;; s to save the list | 91 | ;; s to save the list |
| 83 | ;; | 92 | ;; |
| 84 | ;; When you add a new entry, you are asked for the text and then for the | 93 | ;; When you add a new entry, you are asked for the text and then for the |
| @@ -152,6 +161,10 @@ | |||
| 152 | ;; History and Gossip: | 161 | ;; History and Gossip: |
| 153 | ;; =================== | 162 | ;; =================== |
| 154 | ;; | 163 | ;; |
| 164 | ;; Many thanks to all the ones who have contributed to the evolution of this | ||
| 165 | ;; package! I hope I have listed all of you somewhere in the documentation | ||
| 166 | ;; or at least in the RCS history! | ||
| 167 | ;; | ||
| 155 | ;; Just for the case that you are wondering about the ugly name of this | 168 | ;; Just for the case that you are wondering about the ugly name of this |
| 156 | ;; package: I am one of those unfortunate people who have DOS, LINUX and | 169 | ;; package: I am one of those unfortunate people who have DOS, LINUX and |
| 157 | ;; OS/2 on one of their computers, so part of my home-filespace is shared | 170 | ;; OS/2 on one of their computers, so part of my home-filespace is shared |
| @@ -160,24 +173,22 @@ | |||
| 160 | ;; command near the end of this package) to something more aisthetically | 173 | ;; command near the end of this package) to something more aisthetically |
| 161 | ;; (please don't argue about this spelling ...) pleasing, like i.e. todo-mode. | 174 | ;; (please don't argue about this spelling ...) pleasing, like i.e. todo-mode. |
| 162 | ;; | 175 | ;; |
| 163 | ;; Enjoy this package and express your gratitude by sending valuables | 176 | ;; Enjoy this package and express your gratitude by sending nice things |
| 164 | ;; to my parents' address as listed above!!! | 177 | ;; to my parents' address! |
| 165 | ;; | 178 | ;; |
| 166 | ;; Oliver Seidel | 179 | ;; Oliver Seidel |
| 167 | ;; | 180 | ;; |
| 168 | ;; | 181 | ;; (O Seidel, Lessingstr. 8, 65760 Eschborn, Federal Republic of Germany) |
| 169 | ;; | ||
| 170 | ;; Contact information: | ||
| 171 | ;; ==================== | ||
| 172 | ;; | ||
| 173 | ;; address ....: O Seidel, Lessingstr 8, Eschborn, FRG | ||
| 174 | ;; e-mail .....: Oliver.Seidel@cl.cam.ac.uk (was valid on 2 Aug 1997) | ||
| 175 | ;; | 182 | ;; |
| 176 | 183 | ||
| 177 | ;; --------------------------------------------------------------------------- | 184 | ;; --------------------------------------------------------------------------- |
| 178 | 185 | ||
| 179 | ;; | 186 | ;; |
| 180 | ;; $Log: todomode.el,v $ | 187 | ;; $Log: todomode.el,v $ |
| 188 | ;; Revision 1.11 1997/08/06 09:14:25 os10000 | ||
| 189 | ;; Applied patch from Istvan Marko <istvan@cmdmail.amd.com> | ||
| 190 | ;; to make menus work anywhere. | ||
| 191 | ;; | ||
| 181 | ;; Revision 1.10 1997/08/06 08:56:03 os10000 | 192 | ;; Revision 1.10 1997/08/06 08:56:03 os10000 |
| 182 | ;; Acted upon suggestion from Shane Holder <holder@rsn.hp.com>: | 193 | ;; Acted upon suggestion from Shane Holder <holder@rsn.hp.com>: |
| 183 | ;; Cancelling the editing of an entry will not delete it any more. | 194 | ;; Cancelling the editing of an entry will not delete it any more. |
| @@ -220,11 +231,11 @@ | |||
| 220 | 231 | ||
| 221 | ;; User-configurable variables: | 232 | ;; User-configurable variables: |
| 222 | 233 | ||
| 223 | (defvar todo-prefix "*/*" "TODO mode prefix when creating entries") | 234 | (defvar todo-prefix "*/*" "TODO mode prefix for entries.") |
| 224 | (defvar todo-file-do "~/.todo-do" "TODO mode filename of list file") | 235 | (defvar todo-file-do "~/.todo-do" "TODO mode list file.") |
| 225 | (defvar todo-file-done "~/.todo-done" "TODO mode filename of archive file") | 236 | (defvar todo-file-done "~/.todo-done" "TODO mode archive file.") |
| 226 | (defvar todo-mode-hook nil "Hooks invoked when the TODO mode is entered.") | 237 | (defvar todo-mode-hook nil "TODO mode hooks.") |
| 227 | (defvar todo-ins-thresh 0 "TODO mode insertion accuracy.") | 238 | (defvar todo-ins-thresh 0 "TODO mode insertion accuracy.") |
| 228 | 239 | ||
| 229 | ;; --------------------------------------------------------------------------- | 240 | ;; --------------------------------------------------------------------------- |
| 230 | 241 | ||
| @@ -235,7 +246,16 @@ | |||
| 235 | 246 | ||
| 236 | ;; --------------------------------------------------------------------------- | 247 | ;; --------------------------------------------------------------------------- |
| 237 | 248 | ||
| 238 | (defvar todo-mode-map nil "TODO mode keymap. See `todo-mode'") | 249 | ;; Set up some helpful context ... |
| 250 | |||
| 251 | (defvar todo-cats nil "TODO categories.") | ||
| 252 | (defvar todo-prv-lne 0 "previous line that I asked about.") | ||
| 253 | (defvar todo-prv-ans 0 "previous answer that I got.") | ||
| 254 | (defvar todo-mode-map nil "TODO mode keymap.") | ||
| 255 | (defvar todo-category-number 0 "TODO category number.") | ||
| 256 | |||
| 257 | ;; --------------------------------------------------------------------------- | ||
| 258 | |||
| 239 | (if todo-mode-map | 259 | (if todo-mode-map |
| 240 | nil | 260 | nil |
| 241 | (let ((map (make-keymap))) | 261 | (let ((map (make-keymap))) |
| @@ -264,46 +284,37 @@ | |||
| 264 | (setq begin (+ (point-at-eol) 1)) | 284 | (setq begin (+ (point-at-eol) 1)) |
| 265 | (search-forward "--- End") | 285 | (search-forward "--- End") |
| 266 | (narrow-to-region begin (point-at-bol)) | 286 | (narrow-to-region begin (point-at-bol)) |
| 267 | (goto-char (point-min)) | 287 | (goto-char (point-min)))) |
| 268 | ) | ||
| 269 | ) | ||
| 270 | 288 | ||
| 271 | (defun todo-cmd-forw () "Go forward to TODO list of next category." | 289 | (defun todo-cmd-forw () "Go forward to TODO list of next category." |
| 272 | (interactive) | 290 | (interactive) |
| 273 | (let ((todo-cat-cnt (- (length todo-cats) 1))) | 291 | (let ((todo-cat-cnt (- (length todo-cats) 1))) |
| 274 | (setq todo-category-number (if (< todo-category-number todo-cat-cnt) | 292 | (setq todo-category-number (if (< todo-category-number todo-cat-cnt) |
| 275 | (+ todo-category-number 1) 0)) | 293 | (+ todo-category-number 1) 0)) |
| 276 | (todo-cat-slct) | 294 | (todo-cat-slct))) |
| 277 | ) | ||
| 278 | ) | ||
| 279 | 295 | ||
| 280 | (defun todo-cmd-back () "Go back to TODO list of previous category." | 296 | (defun todo-cmd-back () "Go back to TODO list of previous category." |
| 281 | (interactive) | 297 | (interactive) |
| 282 | (let ((todo-cat-cnt (- (length todo-cats) 1))) | 298 | (let ((todo-cat-cnt (- (length todo-cats) 1))) |
| 283 | (setq todo-category-number (if (> todo-category-number 0) | 299 | (setq todo-category-number (if (> todo-category-number 0) |
| 284 | (- todo-category-number 1) todo-cat-cnt)) | 300 | (- todo-category-number 1) todo-cat-cnt)) |
| 285 | (todo-cat-slct) | 301 | (todo-cat-slct))) |
| 286 | ) | ||
| 287 | ) | ||
| 288 | 302 | ||
| 289 | (defun todo-cmd-prev () "Select previous entry of TODO list." | 303 | (defun todo-cmd-prev () "Select previous entry of TODO list." |
| 290 | (interactive) | 304 | (interactive) |
| 291 | (forward-line -1) | 305 | (forward-line -1) |
| 292 | (beginning-of-line nil) | 306 | (beginning-of-line nil) |
| 293 | (message "") | 307 | (message "")) |
| 294 | ) | ||
| 295 | 308 | ||
| 296 | (defun todo-cmd-next () "Select next entry of TODO list." | 309 | (defun todo-cmd-next () "Select next entry of TODO list." |
| 297 | (interactive) | 310 | (interactive) |
| 298 | (forward-line 1) | 311 | (forward-line 1) |
| 299 | (beginning-of-line nil) | 312 | (beginning-of-line nil) |
| 300 | (message "") | 313 | (message "")) |
| 301 | ) | ||
| 302 | 314 | ||
| 303 | (defun todo-cmd-save () "Save the TODO list." | 315 | (defun todo-cmd-save () "Save the TODO list." |
| 304 | (interactive) | 316 | (interactive) |
| 305 | (save-buffer) | 317 | (save-buffer)) |
| 306 | ) | ||
| 307 | 318 | ||
| 308 | (defun todo-cmd-done () "Done with TODO list for now." | 319 | (defun todo-cmd-done () "Done with TODO list for now." |
| 309 | (interactive) | 320 | (interactive) |
| @@ -311,8 +322,7 @@ | |||
| 311 | (save-buffer) | 322 | (save-buffer) |
| 312 | (beginning-of-line nil) | 323 | (beginning-of-line nil) |
| 313 | (message "") | 324 | (message "") |
| 314 | (bury-buffer) | 325 | (bury-buffer)) |
| 315 | ) | ||
| 316 | 326 | ||
| 317 | (defun todo-line () "Find current line in buffer." | 327 | (defun todo-line () "Find current line in buffer." |
| 318 | (buffer-substring (point-at-bol) (point-at-eol))) | 328 | (buffer-substring (point-at-bol) (point-at-eol))) |
| @@ -325,9 +335,6 @@ | |||
| 325 | (beginning-of-line nil) | 335 | (beginning-of-line nil) |
| 326 | (message ""))) | 336 | (message ""))) |
| 327 | 337 | ||
| 328 | (defvar todo-prv-lne 0 "previous line that I asked about.") | ||
| 329 | (defvar todo-prv-ans 0 "previous answer that I got.") | ||
| 330 | |||
| 331 | (defun todo-add-category (cat) "Add a new category to the TODO list." | 338 | (defun todo-add-category (cat) "Add a new category to the TODO list." |
| 332 | (interactive) | 339 | (interactive) |
| 333 | (save-window-excursion | 340 | (save-window-excursion |
| @@ -345,10 +352,8 @@ | |||
| 345 | (insert (format "todo-cats: %S; -*-" todo-cats)) | 352 | (insert (format "todo-cats: %S; -*-" todo-cats)) |
| 346 | (forward-char 1) | 353 | (forward-char 1) |
| 347 | (insert (format "%s --- %s\n--- End\n%s %s\n" | 354 | (insert (format "%s --- %s\n--- End\n%s %s\n" |
| 348 | todo-prefix cat todo-prefix (make-string 75 ?-))) | 355 | todo-prefix cat todo-prefix (make-string 75 ?-)))) |
| 349 | ) | 356 | 0) |
| 350 | 0 | ||
| 351 | ) | ||
| 352 | 357 | ||
| 353 | (defun todo-cmd-inst () | 358 | (defun todo-cmd-inst () |
| 354 | "Insert new TODO list entry." | 359 | "Insert new TODO list entry." |
| @@ -385,7 +390,6 @@ | |||
| 385 | (setq todo-fst (/ (+ todo-fst todo-lst) 2)) | 390 | (setq todo-fst (/ (+ todo-fst todo-lst) 2)) |
| 386 | ;; goto-line doesn't have the desired behavior in a narrowed buffer | 391 | ;; goto-line doesn't have the desired behavior in a narrowed buffer |
| 387 | (goto-char (point-min)) | 392 | (goto-char (point-min)) |
| 388 | (message (format "todo-fst=%d" todo-fst)) | ||
| 389 | (forward-line (- todo-fst 1))) | 393 | (forward-line (- todo-fst 1))) |
| 390 | 394 | ||
| 391 | (insert (concat todo-entry "\n")) | 395 | (insert (concat todo-entry "\n")) |
| @@ -415,16 +419,10 @@ | |||
| 415 | (if todo-answer | 419 | (if todo-answer |
| 416 | (progn | 420 | (progn |
| 417 | (delete-region (point-at-bol) (+ 1 (point-at-eol))) | 421 | (delete-region (point-at-bol) (+ 1 (point-at-eol))) |
| 418 | (forward-line -1) | 422 | (forward-line -1)))) |
| 419 | ) | 423 | (message "")) |
| 420 | ) | 424 | (message "No TODO list entry to delete.")) |
| 421 | ) | 425 | (beginning-of-line nil)) |
| 422 | (message "") | ||
| 423 | ) | ||
| 424 | (message "No TODO list entry to delete.") | ||
| 425 | ) | ||
| 426 | (beginning-of-line nil) | ||
| 427 | ) | ||
| 428 | 426 | ||
| 429 | (defun todo-cmd-rais () "Raise priority of current entry." | 427 | (defun todo-cmd-rais () "Raise priority of current entry." |
| 430 | (interactive) | 428 | (interactive) |
| @@ -435,12 +433,9 @@ | |||
| 435 | (forward-line -1) | 433 | (forward-line -1) |
| 436 | (insert (concat todo-entry "\n")) | 434 | (insert (concat todo-entry "\n")) |
| 437 | (forward-line -1) | 435 | (forward-line -1) |
| 438 | (message "") | 436 | (message "")) |
| 439 | ) | 437 | (message "No TODO list entry to raise.")) |
| 440 | (message "No TODO list entry to raise.") | 438 | (beginning-of-line nil)) |
| 441 | ) | ||
| 442 | (beginning-of-line nil) | ||
| 443 | ) | ||
| 444 | 439 | ||
| 445 | (defun todo-cmd-lowr () "Lower priority of current entry." | 440 | (defun todo-cmd-lowr () "Lower priority of current entry." |
| 446 | (interactive) | 441 | (interactive) |
| @@ -451,12 +446,9 @@ | |||
| 451 | (forward-line 1) | 446 | (forward-line 1) |
| 452 | (insert (concat todo-entry "\n")) | 447 | (insert (concat todo-entry "\n")) |
| 453 | (forward-line -1) | 448 | (forward-line -1) |
| 454 | (message "") | 449 | (message "")) |
| 455 | ) | 450 | (message "No TODO list entry to raise.")) |
| 456 | (message "No TODO list entry to raise.") | 451 | (beginning-of-line nil)) |
| 457 | ) | ||
| 458 | (beginning-of-line nil) | ||
| 459 | ) | ||
| 460 | 452 | ||
| 461 | (defun todo-cmd-file () "File away the current TODO list entry." | 453 | (defun todo-cmd-file () "File away the current TODO list entry." |
| 462 | (interactive) | 454 | (interactive) |
| @@ -470,14 +462,10 @@ | |||
| 470 | (insert (concat " (" (read-from-minibuffer "Comment: ") ")")) | 462 | (insert (concat " (" (read-from-minibuffer "Comment: ") ")")) |
| 471 | (append-to-file (point-at-bol) (+ 1 (point-at-eol)) todo-file-done) | 463 | (append-to-file (point-at-bol) (+ 1 (point-at-eol)) todo-file-done) |
| 472 | (delete-region (point-at-bol) (+ 1 (point-at-eol))) | 464 | (delete-region (point-at-bol) (+ 1 (point-at-eol))) |
| 473 | (forward-line -1) | 465 | (forward-line -1)) |
| 474 | ) | 466 | (message "")) |
| 475 | (message "") | 467 | (message "No TODO list entry to delete.")) |
| 476 | ) | 468 | (beginning-of-line nil)) |
| 477 | (message "No TODO list entry to delete.") | ||
| 478 | ) | ||
| 479 | (beginning-of-line nil) | ||
| 480 | ) | ||
| 481 | 469 | ||
| 482 | ;; --------------------------------------------------------------------------- | 470 | ;; --------------------------------------------------------------------------- |
| 483 | 471 | ||
| @@ -518,9 +506,6 @@ | |||
| 518 | ["Quit" todo-cmd-done t] | 506 | ["Quit" todo-cmd-done t] |
| 519 | )) | 507 | )) |
| 520 | 508 | ||
| 521 | (defvar todo-cats nil "TODO categories.") | ||
| 522 | (defvar todo-category-number 0 "TODO category number.") | ||
| 523 | |||
| 524 | (defun todo-mode () "Major mode for editing TODO lists.\n\n\\{todo-mode-map}" | 509 | (defun todo-mode () "Major mode for editing TODO lists.\n\n\\{todo-mode-map}" |
| 525 | (interactive) | 510 | (interactive) |
| 526 | (setq major-mode 'todo-mode) | 511 | (setq major-mode 'todo-mode) |
| @@ -543,17 +528,12 @@ | |||
| 543 | (mrkr (buffer-substring bol eol))) | 528 | (mrkr (buffer-substring bol eol))) |
| 544 | (delete-region bol eol) | 529 | (delete-region bol eol) |
| 545 | (goto-char (point-max)) | 530 | (goto-char (point-max)) |
| 546 | (insert mrkr) | 531 | (insert mrkr))) |
| 547 | ) | ||
| 548 | ) | ||
| 549 | (save-buffer) | 532 | (save-buffer) |
| 550 | (kill-buffer (current-buffer)) | 533 | (kill-buffer (current-buffer)) |
| 551 | (find-file todo-file-do) | 534 | (find-file todo-file-do))) |
| 552 | ) | ||
| 553 | ) | ||
| 554 | (beginning-of-line nil) | 535 | (beginning-of-line nil) |
| 555 | (todo-cat-slct) | 536 | (todo-cat-slct)) |
| 556 | ) | ||
| 557 | 537 | ||
| 558 | (provide 'todomode) | 538 | (provide 'todomode) |
| 559 | 539 | ||