comparison lisp/calendar/todo-mode.el @ 20419:28110a85d23e

Another patch by Michael Cook to fix annotation.
author Oliver Seidel <os10000@seidel-space.de>
date Thu, 04 Dec 1997 17:45:22 +0000
parents fa0ae5cb8ab2
children 2a37005dcd69
comparison
equal deleted inserted replaced
20418:7e1538a45702 20419:28110a85d23e
2 2
3 ;; Copyright (C) 1997 Free Software Foundation, Inc. 3 ;; Copyright (C) 1997 Free Software Foundation, Inc.
4 4
5 ;; Author: Oliver.Seidel@cl.cam.ac.uk (was valid on Aug 2, 1997) 5 ;; Author: Oliver.Seidel@cl.cam.ac.uk (was valid on Aug 2, 1997)
6 ;; Created: 2 Aug 1997 6 ;; Created: 2 Aug 1997
7 ;; Version: $Id: todo-mode.el,v 1.31 1997/10/28 22:16:24 os10000 Exp os10000 $ 7 ;; Version: $Id: todo-mode.el,v 1.32 1997/12/03 12:18:20 os10000 Exp os10000 $
8 ;; Keywords: Categorised TODO list editor, todo-mode 8 ;; Keywords: Categorised TODO list editor, todo-mode
9 9
10 ;; This file is part of GNU Emacs. 10 ;; This file is part of GNU Emacs.
11 11
12 ;; GNU Emacs is free software; you can redistribute it and/or modify 12 ;; GNU Emacs is free software; you can redistribute it and/or modify
94 ;; 94 ;;
95 ;; Version 95 ;; Version
96 ;; 96 ;;
97 ;; Which version of todo-mode.el does this documentation refer to? 97 ;; Which version of todo-mode.el does this documentation refer to?
98 ;; 98 ;;
99 ;; $Id: todo-mode.el,v 1.31 1997/10/28 22:16:24 os10000 Exp os10000 $ 99 ;; $Id: todo-mode.el,v 1.32 1997/12/03 12:18:20 os10000 Exp os10000 $
100 ;; 100 ;;
101 ;; Pre-Requisites 101 ;; Pre-Requisites
102 ;; 102 ;;
103 ;; This package will require the following packages to be 103 ;; This package will require the following packages to be
104 ;; available on the load-path: 104 ;; available on the load-path:
265 ;; --------------------------------------------------------------------------- 265 ;; ---------------------------------------------------------------------------
266 266
267 ;;; Change Log: 267 ;;; Change Log:
268 268
269 ;; $Log: todo-mode.el,v $ 269 ;; $Log: todo-mode.el,v $
270 ;; Revision 1.32 1997/12/03 12:18:20 os10000
271 ;; Added category patch by Michael R Cook <mcook@cognex.com>.
272 ;;
270 ;; Revision 1.31 1997/10/28 22:16:24 os10000 273 ;; Revision 1.31 1997/10/28 22:16:24 os10000
271 ;; Three insertion options: 274 ;; Three insertion options:
272 ;; i without prefix: ask for category, do binary insertion 275 ;; i without prefix: ask for category, do binary insertion
273 ;; i with prefix: do binary insertion in current category 276 ;; i with prefix: do binary insertion in current category
274 ;; uppercase I: insert directly under cursor 277 ;; uppercase I: insert directly under cursor
881 (insert item "\n")) 884 (insert item "\n"))
882 (message "")) 885 (message ""))
883 (error "No TODO list entry to lower"))) 886 (error "No TODO list entry to lower")))
884 (defalias 'todo-cmd-lowr 'todo-lower-item) 887 (defalias 'todo-cmd-lowr 'todo-lower-item)
885 888
886 (defun todo-file-item () "File the current TODO list entry away." 889 (defun todo-file-item (&optional comment)
887 (interactive) 890 "File the current TODO list entry away,
888 (if (> (count-lines (point-min) (point-max)) 0) 891 annotated with an optional COMMENT."
889 (let ((comment (read-from-minibuffer "Comment: ")) 892 (interactive "sComment: ")
890 (time-stamp-format todo-time-string-format)) 893 (or (> (count-lines (point-min) (point-max)) 0)
891 (if (> (length comment) 0) 894 (error "No TODO list entry to file away"))
892 (progn 895 (let ((time-stamp-format todo-time-string-format))
893 (goto-char (todo-item-end)) 896 (if (and comment (> (length comment) 0))
894 (insert 897 (progn
895 (if (save-excursion (beginning-of-line) 898 (goto-char (todo-item-end))
896 (looking-at (regexp-quote todo-prefix))) 899 (insert
897 " " 900 (if (save-excursion (beginning-of-line)
898 "\n\t") 901 (looking-at (regexp-quote todo-prefix)))
899 "(" (nth todo-category-number todo-categories) ": " 902 " "
900 comment ")"))) 903 "\n\t")
901 (goto-char (todo-item-start)) 904 "(" comment ")")))
902 (let ((temp-point (point))) 905 (goto-char (todo-item-end))
903 (if (looking-at (regexp-quote todo-prefix)) 906 (insert " [" (nth todo-category-number todo-categories) "]")
904 (replace-match (time-stamp-string)) 907 (goto-char (todo-item-start))
905 ;; Standard prefix -> timestamp 908 (let ((temp-point (point)))
906 ;; Else prefix non-standard item start with timestamp 909 (if (looking-at (regexp-quote todo-prefix))
907 (insert (time-stamp-string))) 910 (replace-match (time-stamp-string))
908 (append-to-file temp-point (1+ (todo-item-end)) todo-file-done) 911 ;; Standard prefix -> timestamp
909 (delete-region temp-point (1+ (todo-item-end)))) 912 ;; Else prefix non-standard item start with timestamp
910 (todo-backward-item) 913 (insert (time-stamp-string)))
911 (message "")) 914 (append-to-file temp-point (1+ (todo-item-end)) todo-file-done)
912 (error "No TODO list entry to file away"))) 915 (delete-region temp-point (1+ (todo-item-end))))
916 (todo-backward-item)
917 (message "")))
913 918
914 ;; --------------------------------------------------------------------------- 919 ;; ---------------------------------------------------------------------------
915 920
916 ;; Utility functions: 921 ;; Utility functions:
917 922