2001-07-16 12:23:00 +00:00
|
|
|
|
;;; todo-mode.el --- major mode for editing TODO list files
|
1997-08-03 12:15:13 +00:00
|
|
|
|
|
2001-07-05 13:51:17 +00:00
|
|
|
|
;; Copyright (C) 1997, 1999, 2001 Free Software Foundation, Inc.
|
1997-08-03 12:15:13 +00:00
|
|
|
|
|
2000-07-04 11:15:24 +00:00
|
|
|
|
;; Author: Oliver Seidel <os10000@seidel-space.de>
|
|
|
|
|
;; [Not clear the above works, July 2000]
|
1997-08-19 14:00:36 +00:00
|
|
|
|
;; Created: 2 Aug 1997
|
2001-12-11 07:36:30 +00:00
|
|
|
|
;; Version: $Id: todo-mode.el,v 1.49 2001/11/17 04:01:31 rms Exp $
|
2000-07-04 11:15:24 +00:00
|
|
|
|
;; Keywords: calendar, todo
|
1997-08-03 12:15:13 +00:00
|
|
|
|
|
1997-08-19 14:00:36 +00:00
|
|
|
|
;; This file is part of GNU Emacs.
|
1997-08-05 22:39:04 +00:00
|
|
|
|
|
1997-08-19 14:00:36 +00:00
|
|
|
|
;; GNU Emacs is free software; you can redistribute it and/or modify
|
1997-08-05 22:39:04 +00:00
|
|
|
|
;; it under the terms of the GNU General Public License as published by
|
|
|
|
|
;; the Free Software Foundation; either version 2, or (at your option)
|
|
|
|
|
;; any later version.
|
1997-08-19 14:00:36 +00:00
|
|
|
|
|
|
|
|
|
;; GNU Emacs is distributed in the hope that it will be useful,
|
1997-08-05 22:39:04 +00:00
|
|
|
|
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
;; GNU General Public License for more details.
|
1997-08-19 14:00:36 +00:00
|
|
|
|
|
1997-08-05 22:39:04 +00:00
|
|
|
|
;; 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.
|
|
|
|
|
|
|
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
|
|
1997-08-19 14:00:36 +00:00
|
|
|
|
;;; Commentary:
|
|
|
|
|
|
1997-10-28 21:14:51 +00:00
|
|
|
|
;; Mode Description
|
|
|
|
|
;;
|
|
|
|
|
;; TODO is a major mode for EMACS which offers functionality to
|
|
|
|
|
;; treat most lines in one buffer as a list of items one has to
|
|
|
|
|
;; do. There are facilities to add new items, which are
|
|
|
|
|
;; categorised, to edit or even delete items from the buffer.
|
|
|
|
|
;; The buffer contents are currently compatible with the diary,
|
|
|
|
|
;; so that the list of todo-items will show up in the FANCY diary
|
|
|
|
|
;; mode.
|
|
|
|
|
;;
|
|
|
|
|
;; Notice: Besides the major mode, this file also exports the
|
|
|
|
|
;; function `todo-show' which will change to the one specific
|
|
|
|
|
;; TODO file that has been specified in the todo-file-do
|
|
|
|
|
;; variable. If this file does not conform to the TODO mode
|
|
|
|
|
;; conventions, the todo-show function will add the appropriate
|
|
|
|
|
;; header and footer. I don't anticipate this to cause much
|
|
|
|
|
;; grief, but be warned, in case you attempt to read a plain text
|
|
|
|
|
;; file.
|
|
|
|
|
;;
|
1997-10-16 21:21:16 +00:00
|
|
|
|
;; Preface, Quickstart Installation
|
1997-08-05 22:39:04 +00:00
|
|
|
|
;;
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; To get this to work, make emacs execute the line
|
1997-08-05 22:34:14 +00:00
|
|
|
|
;;
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; (autoload 'todo-mode "todo-mode"
|
1997-10-24 17:30:54 +00:00
|
|
|
|
;; "Major mode for editing TODO lists." t)
|
|
|
|
|
;; (autoload 'todo-show "todo-mode"
|
|
|
|
|
;; "Show TODO items." t)
|
|
|
|
|
;; (autoload 'todo-insert-item "todo-mode"
|
|
|
|
|
;; "Add TODO item." t)
|
1997-08-19 14:00:36 +00:00
|
|
|
|
;;
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; You may now enter new items by typing "M-x todo-insert-item",
|
|
|
|
|
;; or enter your TODO list file by typing "M-x todo-show".
|
|
|
|
|
;;
|
|
|
|
|
;; The TODO list file has a special format and some auxiliary
|
|
|
|
|
;; information, which will be added by the todo-show function if
|
|
|
|
|
;; it attempts to visit an un-initialised file. Hence it is
|
|
|
|
|
;; recommended to use the todo-show function for the first time,
|
|
|
|
|
;; in order to initialise the file, but it is not necessary
|
|
|
|
|
;; afterwards.
|
|
|
|
|
;;
|
|
|
|
|
;; As these commands are quite long to type, I would recommend
|
|
|
|
|
;; the addition of two bindings to your to your global keymap. I
|
|
|
|
|
;; personally have the following in my initialisation file:
|
|
|
|
|
;;
|
|
|
|
|
;; (global-set-key "\C-ct" 'todo-show) ;; switch to TODO buffer
|
1997-10-16 21:21:16 +00:00
|
|
|
|
;; (global-set-key "\C-ci" 'todo-insert-item) ;; insert new item
|
1997-08-19 14:00:36 +00:00
|
|
|
|
;;
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; Note, however, that this recommendation has prompted some
|
|
|
|
|
;; criticism, since the keys C-c LETTER are reserved for user
|
|
|
|
|
;; functions. I believe my recommendation is acceptable, since
|
|
|
|
|
;; the Emacs Lisp Manual *Tips* section also details that the
|
|
|
|
|
;; mode itself should not bind any functions to those keys. The
|
|
|
|
|
;; express aim of the above two bindings is to work outside the
|
|
|
|
|
;; mode, which doesn't need the show function and offers a
|
|
|
|
|
;; different binding for the insert function. They serve as
|
|
|
|
|
;; shortcuts and are not even needed (since the TODO mode will be
|
|
|
|
|
;; entered by visiting the TODO file, and later by switching to
|
|
|
|
|
;; its buffer).
|
|
|
|
|
;;
|
1997-10-28 21:37:05 +00:00
|
|
|
|
;; If you are an advanced user of this package, please consult
|
|
|
|
|
;; the whole source code for autoloads, because there are several
|
|
|
|
|
;; extensions that are not explicitly listed in the above quick
|
|
|
|
|
;; installation.
|
|
|
|
|
;;
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; Version
|
1997-08-19 14:00:36 +00:00
|
|
|
|
;;
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; Which version of todo-mode.el does this documentation refer to?
|
1997-08-06 08:12:03 +00:00
|
|
|
|
;;
|
2001-12-11 07:36:30 +00:00
|
|
|
|
;; $Id: todo-mode.el,v 1.49 2001/11/17 04:01:31 rms Exp $
|
2000-07-04 11:15:24 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Pre-Requisites
|
|
|
|
|
;;
|
|
|
|
|
;; This package will require the following packages to be
|
|
|
|
|
;; available on the load-path:
|
|
|
|
|
;;
|
|
|
|
|
;; time-stamp
|
|
|
|
|
;; easymenu
|
1997-10-16 21:21:16 +00:00
|
|
|
|
;;
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; Operation
|
1997-10-16 21:21:16 +00:00
|
|
|
|
;;
|
|
|
|
|
;; You will have the following facilities available:
|
|
|
|
|
;;
|
|
|
|
|
;; M-x todo-show will enter the todo list screen, here type
|
|
|
|
|
;;
|
|
|
|
|
;; + to go to next category
|
|
|
|
|
;; - to go to previous category
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; d to file the current entry, including a
|
|
|
|
|
;; comment and timestamp
|
1997-10-16 21:21:16 +00:00
|
|
|
|
;; e to edit the current entry
|
1997-10-28 21:59:48 +00:00
|
|
|
|
;; E to edit a multi-line entry
|
1997-10-16 21:21:16 +00:00
|
|
|
|
;; f to file the current entry, including a
|
|
|
|
|
;; comment and timestamp
|
1997-10-28 22:16:24 +00:00
|
|
|
|
;; i to insert a new entry, with prefix, omit category
|
1997-10-28 21:59:48 +00:00
|
|
|
|
;; I to insert a new entry at current cursor position
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; j jump to category
|
1997-10-16 21:21:16 +00:00
|
|
|
|
;; k to kill the current entry
|
|
|
|
|
;; l to lower the current entry's priority
|
|
|
|
|
;; n for the next entry
|
|
|
|
|
;; p for the previous entry
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; P print
|
1997-10-16 21:21:16 +00:00
|
|
|
|
;; q to save the list and exit the buffer
|
|
|
|
|
;; r to raise the current entry's priority
|
|
|
|
|
;; s to save the list
|
1997-10-28 20:03:27 +00:00
|
|
|
|
;; S to save the list of top priorities
|
1997-10-28 21:14:51 +00:00
|
|
|
|
;; t show top priority items for each category
|
1997-10-16 21:21:16 +00:00
|
|
|
|
;;
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; When you add a new entry, you are asked for the text and then
|
|
|
|
|
;; for the category. I for example have categories for things
|
|
|
|
|
;; that I want to do in the office (like mail my mum), that I
|
|
|
|
|
;; want to do in town (like buy cornflakes) and things I want to
|
|
|
|
|
;; do at home (move my suitcases). The categories can be
|
|
|
|
|
;; selected with the cursor keys and if you type in the name of a
|
|
|
|
|
;; category which didn't exist before, an empty category of the
|
|
|
|
|
;; desired name will be added and filled with the new entry.
|
1997-10-16 21:21:16 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Configuration
|
|
|
|
|
;;
|
|
|
|
|
;; Variable todo-prefix
|
|
|
|
|
;;
|
|
|
|
|
;; I would like to recommend that you use the prefix "*/*" (by
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; leaving the variable 'todo-prefix' untouched) so that the
|
|
|
|
|
;; diary displays each entry every day.
|
1997-10-16 21:21:16 +00:00
|
|
|
|
;;
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; To understand what I mean, please read the documentation that
|
|
|
|
|
;; goes with the calendar since that will tell you how you can
|
|
|
|
|
;; set up the fancy diary display and use the #include command to
|
|
|
|
|
;; include your todo list file as part of your diary.
|
1997-10-16 21:21:16 +00:00
|
|
|
|
;;
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; If you have the diary package set up to usually display more
|
|
|
|
|
;; than one day's entries at once, consider using
|
1997-10-16 21:21:16 +00:00
|
|
|
|
;;
|
|
|
|
|
;; "&%%(equal (calendar-current-date) date)"
|
|
|
|
|
;;
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; as the value of `todo-prefix'. Please note that this may slow
|
|
|
|
|
;; down the processing of your diary file some.
|
1997-10-16 21:21:16 +00:00
|
|
|
|
;;
|
1997-10-28 21:37:05 +00:00
|
|
|
|
;; Carsten Dominik <dominik@strw.LeidenUniv.nl> suggested that
|
|
|
|
|
;;
|
|
|
|
|
;; "&%%(todo-cp)"
|
|
|
|
|
;;
|
|
|
|
|
;; might be nicer and to that effect a function has been declared
|
|
|
|
|
;; further down in the code. You may wish to auto-load this.
|
|
|
|
|
;;
|
|
|
|
|
;; Carsten also writes that that *changing* the prefix after the
|
|
|
|
|
;; todo list is already established is not as simple as changing
|
|
|
|
|
;; the variable - the todo files have to be changed by hand.
|
|
|
|
|
;;
|
1997-10-16 21:21:16 +00:00
|
|
|
|
;; Variable todo-file-do
|
|
|
|
|
;;
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; This variable is fairly self-explanatory. You have to store
|
|
|
|
|
;; your TODO list somewhere. This variable tells the package
|
|
|
|
|
;; where to go and find this file.
|
1997-10-16 21:21:16 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Variable todo-file-done
|
|
|
|
|
;;
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; Even when you're done, you may wish to retain the entries.
|
|
|
|
|
;; Given that they're timestamped and you are offered to add a
|
|
|
|
|
;; comment, this can make a useful diary of past events. It will
|
|
|
|
|
;; even blend in with the EMACS diary package. So anyway, this
|
|
|
|
|
;; variable holds the name of the file for the filed todo-items.
|
1997-10-16 21:21:16 +00:00
|
|
|
|
;;
|
1997-10-28 20:03:27 +00:00
|
|
|
|
;; Variable todo-file-top
|
|
|
|
|
;;
|
|
|
|
|
;; File storing the top priorities of your TODO list when
|
|
|
|
|
;; todo-save-top-priorities is non-nil. Nice to include in your
|
|
|
|
|
;; diary instead of the complete TODO list.
|
|
|
|
|
;;
|
1997-10-16 21:21:16 +00:00
|
|
|
|
;; Variable todo-mode-hook
|
|
|
|
|
;;
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; Just like other modes, too, this mode offers to call your
|
|
|
|
|
;; functions before it goes about its business. This variable
|
|
|
|
|
;; will be inspected for any functions you may wish to have
|
|
|
|
|
;; called once the other TODO mode preparations have been
|
|
|
|
|
;; completed.
|
|
|
|
|
;;
|
|
|
|
|
;; Variable todo-insert-threshold
|
|
|
|
|
;;
|
|
|
|
|
;; Another nifty feature is the 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 lower bound will coincide at
|
|
|
|
|
;; the end of the loop and you will insert your item just before
|
1997-10-28 21:14:51 +00:00
|
|
|
|
;; that point. If you set the threshhold to, e.g. 8, it will stop
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; 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
|
|
|
|
|
;; e-mail reply from Trey Jackson <trey@cs.berkeley.edu> who
|
|
|
|
|
;; corrected some of my awful coding and pointed me towards some
|
|
|
|
|
;; good reading. Thanks Trey!
|
1997-10-16 21:21:16 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Things to do
|
|
|
|
|
;;
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; These originally were my ideas, but now also include all the
|
|
|
|
|
;; suggestions that I included before forgetting them:
|
|
|
|
|
;;
|
|
|
|
|
;; o Fancy fonts for todo/top-priority buffer
|
|
|
|
|
;; o Remove todo-prefix option in todo-top-priorities
|
|
|
|
|
;; o Rename category
|
|
|
|
|
;; o Move entry from one category to another one
|
|
|
|
|
;; o Entries which both have the generic */* prefix and a
|
|
|
|
|
;; "deadline" entry which are understood by diary, indicating
|
|
|
|
|
;; 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
|
1998-09-29 18:20:36 +00:00
|
|
|
|
;; the code, like the completing-read lines of code.
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; o license / version function
|
1997-10-16 21:21:16 +00:00
|
|
|
|
;; o export to diary file
|
|
|
|
|
;; o todo-report-bug
|
|
|
|
|
;; o GNATS support
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; o elide multiline (as in bbdb, or, to a lesser degree, in
|
|
|
|
|
;; 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)
|
|
|
|
|
;; o so base todo-mode.el on generic-mode.el instead
|
1997-10-16 21:21:16 +00:00
|
|
|
|
;;
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; History and Gossip
|
1997-10-16 21:21:16 +00:00
|
|
|
|
;;
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; Many thanks to all the ones who have contributed to the
|
|
|
|
|
;; evolution of this package! I hope I have listed all of you
|
|
|
|
|
;; somewhere in the documentation or at least in the RCS history!
|
1997-10-16 21:21:16 +00:00
|
|
|
|
;;
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; Enjoy this package and express your gratitude by sending nice
|
|
|
|
|
;; things to my parents' address!
|
1997-10-16 21:21:16 +00:00
|
|
|
|
;;
|
|
|
|
|
;; Oliver Seidel
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; (Lessingstr. 8, 65760 Eschborn, Federal Republic of Germany)
|
1997-08-03 12:47:26 +00:00
|
|
|
|
|
1997-08-19 14:00:36 +00:00
|
|
|
|
;;; Code:
|
|
|
|
|
|
2001-12-11 07:36:30 +00:00
|
|
|
|
(require 'time-stamp)
|
|
|
|
|
|
|
|
|
|
|
1997-08-03 12:15:13 +00:00
|
|
|
|
;; User-configurable variables:
|
|
|
|
|
|
1997-10-28 21:14:51 +00:00
|
|
|
|
(defgroup todo nil
|
|
|
|
|
"Maintain a list of todo items."
|
2001-01-02 14:06:15 +00:00
|
|
|
|
:link '(emacs-commentary-link "todo-mode")
|
|
|
|
|
:version "21.1"
|
1997-10-28 21:14:51 +00:00
|
|
|
|
:group 'calendar)
|
|
|
|
|
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(defcustom todo-prefix "*/*"
|
1997-10-28 21:14:51 +00:00
|
|
|
|
"*TODO mode prefix for entries.
|
|
|
|
|
|
|
|
|
|
This is useful in conjunction with `calendar' and `diary' if you use
|
|
|
|
|
|
|
|
|
|
#include \"~/.todo-do\"
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
the diary file somewhat."
|
|
|
|
|
:type 'string
|
|
|
|
|
:group 'todo)
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(defcustom todo-file-do "~/.todo-do"
|
1997-10-28 21:14:51 +00:00
|
|
|
|
"*TODO mode list file."
|
|
|
|
|
:type 'file
|
|
|
|
|
:group 'todo)
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(defcustom todo-file-done "~/.todo-done"
|
1997-10-28 21:14:51 +00:00
|
|
|
|
"*TODO mode archive file."
|
|
|
|
|
:type 'file
|
|
|
|
|
:group 'todo)
|
|
|
|
|
(defcustom todo-mode-hook nil
|
|
|
|
|
"*TODO mode hooks."
|
|
|
|
|
:type 'hook
|
|
|
|
|
:group 'todo)
|
|
|
|
|
(defcustom todo-edit-mode-hook nil
|
|
|
|
|
"*TODO Edit mode hooks."
|
|
|
|
|
:type 'hook
|
|
|
|
|
:group 'todo)
|
|
|
|
|
(defcustom todo-insert-threshold 0
|
|
|
|
|
"*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
|
|
|
|
|
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 as soon as the window size drops below that
|
|
|
|
|
amount and will insert the item in the approximate centre of that
|
|
|
|
|
window."
|
|
|
|
|
:type 'integer
|
|
|
|
|
:group 'todo)
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(defvar todo-edit-buffer " *TODO Edit*"
|
|
|
|
|
"TODO Edit buffer name.")
|
1997-10-28 21:14:51 +00:00
|
|
|
|
(defcustom todo-file-top "~/.todo-top"
|
1997-10-28 20:03:27 +00:00
|
|
|
|
"*TODO mode top priorities file.
|
1997-10-28 21:14:51 +00:00
|
|
|
|
|
1997-10-28 20:03:27 +00:00
|
|
|
|
Not in TODO format, but diary compatible.
|
1997-10-28 21:14:51 +00:00
|
|
|
|
Automatically generated when `todo-save-top-priorities' is non-nil."
|
|
|
|
|
:type 'string
|
|
|
|
|
:group 'todo)
|
|
|
|
|
|
|
|
|
|
(defcustom todo-print-function 'ps-print-buffer-with-faces
|
|
|
|
|
"*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].
|
|
|
|
|
0 means show all entries."
|
|
|
|
|
:type 'integer
|
|
|
|
|
:group 'todo)
|
|
|
|
|
(defcustom todo-print-priorities 0
|
|
|
|
|
"*Default number of priorities to print by \\[todo-print].
|
|
|
|
|
0 means print all entries."
|
|
|
|
|
:type 'integer
|
|
|
|
|
:group 'todo)
|
|
|
|
|
(defcustom todo-remove-separator t
|
2000-07-04 11:15:24 +00:00
|
|
|
|
"*Non-nil to remove category separators in\
|
1997-10-28 21:14:51 +00:00
|
|
|
|
\\[todo-top-priorities] and \\[todo-print]."
|
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'todo)
|
|
|
|
|
(defcustom todo-save-top-priorities-too t
|
2000-06-02 18:37:43 +00:00
|
|
|
|
"*Non-nil makes `todo-save' automatically save top-priorities in `todo-file-top'."
|
1997-10-28 21:14:51 +00:00
|
|
|
|
:type 'boolean
|
|
|
|
|
:group 'todo)
|
1997-10-17 15:41:57 +00:00
|
|
|
|
|
1997-08-19 14:00:36 +00:00
|
|
|
|
;; Thanks for the ISO time stamp format go to Karl Eichwalder <ke@suse.de>
|
|
|
|
|
;; My format string for the appt.el package is "%3b %2d, %y, %02I:%02M%p".
|
|
|
|
|
;;
|
1997-10-28 21:14:51 +00:00
|
|
|
|
(defcustom todo-time-string-format
|
2000-07-04 11:15:24 +00:00
|
|
|
|
"%:y-%02m-%02d %02H:%02M"
|
1997-10-28 21:14:51 +00:00
|
|
|
|
"*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."
|
|
|
|
|
:type 'symbol
|
|
|
|
|
:group 'todo)
|
|
|
|
|
(defcustom todo-initials (or (getenv "INITIALS") (user-login-name))
|
|
|
|
|
"*Initials of todo item author."
|
|
|
|
|
:type 'string
|
|
|
|
|
:group 'todo)
|
1997-10-17 15:41:57 +00:00
|
|
|
|
|
|
|
|
|
(defun todo-entry-timestamp-initials ()
|
1997-10-28 20:03:27 +00:00
|
|
|
|
"Prepend timestamp and your initials to the head of a TODO entry."
|
1997-10-17 15:41:57 +00:00
|
|
|
|
(let ((time-stamp-format todo-time-string-format))
|
|
|
|
|
(concat (time-stamp-string) " " todo-initials ": ")))
|
|
|
|
|
|
2000-07-04 11:15:24 +00:00
|
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
|
|
1997-08-06 10:56:15 +00:00
|
|
|
|
;; Set up some helpful context ...
|
|
|
|
|
|
2000-05-12 10:58:13 +00:00
|
|
|
|
(defvar todo-categories nil
|
|
|
|
|
"TODO categories.")
|
2000-07-04 11:15:24 +00:00
|
|
|
|
|
2000-05-12 10:58:13 +00:00
|
|
|
|
(defvar todo-cats nil
|
1997-10-28 21:14:51 +00:00
|
|
|
|
"Old variable for holding the TODO categories.
|
|
|
|
|
Use `todo-categories' instead.")
|
1997-10-17 15:41:57 +00:00
|
|
|
|
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(defvar todo-previous-line 0
|
|
|
|
|
"Previous line asked about.")
|
1997-10-17 15:41:57 +00:00
|
|
|
|
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(defvar todo-previous-answer 0
|
|
|
|
|
"Previous answer got.")
|
1997-08-06 10:56:15 +00:00
|
|
|
|
|
2000-05-12 10:58:13 +00:00
|
|
|
|
(defvar todo-mode-map
|
1997-08-05 22:34:14 +00:00
|
|
|
|
(let ((map (make-keymap)))
|
|
|
|
|
(suppress-keymap map t)
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(define-key map "+" 'todo-forward-category)
|
|
|
|
|
(define-key map "-" 'todo-backward-category)
|
1997-10-28 21:59:48 +00:00
|
|
|
|
(define-key map "d" 'todo-file-item) ;done/delete
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(define-key map "e" 'todo-edit-item)
|
|
|
|
|
(define-key map "E" 'todo-edit-multiline)
|
|
|
|
|
(define-key map "f" 'todo-file-item)
|
|
|
|
|
(define-key map "i" 'todo-insert-item)
|
1997-10-28 21:47:12 +00:00
|
|
|
|
(define-key map "I" 'todo-insert-item-here)
|
1997-10-17 15:41:57 +00:00
|
|
|
|
(define-key map "j" 'todo-jump-to-category)
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(define-key map "k" 'todo-delete-item)
|
|
|
|
|
(define-key map "l" 'todo-lower-item)
|
|
|
|
|
(define-key map "n" 'todo-forward-item)
|
|
|
|
|
(define-key map "p" 'todo-backward-item)
|
1997-10-17 15:41:57 +00:00
|
|
|
|
(define-key map "P" 'todo-print)
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(define-key map "q" 'todo-quit)
|
|
|
|
|
(define-key map "r" 'todo-raise-item)
|
|
|
|
|
(define-key map "s" 'todo-save)
|
1997-10-28 20:03:27 +00:00
|
|
|
|
(define-key map "S" 'todo-save-top-priorities)
|
1997-10-17 15:41:57 +00:00
|
|
|
|
(define-key map "t" 'todo-top-priorities)
|
2000-05-12 10:58:13 +00:00
|
|
|
|
map)
|
|
|
|
|
"TODO mode keymap.")
|
|
|
|
|
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(defvar todo-category-number 0 "TODO category number.")
|
|
|
|
|
|
|
|
|
|
(defvar todo-tmp-buffer-name " *todo tmp*")
|
|
|
|
|
|
|
|
|
|
(defvar todo-category-sep (make-string 75 ?-)
|
|
|
|
|
"Category separator.")
|
|
|
|
|
|
|
|
|
|
(defvar todo-category-beg " --- "
|
|
|
|
|
"Category start separator to be prepended onto category name.")
|
|
|
|
|
|
|
|
|
|
(defvar todo-category-end "--- End"
|
|
|
|
|
"Separator after a category.")
|
|
|
|
|
|
|
|
|
|
(defvar todo-header "-*- mode: todo; "
|
|
|
|
|
"Header of todo files.")
|
|
|
|
|
|
|
|
|
|
;; ---------------------------------------------------------------------------
|
1997-08-03 12:15:13 +00:00
|
|
|
|
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(defun todo-category-select ()
|
|
|
|
|
"Make TODO mode display the current category correctly."
|
|
|
|
|
(let ((name (nth todo-category-number todo-categories)))
|
1997-08-06 08:12:03 +00:00
|
|
|
|
(setq mode-line-buffer-identification
|
2000-07-04 11:15:24 +00:00
|
|
|
|
;; (concat "Category: " name))
|
1998-01-12 11:43:22 +00:00
|
|
|
|
(concat "Category: " (format "%18s" name)))
|
1997-08-05 14:43:39 +00:00
|
|
|
|
(widen)
|
|
|
|
|
(goto-char (point-min))
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(search-forward-regexp
|
1997-10-17 15:41:57 +00:00
|
|
|
|
(concat "^"
|
|
|
|
|
(regexp-quote (concat todo-prefix todo-category-beg name))
|
|
|
|
|
"$"))
|
2000-05-12 10:58:13 +00:00
|
|
|
|
(let ((begin (1+ (line-end-position))))
|
1997-10-17 15:41:57 +00:00
|
|
|
|
(search-forward-regexp (concat "^" todo-category-end))
|
2000-05-12 10:58:13 +00:00
|
|
|
|
(narrow-to-region begin (line-beginning-position))
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(goto-char (point-min)))))
|
|
|
|
|
(defalias 'todo-cat-slct 'todo-category-select)
|
|
|
|
|
|
2000-05-12 10:58:13 +00:00
|
|
|
|
(defun todo-forward-category ()
|
|
|
|
|
"Go forward to TODO list of next category."
|
1997-08-05 14:43:39 +00:00
|
|
|
|
(interactive)
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(setq todo-category-number
|
1997-10-16 21:21:16 +00:00
|
|
|
|
(mod (1+ todo-category-number) (length todo-categories)))
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(todo-category-select))
|
|
|
|
|
(defalias 'todo-cmd-forw 'todo-forward-category)
|
1997-08-05 14:43:39 +00:00
|
|
|
|
|
2000-05-12 10:58:13 +00:00
|
|
|
|
(defun todo-backward-category ()
|
|
|
|
|
"Go back to TODO list of previous category."
|
1997-08-05 14:43:39 +00:00
|
|
|
|
(interactive)
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(setq todo-category-number
|
1997-10-16 21:21:16 +00:00
|
|
|
|
(mod (1- todo-category-number) (length todo-categories)))
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(todo-category-select))
|
|
|
|
|
(defalias 'todo-cmd-back 'todo-backward-category)
|
1997-08-05 14:43:39 +00:00
|
|
|
|
|
2000-05-12 10:58:13 +00:00
|
|
|
|
(defun todo-backward-item ()
|
|
|
|
|
"Select previous entry of TODO list."
|
1997-08-03 12:15:13 +00:00
|
|
|
|
(interactive)
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(search-backward-regexp (concat "^" (regexp-quote todo-prefix)) nil t)
|
1997-08-06 10:56:15 +00:00
|
|
|
|
(message ""))
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(defalias 'todo-cmd-prev 'todo-backward-item)
|
1997-08-03 12:15:13 +00:00
|
|
|
|
|
1997-10-17 15:41:57 +00:00
|
|
|
|
(defun todo-forward-item (&optional count)
|
1997-10-28 21:14:51 +00:00
|
|
|
|
"Select COUNT-th next entry of TODO list."
|
1997-10-17 15:41:57 +00:00
|
|
|
|
(interactive "P")
|
|
|
|
|
(if (listp count) (setq count (car count)))
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(end-of-line)
|
1997-10-17 15:41:57 +00:00
|
|
|
|
(search-forward-regexp (concat "^" (regexp-quote todo-prefix))
|
|
|
|
|
nil 'goto-end count)
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(beginning-of-line)
|
1997-08-06 10:56:15 +00:00
|
|
|
|
(message ""))
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(defalias 'todo-cmd-next 'todo-forward-item)
|
1997-08-03 12:15:13 +00:00
|
|
|
|
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(defun todo-save ()
|
|
|
|
|
"Save the TODO list."
|
1997-08-05 14:43:39 +00:00
|
|
|
|
(interactive)
|
2001-11-13 04:11:29 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(save-restriction
|
2001-11-17 04:01:31 +00:00
|
|
|
|
(save-buffer)))
|
|
|
|
|
(if todo-save-top-priorities-too (todo-save-top-priorities)))
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(defalias 'todo-cmd-save 'todo-save)
|
1997-08-05 14:43:39 +00:00
|
|
|
|
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(defun todo-quit ()
|
|
|
|
|
"Done with TODO list for now."
|
1997-08-03 12:15:13 +00:00
|
|
|
|
(interactive)
|
1997-08-05 14:43:39 +00:00
|
|
|
|
(widen)
|
1997-10-28 20:03:27 +00:00
|
|
|
|
(todo-save)
|
1997-08-03 12:47:26 +00:00
|
|
|
|
(message "")
|
1997-08-06 10:56:15 +00:00
|
|
|
|
(bury-buffer))
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(defalias 'todo-cmd-done 'todo-quit)
|
1997-08-03 12:15:13 +00:00
|
|
|
|
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(defun todo-edit-item ()
|
|
|
|
|
"Edit current TODO list entry."
|
1997-08-03 12:15:13 +00:00
|
|
|
|
(interactive)
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(let ((item (todo-item-string)))
|
|
|
|
|
(if (todo-string-multiline-p item)
|
1997-10-16 21:21:16 +00:00
|
|
|
|
(todo-edit-multiline)
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(let ((new (read-from-minibuffer "Edit: " item)))
|
1997-10-16 21:21:16 +00:00
|
|
|
|
(todo-remove-item)
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(insert new "\n")
|
1997-10-16 21:21:16 +00:00
|
|
|
|
(todo-backward-item)
|
|
|
|
|
(message "")))))
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(defalias 'todo-cmd-edit 'todo-edit-item)
|
|
|
|
|
|
|
|
|
|
(defun todo-edit-multiline ()
|
|
|
|
|
"Set up a buffer for editing a multiline TODO list entry."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let ((buffer-name (generate-new-buffer-name todo-edit-buffer)))
|
1997-10-17 15:41:57 +00:00
|
|
|
|
(switch-to-buffer
|
|
|
|
|
(make-indirect-buffer
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(file-name-nondirectory todo-file-do) buffer-name))
|
1997-10-14 22:22:35 +00:00
|
|
|
|
(message "To exit, simply kill this buffer and return to list.")
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(todo-edit-mode)
|
|
|
|
|
(narrow-to-region (todo-item-start) (todo-item-end))))
|
1997-08-03 12:15:13 +00:00
|
|
|
|
|
2001-01-02 14:06:15 +00:00
|
|
|
|
;;;###autoload
|
1998-09-29 18:20:36 +00:00
|
|
|
|
(defun todo-add-category (cat)
|
1997-10-28 21:14:51 +00:00
|
|
|
|
"Add new category CAT to the TODO list."
|
1997-12-03 12:18:20 +00:00
|
|
|
|
(interactive "sCategory: ")
|
1997-08-03 12:15:13 +00:00
|
|
|
|
(save-window-excursion
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(setq todo-categories (cons cat todo-categories))
|
1997-08-03 12:15:13 +00:00
|
|
|
|
(find-file todo-file-do)
|
1997-08-05 14:43:39 +00:00
|
|
|
|
(widen)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(let ((posn (search-forward "-*- mode: todo; " 17 t)))
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(if (not (null posn)) (goto-char posn))
|
|
|
|
|
(if (equal posn nil)
|
1997-10-16 21:21:16 +00:00
|
|
|
|
(progn
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(insert "-*- mode: todo; \n")
|
|
|
|
|
(forward-char -1))
|
|
|
|
|
(kill-line)))
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(insert (format "todo-categories: %S; -*-" todo-categories))
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(forward-char 1)
|
1997-10-17 15:41:57 +00:00
|
|
|
|
(insert (format "%s%s%s\n%s\n%s %s\n"
|
|
|
|
|
todo-prefix todo-category-beg cat
|
1998-09-29 18:20:36 +00:00
|
|
|
|
todo-category-end
|
2000-07-04 11:15:24 +00:00
|
|
|
|
todo-prefix todo-category-sep)))
|
1997-08-06 10:56:15 +00:00
|
|
|
|
0)
|
1997-08-05 14:43:39 +00:00
|
|
|
|
|
2001-01-02 14:06:15 +00:00
|
|
|
|
;;;###autoload
|
1997-10-28 22:16:24 +00:00
|
|
|
|
(defun todo-add-item-non-interactively (new-item category)
|
1997-10-28 21:14:51 +00:00
|
|
|
|
"Insert NEW-ITEM in TODO list as a new entry in CATEGORY."
|
1997-10-24 17:30:54 +00:00
|
|
|
|
(save-excursion
|
1997-10-28 21:26:55 +00:00
|
|
|
|
(todo-show))
|
|
|
|
|
(save-excursion
|
1997-10-17 15:41:57 +00:00
|
|
|
|
(if (string= "" category)
|
|
|
|
|
(setq category (nth todo-category-number todo-categories)))
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(let ((cat-exists (member category todo-categories)))
|
|
|
|
|
(setq todo-category-number
|
|
|
|
|
(if cat-exists
|
|
|
|
|
(- (length todo-categories) (length cat-exists))
|
|
|
|
|
(todo-add-category category))))
|
1997-10-28 22:16:24 +00:00
|
|
|
|
(todo-show)
|
|
|
|
|
(setq todo-previous-line 0)
|
|
|
|
|
(let ((top 1)
|
|
|
|
|
(bottom (1+ (count-lines (point-min) (point-max)))))
|
|
|
|
|
(while (> (- bottom top) todo-insert-threshold)
|
|
|
|
|
(let* ((current (/ (+ top bottom) 2))
|
|
|
|
|
(answer (if (< current bottom)
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(todo-more-important-p current) nil)))
|
1997-10-28 22:16:24 +00:00
|
|
|
|
(if answer
|
|
|
|
|
(setq bottom current)
|
|
|
|
|
(setq top (1+ current)))))
|
|
|
|
|
(setq top (/ (+ top bottom) 2))
|
|
|
|
|
;; goto-line doesn't have the desired behavior in a narrowed buffer
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(forward-line (1- top)))
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(insert new-item "\n")
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(todo-backward-item)
|
1997-10-28 20:03:27 +00:00
|
|
|
|
(todo-save)
|
1997-08-05 22:34:14 +00:00
|
|
|
|
(message "")))
|
1997-10-24 17:30:54 +00:00
|
|
|
|
|
2001-01-02 14:06:15 +00:00
|
|
|
|
;;;###autoload
|
2000-07-04 10:35:24 +00:00
|
|
|
|
(defun todo-insert-item (arg)
|
1997-10-28 21:14:51 +00:00
|
|
|
|
"Insert new TODO list entry.
|
|
|
|
|
With a prefix argument solicit the category, otherwise use the current
|
|
|
|
|
category."
|
1997-10-24 17:30:54 +00:00
|
|
|
|
(interactive "P")
|
1997-10-28 21:26:55 +00:00
|
|
|
|
(save-excursion
|
1997-10-28 21:59:48 +00:00
|
|
|
|
(if (not (string-equal mode-name "TODO")) (todo-show))
|
|
|
|
|
(let* ((new-item (concat todo-prefix " "
|
|
|
|
|
(read-from-minibuffer
|
|
|
|
|
"New TODO entry: "
|
|
|
|
|
(if todo-entry-prefix-function
|
|
|
|
|
(funcall todo-entry-prefix-function)))))
|
|
|
|
|
(categories todo-categories)
|
|
|
|
|
(history (cons 'categories (1+ todo-category-number)))
|
|
|
|
|
(current-category (nth todo-category-number todo-categories))
|
1998-09-29 18:20:36 +00:00
|
|
|
|
(category
|
2000-07-04 10:35:24 +00:00
|
|
|
|
(if arg
|
1997-10-28 21:59:48 +00:00
|
|
|
|
current-category
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(completing-read (concat "Category [" current-category "]: ")
|
|
|
|
|
(todo-category-alist) nil nil nil
|
|
|
|
|
history current-category))))
|
1997-10-28 22:16:24 +00:00
|
|
|
|
(todo-add-item-non-interactively new-item category))))
|
1997-10-24 17:30:54 +00:00
|
|
|
|
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(defalias 'todo-cmd-inst 'todo-insert-item)
|
1997-08-05 22:34:14 +00:00
|
|
|
|
|
1997-10-28 21:47:12 +00:00
|
|
|
|
(defun todo-insert-item-here ()
|
|
|
|
|
"Insert new TODO list entry under the cursor."
|
1997-10-28 22:16:24 +00:00
|
|
|
|
(interactive "")
|
|
|
|
|
(save-excursion
|
|
|
|
|
(if (not (string-equal mode-name "TODO")) (todo-show))
|
|
|
|
|
(let* ((new-item (concat todo-prefix " "
|
|
|
|
|
(read-from-minibuffer
|
|
|
|
|
"New TODO entry: "
|
|
|
|
|
(if todo-entry-prefix-function
|
|
|
|
|
(funcall todo-entry-prefix-function))))))
|
|
|
|
|
(insert (concat new-item "\n")))))
|
1997-10-28 21:47:12 +00:00
|
|
|
|
|
1997-10-16 21:21:16 +00:00
|
|
|
|
(defun todo-more-important-p (line)
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
"Ask whether entry is more important than the one at LINE."
|
|
|
|
|
(if (not (equal todo-previous-line line))
|
1997-08-05 22:34:14 +00:00
|
|
|
|
(progn
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(setq todo-previous-line line)
|
1997-08-05 22:34:14 +00:00
|
|
|
|
(goto-char (point-min))
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(forward-line (1- todo-previous-line))
|
1997-10-16 21:21:16 +00:00
|
|
|
|
(let ((item (todo-item-string-start)))
|
|
|
|
|
(setq todo-previous-answer
|
|
|
|
|
(y-or-n-p (concat "More important than '" item "'? "))))))
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
todo-previous-answer)
|
|
|
|
|
(defalias 'todo-ask-p 'todo-more-important-p)
|
|
|
|
|
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(defun todo-delete-item ()
|
|
|
|
|
"Delete current TODO list entry."
|
1997-08-03 12:15:13 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(if (> (count-lines (point-min) (point-max)) 0)
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(let* ((todo-entry (todo-item-string-start))
|
1997-10-16 21:21:16 +00:00
|
|
|
|
(todo-answer (y-or-n-p (concat "Permanently remove '"
|
|
|
|
|
todo-entry "'? "))))
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(if todo-answer
|
|
|
|
|
(progn
|
|
|
|
|
(todo-remove-item)
|
|
|
|
|
(todo-backward-item)))
|
1997-10-16 21:21:16 +00:00
|
|
|
|
(message ""))
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(error "No TODO list entry to delete")))
|
|
|
|
|
(defalias 'todo-cmd-kill 'todo-delete-item)
|
1997-08-03 12:15:13 +00:00
|
|
|
|
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(defun todo-raise-item ()
|
|
|
|
|
"Raise priority of current entry."
|
1997-08-04 16:18:45 +00:00
|
|
|
|
(interactive)
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(if (> (count-lines (point-min) (point)) 0)
|
|
|
|
|
(let ((item (todo-item-string)))
|
1997-10-16 21:21:16 +00:00
|
|
|
|
(todo-remove-item)
|
|
|
|
|
(todo-backward-item)
|
|
|
|
|
(save-excursion
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(insert item "\n"))
|
1997-10-16 21:21:16 +00:00
|
|
|
|
(message ""))
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(error "No TODO list entry to raise")))
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(defalias 'todo-cmd-rais 'todo-raise-item)
|
1997-08-04 16:18:45 +00:00
|
|
|
|
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(defun todo-lower-item ()
|
|
|
|
|
"Lower priority of current entry."
|
1997-08-04 16:18:45 +00:00
|
|
|
|
(interactive)
|
1997-10-17 15:41:57 +00:00
|
|
|
|
(if (> (count-lines (point) (point-max)) 1)
|
|
|
|
|
;; Assume there is a final newline
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(let ((item (todo-item-string)))
|
1997-10-16 21:21:16 +00:00
|
|
|
|
(todo-remove-item)
|
|
|
|
|
(todo-forward-item)
|
|
|
|
|
(save-excursion
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(insert item "\n"))
|
1997-10-16 21:21:16 +00:00
|
|
|
|
(message ""))
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(error "No TODO list entry to lower")))
|
|
|
|
|
(defalias 'todo-cmd-lowr 'todo-lower-item)
|
1997-08-04 16:18:45 +00:00
|
|
|
|
|
1997-12-04 17:45:22 +00:00
|
|
|
|
(defun todo-file-item (&optional comment)
|
2000-06-02 18:37:43 +00:00
|
|
|
|
"File the current TODO list entry away, annotated with an optional COMMENT."
|
1997-12-04 17:45:22 +00:00
|
|
|
|
(interactive "sComment: ")
|
|
|
|
|
(or (> (count-lines (point-min) (point-max)) 0)
|
|
|
|
|
(error "No TODO list entry to file away"))
|
|
|
|
|
(let ((time-stamp-format todo-time-string-format))
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(if (and comment (> (length comment) 0))
|
|
|
|
|
(progn
|
|
|
|
|
(goto-char (todo-item-end))
|
|
|
|
|
(insert
|
|
|
|
|
(if (save-excursion (beginning-of-line)
|
|
|
|
|
(looking-at (regexp-quote todo-prefix)))
|
|
|
|
|
" "
|
|
|
|
|
"\n\t")
|
|
|
|
|
"(" comment ")")))
|
1997-12-04 17:45:22 +00:00
|
|
|
|
(goto-char (todo-item-end))
|
|
|
|
|
(insert " [" (nth todo-category-number todo-categories) "]")
|
|
|
|
|
(goto-char (todo-item-start))
|
|
|
|
|
(let ((temp-point (point)))
|
|
|
|
|
(if (looking-at (regexp-quote todo-prefix))
|
|
|
|
|
(replace-match (time-stamp-string))
|
|
|
|
|
;; Standard prefix -> timestamp
|
|
|
|
|
;; Else prefix non-standard item start with timestamp
|
|
|
|
|
(insert (time-stamp-string)))
|
|
|
|
|
(append-to-file temp-point (1+ (todo-item-end)) todo-file-done)
|
|
|
|
|
(delete-region temp-point (1+ (todo-item-end))))
|
|
|
|
|
(todo-backward-item)
|
|
|
|
|
(message "")))
|
1997-08-03 12:15:13 +00:00
|
|
|
|
|
|
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
|
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
;; Utility functions:
|
|
|
|
|
|
2000-07-04 11:15:24 +00:00
|
|
|
|
|
|
|
|
|
;;;###autoload
|
1997-10-17 15:41:57 +00:00
|
|
|
|
(defun todo-top-priorities (&optional nof-priorities category-pr-page)
|
|
|
|
|
"List top priorities for each category.
|
|
|
|
|
|
|
|
|
|
Number of entries for each category is given by NOF-PRIORITIES which
|
|
|
|
|
defaults to \'todo-show-priorities\'.
|
|
|
|
|
|
|
|
|
|
If CATEGORY-PR-PAGE is non-nil, a page separator \'^L\' is inserted
|
|
|
|
|
between each category."
|
|
|
|
|
|
|
|
|
|
(interactive "P")
|
|
|
|
|
(or nof-priorities (setq nof-priorities todo-show-priorities))
|
|
|
|
|
(if (listp nof-priorities) ;universal argument
|
|
|
|
|
(setq nof-priorities (car nof-priorities)))
|
2000-11-22 22:51:33 +00:00
|
|
|
|
(let ((todo-print-buffer-name todo-tmp-buffer-name)
|
1997-10-28 21:14:51 +00:00
|
|
|
|
;;(todo-print-category-number 0)
|
|
|
|
|
(todo-category-break (if category-pr-page "" ""))
|
1997-10-17 15:41:57 +00:00
|
|
|
|
(cat-end
|
|
|
|
|
(concat
|
|
|
|
|
(if todo-remove-separator
|
|
|
|
|
(concat todo-category-end "\n"
|
|
|
|
|
(regexp-quote todo-prefix) " " todo-category-sep "\n")
|
|
|
|
|
(concat todo-category-end "\n"))))
|
|
|
|
|
beg end)
|
|
|
|
|
(todo-show)
|
|
|
|
|
(save-excursion
|
|
|
|
|
(save-restriction
|
|
|
|
|
(widen)
|
1997-10-28 21:14:51 +00:00
|
|
|
|
(copy-to-buffer todo-print-buffer-name (point-min) (point-max))
|
|
|
|
|
(set-buffer todo-print-buffer-name)
|
1997-10-17 15:41:57 +00:00
|
|
|
|
(goto-char (point-min))
|
2001-07-05 13:51:17 +00:00
|
|
|
|
(when (re-search-forward (regexp-quote todo-header) nil t)
|
|
|
|
|
(beginning-of-line 1)
|
|
|
|
|
(delete-region (point) (line-end-position)))
|
1997-10-17 15:41:57 +00:00
|
|
|
|
(while (re-search-forward ;Find category start
|
|
|
|
|
(regexp-quote (concat todo-prefix todo-category-beg))
|
|
|
|
|
nil t)
|
2000-05-12 10:58:13 +00:00
|
|
|
|
(setq beg (+ (line-end-position) 1)) ;Start of first entry.
|
1997-10-17 15:41:57 +00:00
|
|
|
|
(re-search-forward cat-end nil t)
|
|
|
|
|
(setq end (match-beginning 0))
|
|
|
|
|
(replace-match todo-category-break)
|
|
|
|
|
(narrow-to-region beg end) ;In case we have too few entries.
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(if (= 0 nof-priorities) ;Traverse entries.
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(goto-char end) ;All entries
|
1997-10-17 15:41:57 +00:00
|
|
|
|
(todo-forward-item nof-priorities))
|
|
|
|
|
(setq beg (point))
|
|
|
|
|
(delete-region beg end)
|
|
|
|
|
(widen))
|
1997-10-28 20:03:27 +00:00
|
|
|
|
(and (looking-at "") (replace-match "")) ;Remove trailing form-feed.
|
1997-10-17 15:41:57 +00:00
|
|
|
|
(goto-char (point-min)) ;Due to display buffer
|
|
|
|
|
))
|
|
|
|
|
;; Could have used switch-to-buffer as it has a norecord argument,
|
|
|
|
|
;; which is nice when we are called from e.g. todo-print.
|
1997-10-28 20:03:27 +00:00
|
|
|
|
;; Else we could have used pop-to-buffer.
|
1997-10-28 21:14:51 +00:00
|
|
|
|
(display-buffer todo-print-buffer-name)
|
1997-10-17 15:41:57 +00:00
|
|
|
|
(message "Type C-x 1 to remove %s window. M-C-v to scroll the help."
|
2000-05-12 10:58:13 +00:00
|
|
|
|
todo-print-buffer-name)))
|
1997-10-17 15:41:57 +00:00
|
|
|
|
|
1997-10-28 20:03:27 +00:00
|
|
|
|
(defun todo-save-top-priorities (&optional nof-priorities)
|
|
|
|
|
"Save top priorities for each category in `todo-file-top'.
|
|
|
|
|
|
|
|
|
|
Number of entries for each category is given by NOF-PRIORITIES which
|
|
|
|
|
defaults to `todo-show-priorities'."
|
|
|
|
|
(interactive "P")
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(save-window-excursion
|
|
|
|
|
(save-excursion
|
|
|
|
|
(save-restriction
|
|
|
|
|
(todo-top-priorities nof-priorities)
|
|
|
|
|
(set-buffer todo-tmp-buffer-name)
|
|
|
|
|
(write-file todo-file-top)
|
|
|
|
|
(kill-this-buffer)))))
|
1997-10-28 20:03:27 +00:00
|
|
|
|
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;;;###autoload
|
|
|
|
|
(defun todo-print (&optional category-pr-page)
|
2000-06-02 18:37:43 +00:00
|
|
|
|
"Print todo summary using `todo-print-function'.
|
2000-07-04 11:15:24 +00:00
|
|
|
|
If CATEGORY-PR-PAGE is non-nil, a page separator `^L' is inserted
|
1997-10-17 15:41:57 +00:00
|
|
|
|
between each category.
|
|
|
|
|
|
2000-07-04 11:15:24 +00:00
|
|
|
|
Number of entries for each category is given by `todo-print-priorities'."
|
1997-10-17 15:41:57 +00:00
|
|
|
|
(interactive "P")
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(save-window-excursion
|
|
|
|
|
(save-excursion
|
|
|
|
|
(save-restriction
|
|
|
|
|
(todo-top-priorities todo-print-priorities
|
2000-05-12 10:58:13 +00:00
|
|
|
|
category-pr-page)
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(set-buffer todo-tmp-buffer-name)
|
|
|
|
|
(and (funcall todo-print-function)
|
|
|
|
|
(kill-this-buffer))
|
|
|
|
|
(message "Todo printing done.")))))
|
1997-10-17 15:41:57 +00:00
|
|
|
|
|
|
|
|
|
(defun todo-jump-to-category ()
|
|
|
|
|
"Jump to a category. Default is previous category."
|
|
|
|
|
(interactive)
|
|
|
|
|
(let* ((categories todo-categories)
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(history (cons 'categories (1+ todo-category-number)))
|
|
|
|
|
(default (nth todo-category-number todo-categories))
|
1998-09-29 18:20:36 +00:00
|
|
|
|
(category (completing-read
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(concat "Category [" default "]: ")
|
|
|
|
|
(todo-category-alist) nil nil nil history default)))
|
1997-10-17 15:41:57 +00:00
|
|
|
|
(if (string= "" category)
|
|
|
|
|
(setq category (nth todo-category-number todo-categories)))
|
|
|
|
|
(setq todo-category-number
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(if (member category todo-categories)
|
|
|
|
|
(- (length todo-categories)
|
|
|
|
|
(length (member category todo-categories)))
|
|
|
|
|
(todo-add-category category)))
|
1997-10-17 15:41:57 +00:00
|
|
|
|
(todo-show)))
|
|
|
|
|
|
2000-05-12 10:58:13 +00:00
|
|
|
|
(defun todo-line-string ()
|
|
|
|
|
"Return current line in buffer as a string."
|
|
|
|
|
(buffer-substring (line-beginning-position) (line-end-position)))
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
|
|
|
|
|
(defun todo-item-string-start ()
|
|
|
|
|
"Return the start of this TODO list entry as a string."
|
|
|
|
|
;; Suitable for putting in the minibuffer when asking the user
|
|
|
|
|
(let ((item (todo-item-string)))
|
|
|
|
|
(if (> (length item) 60)
|
1997-10-16 21:21:16 +00:00
|
|
|
|
(setq item (concat (substring item 0 56) "...")))
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
item))
|
|
|
|
|
|
2000-05-12 10:58:13 +00:00
|
|
|
|
(defun todo-item-start ()
|
|
|
|
|
"Return point at start of current TODO list item."
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(if (not (looking-at (regexp-quote todo-prefix)))
|
1997-10-16 21:21:16 +00:00
|
|
|
|
(search-backward-regexp
|
|
|
|
|
(concat "^" (regexp-quote todo-prefix)) nil t))
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(point)))
|
|
|
|
|
|
2000-05-12 10:58:13 +00:00
|
|
|
|
(defun todo-item-end ()
|
|
|
|
|
"Return point at end of current TODO list item."
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(save-excursion
|
|
|
|
|
(end-of-line)
|
1997-10-17 15:41:57 +00:00
|
|
|
|
(search-forward-regexp
|
|
|
|
|
(concat "^" (regexp-quote todo-prefix)) nil 'goto-end)
|
2000-05-12 10:58:13 +00:00
|
|
|
|
(1- (line-beginning-position))))
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
|
2000-05-12 10:58:13 +00:00
|
|
|
|
(defun todo-remove-item ()
|
|
|
|
|
"Delete the current entry from the TODO list."
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(delete-region (todo-item-start) (1+ (todo-item-end))))
|
|
|
|
|
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(defun todo-item-string ()
|
|
|
|
|
"Return current TODO list entry as a string."
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(buffer-substring (todo-item-start) (todo-item-end)))
|
|
|
|
|
|
|
|
|
|
(defun todo-string-count-lines (string)
|
|
|
|
|
"Return the number of lines STRING spans."
|
|
|
|
|
(length (split-string string "\n")))
|
|
|
|
|
|
|
|
|
|
(defun todo-string-multiline-p (string)
|
1997-10-28 21:14:51 +00:00
|
|
|
|
"Return non-nil if STRING spans several lines."
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(> (todo-string-count-lines string) 1))
|
|
|
|
|
|
|
|
|
|
(defun todo-category-alist ()
|
1997-10-28 21:14:51 +00:00
|
|
|
|
"Generate an alist for use in `completing-read' from `todo-categories'."
|
2000-06-02 18:37:43 +00:00
|
|
|
|
(mapcar #'list todo-categories))
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
|
1997-08-05 14:43:39 +00:00
|
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
|
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(easy-menu-define todo-menu todo-mode-map "Todo Menu"
|
|
|
|
|
'("Todo"
|
|
|
|
|
["Next category" todo-forward-category t]
|
|
|
|
|
["Previous category" todo-backward-category t]
|
|
|
|
|
["Jump to category" todo-jump-to-category t]
|
|
|
|
|
["Show top priority items" todo-top-priorities t]
|
|
|
|
|
["Print categories" todo-print t]
|
|
|
|
|
"---"
|
|
|
|
|
["Edit item" todo-edit-item t]
|
|
|
|
|
["File item" todo-file-item t]
|
|
|
|
|
["Insert new item" todo-insert-item t]
|
|
|
|
|
["Insert item here" todo-insert-item-here t]
|
|
|
|
|
["Kill item" todo-delete-item t]
|
|
|
|
|
"---"
|
|
|
|
|
["Lower item priority" todo-lower-item t]
|
|
|
|
|
["Raise item priority" todo-raise-item t]
|
|
|
|
|
"---"
|
|
|
|
|
["Next item" todo-forward-item t]
|
|
|
|
|
["Previous item" todo-backward-item t]
|
|
|
|
|
"---"
|
|
|
|
|
["Save" todo-save t]
|
|
|
|
|
["Save Top Priorities" todo-save-top-priorities t]
|
|
|
|
|
"---"
|
|
|
|
|
["Quit" todo-quit t]
|
|
|
|
|
))
|
1997-08-05 16:47:01 +00:00
|
|
|
|
|
1997-10-17 15:41:57 +00:00
|
|
|
|
;; As calendar reads .todo-do before todo-mode is loaded.
|
2001-01-02 14:06:15 +00:00
|
|
|
|
;;;###autoload
|
2000-06-02 18:37:43 +00:00
|
|
|
|
(defun todo-mode ()
|
|
|
|
|
"Major mode for editing TODO lists.
|
|
|
|
|
|
|
|
|
|
\\{todo-mode-map}"
|
1997-08-03 12:15:13 +00:00
|
|
|
|
(interactive)
|
|
|
|
|
(setq major-mode 'todo-mode)
|
|
|
|
|
(setq mode-name "TODO")
|
|
|
|
|
(use-local-map todo-mode-map)
|
1997-08-06 09:14:25 +00:00
|
|
|
|
(easy-menu-add todo-menu)
|
|
|
|
|
(run-hooks 'todo-mode-hook))
|
1997-08-05 14:43:39 +00:00
|
|
|
|
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(eval-when-compile
|
|
|
|
|
(defvar date)
|
|
|
|
|
(defvar entry))
|
|
|
|
|
|
1997-10-28 21:37:05 +00:00
|
|
|
|
;; Read about this function in the setup instructions above!
|
2001-01-02 14:06:15 +00:00
|
|
|
|
;;;###autoload
|
1997-10-28 21:37:05 +00:00
|
|
|
|
(defun todo-cp ()
|
2000-06-02 18:37:43 +00:00
|
|
|
|
"Make a diary entry appear only in the current date's diary."
|
1997-10-28 21:37:05 +00:00
|
|
|
|
(if (equal (calendar-current-date) date)
|
2000-06-02 18:37:43 +00:00
|
|
|
|
entry))
|
1997-10-28 21:37:05 +00:00
|
|
|
|
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(define-derived-mode todo-edit-mode text-mode "TODO Edit"
|
2000-06-02 18:37:43 +00:00
|
|
|
|
"Major mode for editing items in the TODO list.
|
|
|
|
|
|
2000-07-04 11:15:24 +00:00
|
|
|
|
\\{todo-edit-mode-map}")
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
|
2001-01-02 14:06:15 +00:00
|
|
|
|
;;;###autoload
|
2000-06-02 18:37:43 +00:00
|
|
|
|
(defun todo-show ()
|
|
|
|
|
"Show TODO list."
|
1997-08-05 14:43:39 +00:00
|
|
|
|
(interactive)
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(if (file-exists-p todo-file-do)
|
|
|
|
|
(find-file todo-file-do)
|
|
|
|
|
(todo-initial-setup))
|
2000-07-04 11:15:24 +00:00
|
|
|
|
(if (null todo-categories)
|
|
|
|
|
(if (null todo-cats)
|
|
|
|
|
(error "Error in %s: No categories in list `todo-categories'"
|
|
|
|
|
todo-file-do)
|
|
|
|
|
(goto-char (point-min))
|
|
|
|
|
(and (search-forward "todo-cats:" nil t)
|
|
|
|
|
(replace-match "todo-categories:"))
|
|
|
|
|
(make-local-variable 'todo-categories)
|
|
|
|
|
(setq todo-categories todo-cats)))
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(beginning-of-line)
|
|
|
|
|
(todo-category-select))
|
|
|
|
|
|
2000-06-02 18:37:43 +00:00
|
|
|
|
(defun todo-initial-setup ()
|
|
|
|
|
"Set up things to work properly in TODO mode."
|
1997-08-05 14:43:39 +00:00
|
|
|
|
(find-file todo-file-do)
|
Harald Meland <harald.meland@usit.uio.no> asked for
the latest version, got 1997-08-19T14:00:36Z!os10000@seidel-space.de, and returned this.
He writes:
Thanks a lot for the new version of todo-mode.el. As you will see I
have messed it up a bit, hopefully for the better -- I don't like
short, cryptic names for variables and functions, so I renamed most of
them, and `defalias'ed the old function names. I hope you don't mind
too much, I just kinda couldn't stop myself.
Additionally, I included some support for multiline entries, cleaned
up (IMHO :) a lot of the code, included completion-support for which
category to install a new entry in, and possibly some other changes I
can't remember :)
It's getting rather late, and I have just done some preliminary
testing on whether all of this really works, but so far it looks
good.
1997-10-09 09:24:50 +00:00
|
|
|
|
(erase-buffer)
|
|
|
|
|
(todo-mode)
|
|
|
|
|
(todo-add-category "Todo"))
|
1997-08-03 12:15:13 +00:00
|
|
|
|
|
1997-08-19 14:00:36 +00:00
|
|
|
|
(provide 'todo-mode)
|
1997-08-03 12:15:13 +00:00
|
|
|
|
|
1997-08-19 14:00:36 +00:00
|
|
|
|
;;; todo-mode.el ends here
|