aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2000-06-02 18:37:43 +0000
committerDave Love2000-06-02 18:37:43 +0000
commita554b301b07f12d4ec2b18561c3e8e76f45b08f9 (patch)
tree985f3f7ac1d24ff41d690b5fcc8d2b9f869cf5a5
parentdba286b6f094abd3f18f8720d6b3406f404bc97c (diff)
downloademacs-a554b301b07f12d4ec2b18561c3e8e76f45b08f9.tar.gz
emacs-a554b301b07f12d4ec2b18561c3e8e76f45b08f9.zip
[This needs more work on the outline stuff.]
Doc fixes. (todo) <defgroup>: Add :version. (todo-add-category): Don't use pushnew. (todo-cmd-raise): Fix typo. (todo-top-priorities): Change temp buffer name. (todo-category-alist): Avoid redundant lambda. (todo-mode): Set paragraph-separate, outline-regexp from todo-prefix. Use outline-next-heading.
-rw-r--r--lisp/calendar/todo-mode.el121
1 files changed, 60 insertions, 61 deletions
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index e4c06cdfb2d..ce37bd523f7 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -1,10 +1,11 @@
1;; todo-mode.el -- Major mode for editing TODO list files 1;; todo-mode.el -- Major mode for editing TODO list files
2 2
3;; Copyright (C) 1997 Free Software Foundation, Inc. 3;; Copyright (C) 1997, 2000 Free Software Foundation, Inc.
4 4
5;; Author: Oliver.Seidel@cl.cam.ac.uk (was valid on Aug 2, 1997) 5;; Author: Oliver.Seidel@cl.cam.ac.uk
6;; Maintainer: FSF (unless Seidel can be found)
6;; Created: 2 Aug 1997 7;; Created: 2 Aug 1997
7;; Version: $Id: todo-mode.el,v 1.38 1999/05/12 08:41:32 os10000 Exp $ 8;; Version: $Id: todo-mode.el,v 1.39 2000/05/12 10:56:20 fx Exp $
8;; Keywords: Categorised TODO list editor, todo-mode 9;; Keywords: Categorised TODO list editor, todo-mode
9 10
10;; This file is part of GNU Emacs. 11;; This file is part of GNU Emacs.
@@ -117,17 +118,7 @@
117;; 118;;
118;; Which version of todo-mode.el does this documentation refer to? 119;; Which version of todo-mode.el does this documentation refer to?
119;; 120;;
120;; $Id: todo-mode.el,v 1.38 1999/05/12 08:41:32 os10000 Exp $ 121;; $Id: todo-mode.el,v 1.39 2000/05/12 10:56:20 fx Exp $
121;;
122;; Pre-Requisites
123;;
124;; This package will require the following packages to be
125;; available on the load-path:
126;;
127;; cl
128;; custom
129;; easymenu
130;; time-stamp
131;; 122;;
132;; Operation 123;; Operation
133;; 124;;
@@ -300,9 +291,10 @@
300 291
301(defgroup todo nil 292(defgroup todo nil
302 "Maintain a list of todo items." 293 "Maintain a list of todo items."
294 :version "21.1"
303 :group 'calendar) 295 :group 'calendar)
304 296
305(defcustom todo-prefix "*/*" 297(defcustom todo-prefix "*/*"
306 "*TODO mode prefix for entries. 298 "*TODO mode prefix for entries.
307 299
308This is useful in conjunction with `calendar' and `diary' if you use 300This is useful in conjunction with `calendar' and `diary' if you use
@@ -317,11 +309,11 @@ show and mark todo entreis for today, but may slow down processing of
317the diary file somewhat." 309the diary file somewhat."
318 :type 'string 310 :type 'string
319 :group 'todo) 311 :group 'todo)
320(defcustom todo-file-do "~/.todo-do" 312(defcustom todo-file-do "~/.todo-do"
321 "*TODO mode list file." 313 "*TODO mode list file."
322 :type 'file 314 :type 'file
323 :group 'todo) 315 :group 'todo)
324(defcustom todo-file-done "~/.todo-done" 316(defcustom todo-file-done "~/.todo-done"
325 "*TODO mode archive file." 317 "*TODO mode archive file."
326 :type 'file 318 :type 'file
327 :group 'todo) 319 :group 'todo)
@@ -378,8 +370,7 @@ Automatically generated when `todo-save-top-priorities' is non-nil."
378 :type 'boolean 370 :type 'boolean
379 :group 'todo) 371 :group 'todo)
380(defcustom todo-save-top-priorities-too t 372(defcustom todo-save-top-priorities-too t
381 "*Non-nil makes todo-save automatically save top-priorities in 373 "*Non-nil makes `todo-save' automatically save top-priorities in `todo-file-top'."
382`todo-file-top'."
383 :type 'boolean 374 :type 'boolean
384 :group 'todo) 375 :group 'todo)
385 376
@@ -577,7 +568,7 @@ Return nil if ITEM not found."
577 "Add new category CAT to the TODO list." 568 "Add new category CAT to the TODO list."
578 (interactive "sCategory: ") 569 (interactive "sCategory: ")
579 (save-window-excursion 570 (save-window-excursion
580 (pushnew 'todo-categories cat) 571 (add-to-list 'todo-categories cat)
581 (find-file todo-file-do) 572 (find-file todo-file-do)
582 (widen) 573 (widen)
583 (goto-char (point-min)) 574 (goto-char (point-min))
@@ -708,7 +699,7 @@ category."
708 (insert item "\n")) 699 (insert item "\n"))
709 (message "")) 700 (message ""))
710 (error "No TODO list entry to raise"))) 701 (error "No TODO list entry to raise")))
711(defalias 'todo-cmd-rais 'todo-raise-item) 702(defalias 'todo-cmd-raise 'todo-raise-item)
712 703
713(defun todo-lower-item () "Lower priority of current entry." 704(defun todo-lower-item () "Lower priority of current entry."
714 (interactive) 705 (interactive)
@@ -724,8 +715,7 @@ category."
724(defalias 'todo-cmd-lowr 'todo-lower-item) 715(defalias 'todo-cmd-lowr 'todo-lower-item)
725 716
726(defun todo-file-item (&optional comment) 717(defun todo-file-item (&optional comment)
727 "File the current TODO list entry away, 718 "File the current TODO list entry away, annotated with an optional COMMENT."
728annotated with an optional COMMENT."
729 (interactive "sComment: ") 719 (interactive "sComment: ")
730 (or (> (count-lines (point-min) (point-max)) 0) 720 (or (> (count-lines (point-min) (point-max)) 0)
731 (error "No TODO list entry to file away")) 721 (error "No TODO list entry to file away"))
@@ -770,7 +760,7 @@ between each category."
770 (or nof-priorities (setq nof-priorities todo-show-priorities)) 760 (or nof-priorities (setq nof-priorities todo-show-priorities))
771 (if (listp nof-priorities) ;universal argument 761 (if (listp nof-priorities) ;universal argument
772 (setq nof-priorities (car nof-priorities))) 762 (setq nof-priorities (car nof-priorities)))
773 (let ((todo-print-buffer-name "*Tmp*") 763 (let ((todo-print-buffer-name " *todo-tmp*")
774 ;;(todo-print-category-number 0) 764 ;;(todo-print-category-number 0)
775 (todo-category-break (if category-pr-page " " "")) 765 (todo-category-break (if category-pr-page " " ""))
776 (cat-end 766 (cat-end
@@ -828,7 +818,7 @@ defaults to `todo-show-priorities'."
828 818
829;;;###autoload 819;;;###autoload
830(defun todo-print (&optional category-pr-page) 820(defun todo-print (&optional category-pr-page)
831 "Print todo summary using \\[todo-print-function]. 821 "Print todo summary using `todo-print-function'.
832If CATEGORY-PR-PAGE is non-nil, a page separator \'^L\' is inserted 822If CATEGORY-PR-PAGE is non-nil, a page separator \'^L\' is inserted
833between each category. 823between each category.
834 824
@@ -903,49 +893,55 @@ Number of entries for each category is given by
903 893
904(defun todo-category-alist () 894(defun todo-category-alist ()
905 "Generate an alist for use in `completing-read' from `todo-categories'." 895 "Generate an alist for use in `completing-read' from `todo-categories'."
906 (mapcar (lambda (cat) (cons cat nil)) 896 (mapcar #'list todo-categories))
907 todo-categories))
908 897
909;; --------------------------------------------------------------------------- 898;; ---------------------------------------------------------------------------
910 899
911(easy-menu-define todo-menu todo-mode-map "Todo Menu" 900(easy-menu-define
912 '("Todo" 901 todo-menu todo-mode-map "Todo Menu"
913 ["Next category" todo-forward-category t] 902 '("Todo"
914 ["Previous category" todo-backward-category t] 903 ["Next category" todo-forward-category t]
915 ["Jump to category" todo-jump-to-category t] 904 ["Previous category" todo-backward-category t]
916 ["Show top priority items" todo-top-priorities t] 905 ["Jump to category" todo-jump-to-category t]
917 ["Print categories" todo-print t] 906 ["Show top priority items" todo-top-priorities t]
918 "---" 907 ["Print categories" todo-print t]
919 ["Edit item" todo-edit-item t] 908 "---"
920 ["File item" todo-file-item t] 909 ["Edit item" todo-edit-item t]
921 ["Insert new item" todo-insert-item t] 910 ["File item" todo-file-item t]
922 ["Insert item here" todo-insert-item-here t] 911 ["Insert new item" todo-insert-item t]
923 ["Kill item" todo-delete-item t] 912 ["Insert item here" todo-insert-item-here t]
924 "---" 913 ["Kill item" todo-delete-item t]
925 ["Lower item priority" todo-lower-item t] 914 "---"
926 ["Raise item priority" todo-raise-item t] 915 ["Lower item priority" todo-lower-item t]
927 "---" 916 ["Raise item priority" todo-raise-item t]
928 ["Next item" todo-forward-item t] 917 "---"
929 ["Previous item" todo-backward-item t] 918 ["Next item" todo-forward-item t]
930 "---" 919 ["Previous item" todo-backward-item t]
931 ["Save" todo-save t] 920 "---"
932 ["Save Top Priorities" todo-save-top-priorities t] 921 ["Save" todo-save t]
933 "---" 922 ["Save Top Priorities" todo-save-top-priorities t]
934 ["Quit" todo-quit t] 923 "---"
935 )) 924 ["Quit" todo-quit t]
925 ))
936 926
937;; As calendar reads .todo-do before todo-mode is loaded. 927;; As calendar reads .todo-do before todo-mode is loaded.
938;;;###autoload 928;;;###autoload
939(defun todo-mode () "Major mode for editing TODO lists.\n\n\\{todo-mode-map}" 929(defun todo-mode ()
930 "Major mode for editing TODO lists.
931
932\\{todo-mode-map}"
940 (interactive) 933 (interactive)
941 (setq major-mode 'todo-mode) 934 (setq major-mode 'todo-mode)
942 (setq mode-name "TODO") 935 (setq mode-name "TODO")
943 (use-local-map todo-mode-map) 936 (use-local-map todo-mode-map)
944 (easy-menu-add todo-menu) 937 (easy-menu-add todo-menu)
945 (setq paragraph-separate "\*/\*")
946 (setq fill-prefix "\t\t") 938 (setq fill-prefix "\t\t")
947 (setq outline-regexp "\\*/\\*") 939 (let ((prefix (regexp-quote todo-prefix)))
940 (setq paragraph-separate prefix)
941 (setq outline-regexp prefix))
948 (outline-minor-mode 1) 942 (outline-minor-mode 1)
943 (goto-char (point-min))
944 (outline-next-heading) ; get past -*- line
949 (hide-other) 945 (hide-other)
950 (auto-fill-mode 1) 946 (auto-fill-mode 1)
951 (run-hooks 'todo-mode-hook)) 947 (run-hooks 'todo-mode-hook))
@@ -953,20 +949,22 @@ Number of entries for each category is given by
953;; Read about this function in the setup instructions above! 949;; Read about this function in the setup instructions above!
954;;;###autoload 950;;;###autoload
955(defun todo-cp () 951(defun todo-cp ()
956 "Make a diary entry appear only in the current date's diary" 952 "Make a diary entry appear only in the current date's diary."
957 (if (equal (calendar-current-date) date) 953 (if (equal (calendar-current-date) date)
958 entry 954 entry))
959 nil))
960 955
961(defun todo-edit-mode () 956(defun todo-edit-mode ()
962 "Major mode for editing items in the TODO list\n\n\\{todo-edit-mode-map}" 957 "Major mode for editing items in the TODO list.
958
959\\{todo-edit-mode-map}"
963 (text-mode) 960 (text-mode)
964 (setq major-mode 'todo-edit-mode) 961 (setq major-mode 'todo-edit-mode)
965 (setq mode-name "TODO Edit") 962 (setq mode-name "TODO Edit")
966 (run-hooks 'todo-edit-mode-hook)) 963 (run-hooks 'todo-edit-mode-hook))
967 964
968;;;###autoload 965;;;###autoload
969(defun todo-show () "Show TODO list." 966(defun todo-show ()
967 "Show TODO list."
970 (interactive) 968 (interactive)
971 (if (file-exists-p todo-file-do) 969 (if (file-exists-p todo-file-do)
972 (find-file todo-file-do) 970 (find-file todo-file-do)
@@ -983,7 +981,8 @@ Number of entries for each category is given by
983 (beginning-of-line) 981 (beginning-of-line)
984 (todo-category-select)) 982 (todo-category-select))
985 983
986(defun todo-initial-setup () "Set up things to work properly in TODO mode." 984(defun todo-initial-setup ()
985 "Set up things to work properly in TODO mode."
987 (find-file todo-file-do) 986 (find-file todo-file-do)
988 (erase-buffer) 987 (erase-buffer)
989 (todo-mode) 988 (todo-mode)