aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Love2000-07-04 10:35:24 +0000
committerDave Love2000-07-04 10:35:24 +0000
commit89802f436f526e3a6435471e61d82f729b93c8a3 (patch)
tree23e146a10e30c01147116a33196ce1cced6d1742
parent4a8c194f051259651fe50dee8dcdb4b8760386e1 (diff)
downloademacs-89802f436f526e3a6435471e61d82f729b93c8a3.tar.gz
emacs-89802f436f526e3a6435471e61d82f729b93c8a3.zip
Minor doc fixes and code tweaks.
-rw-r--r--lisp/calendar/todo-mode.el93
1 files changed, 44 insertions, 49 deletions
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index 9fc2ed80af8..258ac59888e 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -2,9 +2,9 @@
2 2
3;; Copyright (C) 1997, 2000 Free Software Foundation, Inc. 3;; Copyright (C) 1997, 2000 Free Software Foundation, Inc.
4 4
5;; Author: os10000@seidel-space.de 5;; Author: os10000@seidel-space.de [not clear that this works, July 2000]
6;; Created: 2 Aug 1997 6;; Created: 2 Aug 1997
7;; Version: $Id: todo-mode.el,v 1.40 2000/06/02 18:37:43 fx Exp $ 7;; Version: $Id: todo-mode.el,v 1.41 2000/06/06 16:43:40 fx Exp $
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.
@@ -117,7 +117,7 @@
117;; 117;;
118;; Which version of todo-mode.el does this documentation refer to? 118;; Which version of todo-mode.el does this documentation refer to?
119;; 119;;
120;; $Id: todo-mode.el,v 1.40 2000/06/02 18:37:43 fx Exp $ 120;; $Id: todo-mode.el,v 1.41 2000/06/06 16:43:40 fx Exp $
121;; 121;;
122;; Operation 122;; Operation
123;; 123;;
@@ -364,7 +364,7 @@ Automatically generated when `todo-save-top-priorities' is non-nil."
364 :type 'integer 364 :type 'integer
365 :group 'todo) 365 :group 'todo)
366(defcustom todo-remove-separator t 366(defcustom todo-remove-separator t
367 "*Non-nil to remove category separators in\ 367 "*Non-nil to remove category separators in \
368\\[todo-top-priorities] and \\[todo-print]." 368\\[todo-top-priorities] and \\[todo-print]."
369 :type 'boolean 369 :type 'boolean
370 :group 'todo) 370 :group 'todo)
@@ -528,8 +528,7 @@ Return nil if ITEM not found."
528(defun todo-save () "Save the TODO list." 528(defun todo-save () "Save the TODO list."
529 (interactive) 529 (interactive)
530 (save-buffer) 530 (save-buffer)
531 (if todo-save-top-priorities-too (todo-save-top-priorities)) 531 (if todo-save-top-priorities-too (todo-save-top-priorities)))
532 )
533(defalias 'todo-cmd-save 'todo-save) 532(defalias 'todo-cmd-save 'todo-save)
534 533
535(defun todo-quit () "Done with TODO list for now." 534(defun todo-quit () "Done with TODO list for now."
@@ -547,7 +546,7 @@ Return nil if ITEM not found."
547 (todo-edit-multiline) 546 (todo-edit-multiline)
548 (let ((new (read-from-minibuffer "Edit: " item))) 547 (let ((new (read-from-minibuffer "Edit: " item)))
549 (todo-remove-item) 548 (todo-remove-item)
550 (insert new "\n") 549 (insert new ?\n)
551 (todo-backward-item) 550 (todo-backward-item)
552 (message ""))))) 551 (message "")))))
553(defalias 'todo-cmd-edit 'todo-edit-item) 552(defalias 'todo-cmd-edit 'todo-edit-item)
@@ -572,14 +571,14 @@ Return nil if ITEM not found."
572 (widen) 571 (widen)
573 (goto-char (point-min)) 572 (goto-char (point-min))
574 (let ((posn (search-forward "-*- mode: todo; " 17 t))) 573 (let ((posn (search-forward "-*- mode: todo; " 17 t)))
575 (if (not (null posn)) (goto-char posn)) 574 (if posn
576 (if (equal posn nil)
577 (progn 575 (progn
578 (insert "-*- mode: todo; \n") 576 (goto-char posn)
579 (forward-char -1)) 577 (kill-line))
580 (kill-line))) 578 (insert "-*- mode: todo; \n")
579 (backward-char)))
581 (insert (format "todo-categories: %S; -*-" todo-categories)) 580 (insert (format "todo-categories: %S; -*-" todo-categories))
582 (forward-char 1) 581 (forward-char)
583 (insert (format "%s%s%s\n%s\n%s %s\n" 582 (insert (format "%s%s%s\n%s\n%s %s\n"
584 todo-prefix todo-category-beg cat 583 todo-prefix todo-category-beg cat
585 todo-category-end 584 todo-category-end
@@ -604,7 +603,7 @@ Return nil if ITEM not found."
604 (while (> (- bottom top) todo-insert-threshold) 603 (while (> (- bottom top) todo-insert-threshold)
605 (let* ((current (/ (+ top bottom) 2)) 604 (let* ((current (/ (+ top bottom) 2))
606 (answer (if (< current bottom) 605 (answer (if (< current bottom)
607 (todo-more-important-p current) nil))) 606 (todo-more-important-p current))))
608 (if answer 607 (if answer
609 (setq bottom current) 608 (setq bottom current)
610 (setq top (1+ current))))) 609 (setq top (1+ current)))))
@@ -612,7 +611,7 @@ Return nil if ITEM not found."
612 ;; goto-line doesn't have the desired behavior in a narrowed buffer 611 ;; goto-line doesn't have the desired behavior in a narrowed buffer
613 (goto-char (point-min)) 612 (goto-char (point-min))
614 (forward-line (1- top))) 613 (forward-line (1- top)))
615 (insert new-item "\n") 614 (insert new-item ?\n)
616 (todo-backward-item) 615 (todo-backward-item)
617 (progn ;;; horrible os10000 hack to make items appear when inserting into empty buffer 616 (progn ;;; horrible os10000 hack to make items appear when inserting into empty buffer
618 (widen) 617 (widen)
@@ -623,7 +622,7 @@ Return nil if ITEM not found."
623 (message ""))) 622 (message "")))
624 623
625;;;###autoload 624;;;###autoload
626(defun todo-insert-item (ARG) 625(defun todo-insert-item (arg)
627 "Insert new TODO list entry. 626 "Insert new TODO list entry.
628With a prefix argument solicit the category, otherwise use the current 627With a prefix argument solicit the category, otherwise use the current
629category." 628category."
@@ -639,12 +638,11 @@ category."
639 (history (cons 'categories (1+ todo-category-number))) 638 (history (cons 'categories (1+ todo-category-number)))
640 (current-category (nth todo-category-number todo-categories)) 639 (current-category (nth todo-category-number todo-categories))
641 (category 640 (category
642 (if ARG 641 (if arg
643 current-category 642 current-category
644 (completing-read 643 (completing-read
645 (concat "Category [" 644 (concat "Category [" current-category "]: ")
646 current-category "]: ") 645 (todo-category-alist) nil nil nil history current-category))))
647 (todo-category-alist) nil nil nil history))))
648 (todo-add-item-non-interactively new-item category)))) 646 (todo-add-item-non-interactively new-item category))))
649 647
650(defalias 'todo-cmd-inst 'todo-insert-item) 648(defalias 'todo-cmd-inst 'todo-insert-item)
@@ -680,10 +678,9 @@ category."
680 (let* ((todo-entry (todo-item-string-start)) 678 (let* ((todo-entry (todo-item-string-start))
681 (todo-answer (y-or-n-p (concat "Permanently remove '" 679 (todo-answer (y-or-n-p (concat "Permanently remove '"
682 todo-entry "'? ")))) 680 todo-entry "'? "))))
683 (if todo-answer 681 (when todo-answer
684 (progn 682 (todo-remove-item)
685 (todo-remove-item) 683 (todo-backward-item))
686 (todo-backward-item)))
687 (message "")) 684 (message ""))
688 (error "No TODO list entry to delete"))) 685 (error "No TODO list entry to delete")))
689(defalias 'todo-cmd-kill 'todo-delete-item) 686(defalias 'todo-cmd-kill 'todo-delete-item)
@@ -695,7 +692,7 @@ category."
695 (todo-remove-item) 692 (todo-remove-item)
696 (todo-backward-item) 693 (todo-backward-item)
697 (save-excursion 694 (save-excursion
698 (insert item "\n")) 695 (insert item ?\n))
699 (message "")) 696 (message ""))
700 (error "No TODO list entry to raise"))) 697 (error "No TODO list entry to raise")))
701(defalias 'todo-cmd-raise 'todo-raise-item) 698(defalias 'todo-cmd-raise 'todo-raise-item)
@@ -708,7 +705,7 @@ category."
708 (todo-remove-item) 705 (todo-remove-item)
709 (todo-forward-item) 706 (todo-forward-item)
710 (save-excursion 707 (save-excursion
711 (insert item "\n")) 708 (insert item ?\n))
712 (message "")) 709 (message ""))
713 (error "No TODO list entry to lower"))) 710 (error "No TODO list entry to lower")))
714(defalias 'todo-cmd-lowr 'todo-lower-item) 711(defalias 'todo-cmd-lowr 'todo-lower-item)
@@ -719,15 +716,14 @@ category."
719 (or (> (count-lines (point-min) (point-max)) 0) 716 (or (> (count-lines (point-min) (point-max)) 0)
720 (error "No TODO list entry to file away")) 717 (error "No TODO list entry to file away"))
721 (let ((time-stamp-format todo-time-string-format)) 718 (let ((time-stamp-format todo-time-string-format))
722 (if (and comment (> (length comment) 0)) 719 (when (and comment (> (length comment) 0))
723 (progn 720 (goto-char (todo-item-end))
724 (goto-char (todo-item-end)) 721 (insert
725 (insert 722 (if (save-excursion (beginning-of-line)
726 (if (save-excursion (beginning-of-line) 723 (looking-at (regexp-quote todo-prefix)))
727 (looking-at (regexp-quote todo-prefix))) 724 " "
728 " " 725 "\n\t")
729 "\n\t") 726 "(" comment ")"))
730 "(" comment ")")))
731 (goto-char (todo-item-end)) 727 (goto-char (todo-item-end))
732 (insert " [" (nth todo-category-number todo-categories) "]") 728 (insert " [" (nth todo-category-number todo-categories) "]")
733 (goto-char (todo-item-start)) 729 (goto-char (todo-item-start))
@@ -776,10 +772,9 @@ between each category."
776 (copy-to-buffer todo-print-buffer-name (point-min) (point-max)) 772 (copy-to-buffer todo-print-buffer-name (point-min) (point-max))
777 (set-buffer todo-print-buffer-name) 773 (set-buffer todo-print-buffer-name)
778 (goto-char (point-min)) 774 (goto-char (point-min))
779 (if (re-search-forward (regexp-quote todo-header) nil t) 775 (when (re-search-forward (regexp-quote todo-header) nil t)
780 (progn 776 (beginning-of-line 1)
781 (beginning-of-line 1) 777 (kill-line)) ;Remove mode line
782 (kill-line))) ;Remove mode line
783 (while (re-search-forward ;Find category start 778 (while (re-search-forward ;Find category start
784 (regexp-quote (concat todo-prefix todo-category-beg)) 779 (regexp-quote (concat todo-prefix todo-category-beg))
785 nil t) 780 nil t)
@@ -790,7 +785,7 @@ between each category."
790 (narrow-to-region beg end) ;In case we have too few entries. 785 (narrow-to-region beg end) ;In case we have too few entries.
791 (goto-char (point-min)) 786 (goto-char (point-min))
792 (if (= 0 nof-priorities) ;Traverse entries. 787 (if (= 0 nof-priorities) ;Traverse entries.
793 (goto-char end) ;All entries 788 (goto-char end) ;All entries
794 (todo-forward-item nof-priorities)) 789 (todo-forward-item nof-priorities))
795 (setq beg (point)) 790 (setq beg (point))
796 (delete-region beg end) 791 (delete-region beg end)
@@ -968,15 +963,15 @@ Number of entries for each category is given by
968 (if (file-exists-p todo-file-do) 963 (if (file-exists-p todo-file-do)
969 (find-file todo-file-do) 964 (find-file todo-file-do)
970 (todo-initial-setup)) 965 (todo-initial-setup))
971 (if (null todo-categories) 966 (unless todo-categories
972 (if (null todo-cats) 967 (if (null todo-cats)
973 (error "Error in %s: No categories in list `todo-categories'" 968 (error "Error in %s: No categories in list `todo-categories'"
974 todo-file-do) 969 todo-file-do)
975 (goto-char (point-min)) 970 (goto-char (point-min))
976 (and (search-forward "todo-cats:" nil t) 971 (and (search-forward "todo-cats:" nil t)
977 (replace-match "todo-categories:")) 972 (replace-match "todo-categories:"))
978 (make-local-variable 'todo-categories) 973 (make-local-variable 'todo-categories)
979 (setq todo-categories todo-cats))) 974 (setq todo-categories todo-cats)))
980 (beginning-of-line) 975 (beginning-of-line)
981 (todo-category-select)) 976 (todo-category-select))
982 977