Sync to HEAD
[bpt/emacs.git] / lisp / calendar / todo-mode.el
index d6a9e25..0caedee 100644 (file)
@@ -1,11 +1,10 @@
-;; todo-mode.el -- Major mode for editing TODO list files
+;;; todo-mode.el --- major mode for editing TODO list files
 
-;; Copyright (C) 1997, 1999 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc.
 
 ;; Author: Oliver Seidel <os10000@seidel-space.de>
 ;;   [Not clear the above works, July 2000]
 ;; Created: 2 Aug 1997
-;; Version: $Id: todo-mode.el,v 1.1 1999/05/12 11:49:30 fx Exp fx $
 ;; Keywords: calendar, todo
 
 ;; This file is part of GNU Emacs.
 ;;      extensions that are not explicitly listed in the above quick
 ;;      installation.
 ;;
-;;  Version
-;;
-;;      Which version of todo-mode.el does this documentation refer to?
-;;
-;;      $Id: todo-mode.el,v 1.1 1999/05/12 11:49:30 fx Exp fx $
-;;
 ;;  Pre-Requisites
 ;;
 ;;      This package will require the following packages to be
 
 ;;; Code:
 
+(require 'time-stamp)
+
+
 ;; User-configurable variables:
 
 (defgroup todo nil
   "Maintain a list of todo items."
+  :link '(emacs-commentary-link "todo-mode")
+  :version "21.1"
   :group 'calendar)
 
 (defcustom todo-prefix     "*/*"
@@ -370,8 +368,6 @@ For details see the variable `time-stamp-format'."
   :type 'string
   :group 'todo)
 
-(autoload 'time-stamp-string "time-stamp")
-
 (defun todo-entry-timestamp-initials ()
   "Prepend timestamp and your initials to the head of a TODO entry."
   (let ((time-stamp-format todo-time-string-format))
@@ -492,9 +488,10 @@ Use `todo-categories' instead.")
 (defun todo-save ()
   "Save the TODO list."
   (interactive)
-  (save-buffer)
-  (if todo-save-top-priorities-too (todo-save-top-priorities))
-  )
+  (save-excursion
+    (save-restriction
+      (save-buffer)))
+  (if todo-save-top-priorities-too (todo-save-top-priorities)))
 (defalias 'todo-cmd-save 'todo-save)
 
 (defun todo-quit ()
@@ -530,7 +527,7 @@ Use `todo-categories' instead.")
     (todo-edit-mode)
     (narrow-to-region (todo-item-start) (todo-item-end))))
 
-;;;### autoload
+;;;###autoload
 (defun todo-add-category (cat)
   "Add new category CAT to the TODO list."
   (interactive "sCategory: ")
@@ -554,7 +551,7 @@ Use `todo-categories' instead.")
                     todo-prefix todo-category-sep)))
   0)
 
-;;;### autoload
+;;;###autoload
 (defun todo-add-item-non-interactively (new-item category)
   "Insert NEW-ITEM in TODO list as a new entry in CATEGORY."
   (save-excursion
@@ -587,7 +584,7 @@ Use `todo-categories' instead.")
     (todo-save)
     (message "")))
 
-;;;### autoload
+;;;###autoload
 (defun todo-insert-item (arg)
   "Insert new TODO list entry.
 With a prefix argument solicit the category, otherwise use the current
@@ -613,7 +610,6 @@ category."
 
 (defalias 'todo-cmd-inst 'todo-insert-item)
 
-;;;### autoload
 (defun todo-insert-item-here ()
   "Insert new TODO list entry under the cursor."
   (interactive "")
@@ -729,7 +725,7 @@ between each category."
   (or nof-priorities (setq nof-priorities todo-show-priorities))
   (if (listp nof-priorities)            ;universal argument
       (setq nof-priorities (car nof-priorities)))
-  (let ((todo-print-buffer-name "*Tmp*")
+  (let ((todo-print-buffer-name todo-tmp-buffer-name)
         ;;(todo-print-category-number 0)
         (todo-category-break (if category-pr-page "\f" ""))
         (cat-end
@@ -746,10 +742,9 @@ between each category."
         (copy-to-buffer todo-print-buffer-name (point-min) (point-max))
         (set-buffer todo-print-buffer-name)
         (goto-char (point-min))
-        (if (re-search-forward (regexp-quote todo-header) nil t)
-            (progn
-              (beginning-of-line 1)
-              (kill-line)))             ;Remove mode line
+        (when (re-search-forward (regexp-quote todo-header) nil t)
+         (beginning-of-line 1)
+         (delete-region (point) (line-end-position)))
         (while (re-search-forward       ;Find category start
                 (regexp-quote (concat todo-prefix todo-category-beg))
                 nil t)
@@ -775,7 +770,6 @@ between each category."
     (message "Type C-x 1 to remove %s window.  M-C-v to scroll the help."
              todo-print-buffer-name)))
 
-;;;###autoload
 (defun todo-save-top-priorities (&optional nof-priorities)
   "Save top priorities for each category in `todo-file-top'.
 
@@ -904,7 +898,7 @@ Number of entries for each category is given by `todo-print-priorities'."
                     ))
 
 ;; As calendar reads .todo-do before todo-mode is loaded.
-;;;### autoload
+;;;###autoload
 (defun todo-mode ()
   "Major mode for editing TODO lists.
 
@@ -921,7 +915,7 @@ Number of entries for each category is given by `todo-print-priorities'."
   (defvar entry))
 
 ;; Read about this function in the setup instructions above!
-;;;### autoload
+;;;###autoload
 (defun todo-cp ()
   "Make a diary entry appear only in the current date's diary."
   (if (equal (calendar-current-date) date)
@@ -932,7 +926,7 @@ Number of entries for each category is given by `todo-print-priorities'."
 
 \\{todo-edit-mode-map}")
 
-;;;### autoload
+;;;###autoload
 (defun todo-show ()
   "Show TODO list."
   (interactive)
@@ -960,4 +954,5 @@ Number of entries for each category is given by `todo-print-priorities'."
 
 (provide 'todo-mode)
 
+;;; arch-tag: 6fd91be5-776e-4464-a109-da4ea0e4e497
 ;;; todo-mode.el ends here