Remove un-needed eval-when-compile.
[bpt/emacs.git] / lisp / calendar / todo-mode.el
index 0caedee..0763454 100644 (file)
@@ -1,6 +1,7 @@
 ;;; todo-mode.el --- major mode for editing TODO list files
 
-;; Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc.
+;; Copyright (C) 1997, 1999, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+;;   Free Software Foundation, Inc.
 
 ;; Author: Oliver Seidel <os10000@seidel-space.de>
 ;;   [Not clear the above works, July 2000]
@@ -11,7 +12,7 @@
 
 ;; GNU Emacs is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
 ;; any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
@@ -21,8 +22,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;; ---------------------------------------------------------------------------
 
 ;;             by the binary insertion algorithm.  However, you may not
 ;;             really have a need for such accurate priorities amongst your
 ;;             TODO items.  If you now think about the binary insertion
-;;             halfing the size of the window each time, then the threshhold
+;;             halving the size of the window each time, then the threshold
 ;;             is the window size at which it will stop.  If you set the
-;;             threshhold to zero, the upper and lower bound will coincide at
+;;             threshold to zero, the upper and lower bound will coincide at
 ;;             the end of the loop and you will insert your item just before
-;;             that point.  If you set the threshhold to, e.g. 8, it will stop
+;;             that point.  If you set the threshold to, e.g. 8, it will stop
 ;;             as soon as the window size drops below that amount and will
 ;;             insert the item in the approximate centre of that window.  I
 ;;             got the idea for this feature after reading a very helpful
 ;;          an event (unless marked by &)
 ;;      o   The optional COUNT variable of todo-forward-item should be
 ;;          applied to the other functions performing similar tasks
-;;      o   Modularization could be done for repeaded elements of
+;;      o   Modularization could be done for repeated elements of
 ;;          the code, like the completing-read lines of code.
 ;;     o   license / version function
 ;;     o   export to diary file
 ;;          outline mode)
 ;;     o   rewrite complete package to store data as lisp objects
 ;;          and have display modes for display, for diary export,
-;;          etc. (Richard Stallman pointed out this is a bad idea)
+;;          etc.  (Richard Stallman pointed out this is a bad idea)
 ;;      o   so base todo-mode.el on generic-mode.el instead
 ;;
 ;;  History and Gossip
 ;;     things to my parents' address!
 ;;
 ;;     Oliver Seidel
