changeset 24494:ea1ab7f25110

Alastair Burt <alastair.burt@dfki.de> sent in a patch on 17.Mar.98 which removes duplicates from the category list and saves the buffer after category addition. Thanks. Uwe Brauer <oub@sunma4.mat.ucm.es> sent in a request on 3.Apr.98 to implement a "move-between-categories" function. I haven't done that yet. Thanks. "Edward S. Hirgelt" <ehirgelt@directinterfaces.com> fixed a problem with multi-line editing 29.Oct.98. Thanks. tom <tom@pixelpark.com> sent in a replacement for the outmoded time-format that I had been using on 13.Nov.98. Thanks. Jerome Thebert <thebertj@felixstowe.rms.slb.com> sent in a binding to show/hide continuation lines using the space bar on 11.Jan.99. Instead of leaving it as a hook, I integrated it. Thanks. Sorry again to everybody. I sat on your patches for a year.
author Oliver Seidel <os10000@seidel-space.de>
date Wed, 17 Mar 1999 11:10:29 +0000
parents 8cc1b3739d56
children 14e1df6e60a8
files lisp/calendar/todo-mode.el
diffstat 1 files changed, 48 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/calendar/todo-mode.el	Wed Mar 17 05:16:07 1999 +0000
+++ b/lisp/calendar/todo-mode.el	Wed Mar 17 11:10:29 1999 +0000
@@ -4,7 +4,7 @@
 
 ;; Author: Oliver.Seidel@cl.cam.ac.uk (was valid on Aug 2, 1997)
 ;; Created: 2 Aug 1997
-;; Version: $Id: todo-mode.el,v 1.34 1998/01/12 11:43:22 os10000 Exp os10000 $
+;; Version: $Id: todo-mode.el,v 1.35 1998/09/29 18:20:36 os10000 Exp os10000 $
 ;; Keywords: Categorised TODO list editor, todo-mode
 
 ;; This file is part of GNU Emacs.
@@ -117,15 +117,17 @@
 ;;
 ;;      Which version of todo-mode.el does this documentation refer to?
 ;;
-;;      $Id: todo-mode.el,v 1.34 1998/01/12 11:43:22 os10000 Exp os10000 $
+;;      $Id: todo-mode.el,v 1.35 1998/09/29 18:20:36 os10000 Exp os10000 $
 ;;
 ;;  Pre-Requisites
 ;;
 ;;      This package will require the following packages to be
 ;;      available on the load-path:
 ;;
+;;          cl
+;;          custom
+;;          easymenu
 ;;          time-stamp
-;;          easymenu
 ;;
 ;;  Operation
 ;;
@@ -133,6 +135,8 @@
 ;;
 ;;	    M-x todo-show   will enter the todo list screen, here type
 ;;
+;;        spc  will toggle the display of sub-trees
+;;
 ;;	    +  to go to next category
 ;;          -  to go to previous category
 ;;          d  to file the current entry, including a
@@ -288,6 +292,9 @@
 ;;; Change Log:
 
 ;; $Log: todo-mode.el,v $
+;; Revision 1.35  1998/09/29 18:20:36  os10000
+;; Alex Schroeder startup description added.
+;;
 ;; Revision 1.34  1998/01/12 11:43:22  os10000
 ;; Added patch from Don Hejna <djhejna@oasis.ambit.com>.
 ;;
