diff options
| author | Oliver Seidel | 1997-10-28 22:16:24 +0000 |
|---|---|---|
| committer | Oliver Seidel | 1997-10-28 22:16:24 +0000 |
| commit | 4dc1a160872c90a0372d543ac3d0d69e9b71b6f1 (patch) | |
| tree | fe3f0c40d0d76915b4a1ca1031bed34a2ccd9312 | |
| parent | 1966902e99987255c65029cf205258580dbc0c5e (diff) | |
| download | emacs-4dc1a160872c90a0372d543ac3d0d69e9b71b6f1.tar.gz emacs-4dc1a160872c90a0372d543ac3d0d69e9b71b6f1.zip | |
Three insertion options:
i without prefix: ask for category, do binary insertion
i with prefix: do binary insertion in current category
uppercase I: insert directly under cursor
| -rw-r--r-- | lisp/calendar/todo-mode.el | 57 |
1 files changed, 32 insertions, 25 deletions
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index 08f061dc531..8032a13da47 100644 --- a/lisp/calendar/todo-mode.el +++ b/lisp/calendar/todo-mode.el | |||
| @@ -4,7 +4,7 @@ | |||
| 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.29 1997/10/28 21:47:12 os10000 Exp os10000 $ | 7 | ;; Version: $Id: todo-mode.el,v 1.30 1997/10/28 21:59:48 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. |
| @@ -96,7 +96,7 @@ | |||
| 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.29 1997/10/28 21:47:12 os10000 Exp os10000 $ | 99 | ;; $Id: todo-mode.el,v 1.30 1997/10/28 21:59:48 os10000 Exp os10000 $ |
| 100 | ;; | 100 | ;; |
| 101 | ;; Pre-Requisites | 101 | ;; Pre-Requisites |
| 102 | ;; | 102 | ;; |
| @@ -120,7 +120,7 @@ | |||
| 120 | ;; E to edit a multi-line entry | 120 | ;; E to edit a multi-line entry |
| 121 | ;; f to file the current entry, including a | 121 | ;; f to file the current entry, including a |
| 122 | ;; comment and timestamp | 122 | ;; comment and timestamp |
| 123 | ;; i to insert a new entry | 123 | ;; i to insert a new entry, with prefix, omit category |
| 124 | ;; I to insert a new entry at current cursor position | 124 | ;; I to insert a new entry at current cursor position |
| 125 | ;; j jump to category | 125 | ;; j jump to category |
| 126 | ;; k to kill the current entry | 126 | ;; k to kill the current entry |
| @@ -267,6 +267,9 @@ | |||
| 267 | ;;; Change Log: | 267 | ;;; Change Log: |
| 268 | 268 | ||
| 269 | ;; $Log: todo-mode.el,v $ | 269 | ;; $Log: todo-mode.el,v $ |
| 270 | ;; Revision 1.30 1997/10/28 21:59:48 os10000 | ||
| 271 | ;; Improved documentation, fixed insertion with prefix. | ||
| 272 | ;; | ||
| 270 | ;; Revision 1.29 1997/10/28 21:47:12 os10000 | 273 | ;; Revision 1.29 1997/10/28 21:47:12 os10000 |
| 271 | ;; Implemented "insert-under-cursor" as suggested by | 274 | ;; Implemented "insert-under-cursor" as suggested by |
| 272 | ;; Kai Grossjohann <grossjohann@ls6.cs.uni-dortmund.de>. | 275 | ;; Kai Grossjohann <grossjohann@ls6.cs.uni-dortmund.de>. |
| @@ -750,7 +753,7 @@ Use `todo-categories' instead.") | |||
| 750 | 0) | 753 | 0) |
| 751 | 754 | ||
| 752 | ;;;### autoload | 755 | ;;;### autoload |
| 753 | (defun todo-add-item-non-interactively (new-item category ARG) | 756 | (defun todo-add-item-non-interactively (new-item category) |
| 754 | "Insert NEW-ITEM in TODO list as a new entry in CATEGORY." | 757 | "Insert NEW-ITEM in TODO list as a new entry in CATEGORY." |
| 755 | (save-excursion | 758 | (save-excursion |
| 756 | (todo-show)) | 759 | (todo-show)) |
| @@ -762,24 +765,21 @@ Use `todo-categories' instead.") | |||
| 762 | (if cat-exists | 765 | (if cat-exists |
| 763 | (- (length todo-categories) (length cat-exists)) | 766 | (- (length todo-categories) (length cat-exists)) |
| 764 | (todo-add-category category)))) | 767 | (todo-add-category category)))) |
| 765 | (if (not ARG) | 768 | (todo-show) |
| 766 | (progn | 769 | (setq todo-previous-line 0) |
| 767 | (todo-show) | 770 | (let ((top 1) |
| 768 | (setq todo-previous-line 0) | 771 | (bottom (1+ (count-lines (point-min) (point-max))))) |
| 769 | (let ((top 1) | 772 | (while (> (- bottom top) todo-insert-threshold) |
| 770 | (bottom (1+ (count-lines (point-min) (point-max))))) | 773 | (let* ((current (/ (+ top bottom) 2)) |
| 771 | (while (> (- bottom top) todo-insert-threshold) | 774 | (answer (if (< current bottom) |
| 772 | (let* ((current (/ (+ top bottom) 2)) | 775 | (todo-more-important-p current) nil))) |
| 773 | (answer (if (< current bottom) | 776 | (if answer |
| 774 | (todo-more-important-p current) nil))) | 777 | (setq bottom current) |
| 775 | (if answer | 778 | (setq top (1+ current))))) |
| 776 | (setq bottom current) | 779 | (setq top (/ (+ top bottom) 2)) |
| 777 | (setq top (1+ current))))) | 780 | ;; goto-line doesn't have the desired behavior in a narrowed buffer |
| 778 | (setq top (/ (+ top bottom) 2)) | 781 | (goto-char (point-min)) |
| 779 | ;; goto-line doesn't have the desired behavior in a narrowed buffer | 782 | (forward-line (1- top))) |
| 780 | (goto-char (point-min)) | ||
| 781 | (forward-line (1- top)))) | ||
| 782 | (beginning-of-line)) | ||
| 783 | (insert new-item "\n") | 783 | (insert new-item "\n") |
| 784 | (todo-backward-item) | 784 | (todo-backward-item) |
| 785 | (todo-save) | 785 | (todo-save) |
| @@ -808,15 +808,22 @@ category." | |||
| 808 | (concat "Category [" | 808 | (concat "Category [" |
| 809 | current-category "]: ") | 809 | current-category "]: ") |
| 810 | (todo-category-alist) nil nil nil history)))) | 810 | (todo-category-alist) nil nil nil history)))) |
| 811 | (todo-add-item-non-interactively new-item category ARG)))) | 811 | (todo-add-item-non-interactively new-item category)))) |
| 812 | 812 | ||
| 813 | (defalias 'todo-cmd-inst 'todo-insert-item) | 813 | (defalias 'todo-cmd-inst 'todo-insert-item) |
| 814 | 814 | ||
| 815 | ;;;### autoload | 815 | ;;;### autoload |
| 816 | (defun todo-insert-item-here () | 816 | (defun todo-insert-item-here () |
| 817 | "Insert new TODO list entry under the cursor." | 817 | "Insert new TODO list entry under the cursor." |
| 818 | (interactive) | 818 | (interactive "") |
| 819 | (todo-insert-item t)) | 819 | (save-excursion |
| 820 | (if (not (string-equal mode-name "TODO")) (todo-show)) | ||
| 821 | (let* ((new-item (concat todo-prefix " " | ||
| 822 | (read-from-minibuffer | ||
| 823 | "New TODO entry: " | ||
| 824 | (if todo-entry-prefix-function | ||
| 825 | (funcall todo-entry-prefix-function)))))) | ||
| 826 | (insert (concat new-item "\n"))))) | ||
| 820 | 827 | ||
| 821 | (defun todo-more-important-p (line) | 828 | (defun todo-more-important-p (line) |
| 822 | "Ask whether entry is more important than the one at LINE." | 829 | "Ask whether entry is more important than the one at LINE." |