-;;     (Lessingstr. 8, 65760 Eschborn, Federal Republic of Germany)
+;;     (Lessingstr.  8, 65760 Eschborn, Federal Republic of Germany)
 
 ;;; Code:
 
   :group 'calendar)
 
 (defcustom todo-prefix     "*/*"
-  "*TODO mode prefix for entries.
+  "TODO mode prefix for entries.
 
 This is useful in conjunction with `calendar' and `diary' if you use
 
@@ -279,46 +280,46 @@ in your diary file to include your todo list file as part of your
 diary.  With the default value \"*/*\" the diary displays each entry
 every day and it may also be marked on every day of the calendar.
 Using \"&%%(equal (calendar-current-date) date)\" instead will only
-show and mark todo entreis for today, but may slow down processing of
+show and mark todo entries for today, but may slow down processing of
 the diary file somewhat."
   :type 'string
   :group 'todo)
 (defcustom todo-file-do    "~/.todo-do"
-  "*TODO mode list file."
+  "TODO mode list file."
   :type 'file
   :group 'todo)
 (defcustom todo-file-done  "~/.todo-done"
-  "*TODO mode archive file."
+  "TODO mode archive file."
   :type 'file
   :group 'todo)
 (defcustom todo-mode-hook  nil
-  "*TODO mode hooks."
+  "TODO mode hooks."
   :type 'hook
   :group 'todo)
 (defcustom todo-edit-mode-hook nil
-  "*TODO Edit mode hooks."
+  "TODO Edit mode hooks."
   :type 'hook
   :group 'todo)
 (defcustom todo-insert-threshold 0
-  "*TODO mode insertion accuracy.
+  "TODO mode insertion accuracy.
 
 If you have 8 items in your TODO list, then you may get asked 4
 questions by the binary insertion algorithm.  However, you may not
 really have a need for such accurate priorities amongst your TODO
-items.  If you now think about the binary insertion halfing the size
-of the window each time, then the threshhold is the window size at
-which it will stop.  If you set the threshhold to zero, the upper and
+items.  If you now think about the binary insertion halving the size
+of the window each time, then the threshold is the window size at
+which it will stop.  If you set the threshold to zero, the upper and
 lower bound will coincide at the end of the loop and you will insert
-your item just before that point.  If you set the threshhold to,
+your item just before that point.  If you set the threshold to,
 e.g. 8, it will stop as soon as the window size drops below that
-amount and will insert the item in the approximate centre of that
+amount and will insert the item in the approximate center of that
 window."
   :type 'integer
   :group 'todo)
 (defvar todo-edit-buffer " *TODO Edit*"
   "TODO Edit buffer name.")
 (defcustom todo-file-top "~/.todo-top"
-  "*TODO mode top priorities file.
+  "TODO mode top priorities file.
 
 Not in TODO format, but diary compatible.
 Automatically generated when `todo-save-top-priorities' is non-nil."
@@ -326,26 +327,26 @@ Automatically generated when `todo-save-top-priorities' is non-nil."
   :group 'todo)
 
 (defcustom todo-print-function 'ps-print-buffer-with-faces
-  "*Function to print the current buffer."
+  "Function to print the current buffer."
   :type 'symbol
   :group 'todo)
 (defcustom todo-show-priorities 1
-  "*Default number of priorities to show by \\[todo-top-priorities].
+  "Default number of priorities to show by \\[todo-top-priorities].
 0 means show all entries."
   :type 'integer
   :group 'todo)
 (defcustom todo-print-priorities 0
-  "*Default number of priorities to print by \\[todo-print].
+  "Default number of priorities to print by \\[todo-print].
 0 means print all entries."
   :type 'integer
   :group 'todo)
 (defcustom todo-remove-separator t
-  "*Non-nil to remove category separators in\
+  "Non-nil to remove category separators in\
 \\[todo-top-priorities] and \\[todo-print]."
   :type 'boolean
   :group 'todo)
 (defcustom todo-save-top-priorities-too t
-  "*Non-nil makes `todo-save' automatically save top-priorities in `todo-file-top'."
+  "Non-nil makes `todo-save' automatically save top-priorities in `todo-file-top'."
   :type 'boolean
   :group 'todo)
 
@@ -354,17 +355,17 @@ Automatically generated when `todo-save-top-priorities' is non-nil."
 ;;
 (defcustom todo-time-string-format
   "%:y-%02m-%02d %02H:%02M"
-  "*TODO mode time string format for done entries.
+  "TODO mode time string format for done entries.
 For details see the variable `time-stamp-format'."
   :type 'string
   :group 'todo)
 
 (defcustom todo-entry-prefix-function 'todo-entry-timestamp-initials
-  "*Function producing text to insert at start of todo entry."
+  "Function producing text to insert at start of todo entry."
   :type 'symbol
   :group 'todo)
 (defcustom todo-initials (or (getenv "INITIALS") (user-login-name))
-  "*Initials of todo item author."
+  "Initials of todo item author."
   :type 'string
   :group 'todo)
 
@@ -591,7 +592,7 @@ With a prefix argument solicit the category, otherwise use the current
 category."
   (interactive "P")
   (save-excursion
-    (if (not (string-equal mode-name "TODO")) (todo-show))
+    (if (not (derived-mode-p 'todo-mode)) (todo-show))
     (let* ((new-item (concat todo-prefix " "
                             (read-from-minibuffer
                              "New TODO entry: "
@@ -614,7 +615,7 @@ category."
   "Insert new TODO list entry under the cursor."
   (interactive "")
   (save-excursion
-    (if (not (string-equal mode-name "TODO")) (todo-show))
+    (if (not (derived-mode-p 'todo-mode)) (todo-show))
     (let* ((new-item (concat todo-prefix " "
                             (read-from-minibuffer
                              "New TODO entry: "
@@ -904,15 +905,18 @@ Number of entries for each category is given by `todo-print-priorities'."
 
 \\{todo-mode-map}"
   (interactive)
+  (kill-all-local-variables)
   (setq major-mode 'todo-mode)
   (setq mode-name "TODO")
   (use-local-map todo-mode-map)
   (easy-menu-add todo-menu)
-  (run-hooks 'todo-mode-hook))
+  (run-mode-hooks 'todo-mode-hook))
 
-(eval-when-compile
-  (defvar date)
-  (defvar entry))
+(defvar date)
+(defvar entry)
+
+;; t-c should be used from diary code, which requires calendar.
+(declare-function calendar-current-date "calendar" nil)
 
 ;; Read about this function in the setup instructions above!
 ;;;###autoload
@@ -954,5 +958,5 @@ Number of entries for each category is given by `todo-print-priorities'."
 
 (provide 'todo-mode)
 
-;;; arch-tag: 6fd91be5-776e-4464-a109-da4ea0e4e497
+;; arch-tag: 6fd91be5-776e-4464-a109-da4ea0e4e497
 ;;; todo-mode.el ends here