@@ -598,7 +605,7 @@
 ;; My format string for the appt.el package is "%3b %2d, %y, %02I:%02M%p".
 ;;
 (defcustom todo-time-string-format
-  "%:y-%02m-%02d %02H:%02M"
+  "%04y-%02m-%02d %02H:%02M"
   "*TODO mode time string format for done entries.
 For details see the variable `time-stamp-format'."
   :type 'string
@@ -622,8 +629,9 @@
 
 ;; Get some outside help ...
 
+(require 'cl)
+(require 'easymenu)
 (require 'time-stamp)
-(require 'easymenu)
 
 ;; ---------------------------------------------------------------------------
 
@@ -657,6 +665,8 @@
     nil
   (let ((map (make-keymap)))
     (suppress-keymap map t)
+    (define-key map "?" 'todo-help)
+    (define-key map " " 'todo-hide-show-subtree)
     (define-key map "+" 'todo-forward-category)
     (define-key map "-" 'todo-backward-category)
     (define-key map "d" 'todo-file-item) ;done/delete
@@ -682,7 +692,6 @@
   "Make TODO mode display the current category correctly."
   (let ((name (nth todo-category-number todo-categories)))
     (setq mode-line-buffer-identification
-;;          (concat "Category: " name))
           (concat "Category: " (format "%18s" name)))
     (widen)
     (goto-char (point-min))
@@ -696,6 +705,18 @@
       (goto-char (point-min)))))
 (defalias 'todo-cat-slct 'todo-category-select)
 
+(defun todo-help () "Show TODO mode help."
+  (interactive)
+  (describe-function 'todo-mode))
+
+(defun todo-hide-show-subtree () "Hide or Show subtrees in the TODO list."
+  (interactive)
+  (save-excursion
+    (end-of-line)
+    (if (outline-visible)
+	(hide-subtree)
+      (show-subtree))))
+
 (defun todo-forward-category () "Go forward to TODO list of next category."
   (interactive)
   (setq todo-category-number
@@ -760,7 +781,7 @@
   (let ((buffer-name (generate-new-buffer-name todo-edit-buffer)))
     (switch-to-buffer
      (make-indirect-buffer
-      (file-name-nondirectory todo-file-do) buffer-name))
+      (find-buffer-visiting todo-file-do) buffer-name))
     (message "To exit, simply kill this buffer and return to list.")
     (todo-edit-mode)
     (narrow-to-region (todo-item-start) (todo-item-end))))
@@ -770,7 +791,7 @@
   "Add new category CAT to the TODO list."
   (interactive "sCategory: ")
   (save-window-excursion
-    (setq todo-categories (cons cat todo-categories))
+    (pushnew cat todo-categories)
     (find-file todo-file-do)
     (widen)
     (goto-char (point-min))
@@ -786,7 +807,8 @@
     (insert (format "%s%s%s\n%s\n%s %s\n"
                     todo-prefix todo-category-beg cat
                     todo-category-end
-                    todo-prefix todo-category-sep)))
+                    todo-prefix todo-category-sep))
+    (save-buffer))
   0)
 
 ;;;### autoload
@@ -797,11 +819,9 @@
   (save-excursion
     (if (string= "" category)
         (setq category (nth todo-category-number todo-categories)))
-    (let ((cat-exists (member category todo-categories)))
-      (setq todo-category-number
-            (if cat-exists
-                (- (length todo-categories) (length cat-exists))
-              (todo-add-category category))))
+    (setq todo-category-number
+	    (or (position category todo-categories :test 'equal)
+		(todo-add-category category)))
     (todo-show)
     (setq todo-previous-line 0)
     (let ((top 1)
@@ -819,6 +839,11 @@
       (forward-line (1- top)))
     (insert new-item "\n")
     (todo-backward-item)
+    (progn ;;; horrible os10000 hack to make items appear when inserting into empty buffer
+     (widen)
+     (show-all)
+     (todo-forward-category)
+     (todo-backward-category))
     (todo-save)
     (message "")))
 
@@ -1054,7 +1079,7 @@
   "Jump to a category.  Default is previous category."
   (interactive)
   (let* ((categories todo-categories)
-         (history (cons 'categories (1+ todo-category-number)))
+	 (history (cons 'categories (1+ todo-category-number)))
 	 (category (completing-read
                     (concat "Category ["
                             (nth todo-category-number todo-categories) "]: ")
@@ -1062,10 +1087,8 @@
     (if (string= "" category)
         (setq category (nth todo-category-number todo-categories)))
     (setq todo-category-number
-          (if (member category todo-categories)
-              (- (length todo-categories)
-                 (length (member category todo-categories)))
-            (todo-add-category category)))
+	  (or (position category todo-categories :test 'equal)
+	      (todo-add-category category)))
     (todo-show)))
 
 (defun todo-line-string () "Return current line in buffer as a string."
@@ -1186,6 +1209,12 @@
   (setq mode-name "TODO")
   (use-local-map todo-mode-map)
   (easy-menu-add todo-menu)
+  (setq paragraph-separate "\*/\*")
+  (setq fill-prefix "\t\t")
+  (setq outline-regexp "\\*/\\*")
+  (outline-minor-mode 1)
+  (hide-other)
+  (auto-fill-mode 1)
   (run-hooks 'todo-mode-hook))
 
 ;; Read about this function in the setup instructions above!