diff options
| author | Oliver Seidel | 1997-10-15 17:18:11 +0000 |
|---|---|---|
| committer | Oliver Seidel | 1997-10-15 17:18:11 +0000 |
| commit | ab618c6ee61527e5d00186b2a3db4444632c4cbe (patch) | |
| tree | 9532c140c1215d8d6c38ab1ba4b09988bab554d3 | |
| parent | b7e041703482cedd2738c78242f037216d9daa17 (diff) | |
| download | emacs-ab618c6ee61527e5d00186b2a3db4444632c4cbe.tar.gz emacs-ab618c6ee61527e5d00186b2a3db4444632c4cbe.zip | |
Everything seems to work in Harald Melands Emacs 20.02 and
my Emacs 19.34. Beware of the spelling in some of the
variable names. I looked up "threshold" in a dictionary
and here in Britain this appears to be the way to spell it.
| -rw-r--r-- | lisp/calendar/todo-mode.el | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el index c2c6009d014..723549071d5 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.16 1997/10/15 14:00:12 os10000 Exp os10000 $ | 7 | ;; Version: $Id: todo-mode.el,v 1.17 1997/10/15 14:30:41 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. |
| @@ -168,7 +168,7 @@ | |||
| 168 | ;; mode preparations have been completed. | 168 | ;; mode preparations have been completed. |
| 169 | ;; | 169 | ;; |
| 170 | ;; | 170 | ;; |
| 171 | ;; --- todo-insert-treshold | 171 | ;; --- todo-insert-threshold |
| 172 | ;; | 172 | ;; |
| 173 | ;; Another nifty feature is the insertion accuracy. If you have 8 items | 173 | ;; Another nifty feature is the insertion accuracy. If you have 8 items |
| 174 | ;; in your TODO list, then you may get asked 4 questions by the binary | 174 | ;; in your TODO list, then you may get asked 4 questions by the binary |
| @@ -225,6 +225,9 @@ | |||
| 225 | ;;; Change Log: | 225 | ;;; Change Log: |
| 226 | 226 | ||
| 227 | ;; $Log: todo-mode.el,v $ | 227 | ;; $Log: todo-mode.el,v $ |
| 228 | ;; Revision 1.17 1997/10/15 14:30:41 os10000 | ||
| 229 | ;; Attempted to reconcile Harald's changes with mine since 1.15. | ||
| 230 | ;; | ||
| 228 | ;; Revision 1.16 1997/10/15 14:00:12 os10000 | 231 | ;; Revision 1.16 1997/10/15 14:00:12 os10000 |
| 229 | ;; Fixed 'file-item' and added 20.02 split-string function. | 232 | ;; Fixed 'file-item' and added 20.02 split-string function. |
| 230 | ;; | 233 | ;; |
| @@ -315,13 +318,14 @@ | |||
| 315 | (defvar todo-file-done "~/.todo-done" "*TODO mode archive file.") | 318 | (defvar todo-file-done "~/.todo-done" "*TODO mode archive file.") |
| 316 | (defvar todo-mode-hook nil "*TODO mode hooks.") | 319 | (defvar todo-mode-hook nil "*TODO mode hooks.") |
| 317 | (defvar todo-edit-mode-hook nil "*TODO Edit mode hooks.") | 320 | (defvar todo-edit-mode-hook nil "*TODO Edit mode hooks.") |
| 318 | (defvar todo-insert-treshold 0 "*TODO mode insertion accuracy.") | 321 | (defvar todo-insert-threshold 0 "*TODO mode insertion accuracy.") |
| 319 | (defvar todo-edit-buffer " *TODO Edit*" "TODO Edit buffer name.") | 322 | (defvar todo-edit-buffer " *TODO Edit*" "TODO Edit buffer name.") |
| 320 | 323 | ||
| 321 | ;; Thanks for the ISO time stamp format go to Karl Eichwalder <ke@suse.de> | 324 | ;; Thanks for the ISO time stamp format go to Karl Eichwalder <ke@suse.de> |
| 322 | ;; My format string for the appt.el package is "%3b %2d, %y, %02I:%02M%p". | 325 | ;; My format string for the appt.el package is "%3b %2d, %y, %02I:%02M%p". |
| 323 | ;; | 326 | ;; |
| 324 | (defvar todo-time-string-format "%y-%02m-%02d %02H:%02M" | 327 | (defvar todo-time-string-format |
| 328 | "%:y-%02m-%02d %02H:%02M" | ||
| 325 | "TODO mode time string format for done entries. | 329 | "TODO mode time string format for done entries. |
| 326 | For details see the variable `time-stamp-format'.") | 330 | For details see the variable `time-stamp-format'.") |
| 327 | 331 | ||
| @@ -483,7 +487,7 @@ For details see the variable `time-stamp-format'.") | |||
| 483 | (setq todo-previous-line 0) | 487 | (setq todo-previous-line 0) |
| 484 | (let ((top 1) | 488 | (let ((top 1) |
| 485 | (bottom (1+ (count-lines (point-min) (point-max))))) | 489 | (bottom (1+ (count-lines (point-min) (point-max))))) |
| 486 | (while (> (- bottom top) todo-insert-treshold) | 490 | (while (> (- bottom top) todo-insert-threshold) |
| 487 | (let* ((current (/ (+ top bottom) 2)) | 491 | (let* ((current (/ (+ top bottom) 2)) |
| 488 | (answer (if (< current bottom) | 492 | (answer (if (< current bottom) |
| 489 | (todo-more-important-p current) nil))) | 493 | (todo-more-important-p current) nil))) |
| @@ -556,22 +560,23 @@ For details see the variable `time-stamp-format'.") | |||
| 556 | (if (> (count-lines (point-min) (point-max)) 0) | 560 | (if (> (count-lines (point-min) (point-max)) 0) |
| 557 | (let ((comment (read-from-minibuffer "Comment: ")) | 561 | (let ((comment (read-from-minibuffer "Comment: ")) |
| 558 | (time-stamp-format todo-time-string-format)) | 562 | (time-stamp-format todo-time-string-format)) |
| 559 | (goto-char (todo-item-end)) | 563 | (if (> (length comment) 0) |
| 560 | (insert (if (save-excursion (beginning-of-line) | 564 | (progn |
| 561 | (looking-at (regexp-quote todo-prefix))) | 565 | (goto-char (todo-item-end)) |
| 562 | " " | 566 | (insert (if (save-excursion (beginning-of-line) |
| 563 | "\n\t") | 567 | (looking-at (regexp-quote todo-prefix))) |
| 564 | "(" (nth todo-category-number todo-categories) ": " | 568 | " " |
| 565 | comment ")\n") | 569 | "\n\t") |
| 570 | "(" (nth todo-category-number todo-categories) ": " | ||
| 571 | comment ")\n"))) | ||
| 566 | (goto-char (todo-item-start)) | 572 | (goto-char (todo-item-start)) |
| 567 | (let ((temp-point (point))) | 573 | (let ((temp-point (point))) |
| 568 | (if (looking-at (regexp-quote todo-prefix)) | 574 | (if (looking-at (regexp-quote todo-prefix)) |
| 569 | (replace-match (time-stamp-string)) ; Standard prefix -> timestamp | 575 | (replace-match (time-stamp-string)) ; Standard prefix -> timestamp |
| 570 | ;; Else prefix non-standard item start with timestamp | 576 | ;; Else prefix non-standard item start with timestamp |
| 571 | (insert (time-stamp-string))) | 577 | (insert (time-stamp-string))) |
| 572 | (append-to-file temp-point (todo-item-end) todo-file-done) | 578 | (append-to-file temp-point (todo-item-end) todo-file-done) |
| 573 | (delete-region temp-point (1+ (todo-item-end))) | 579 | (delete-region temp-point (1+ (todo-item-end)))) |
| 574 | ) | ||
| 575 | (todo-backward-item) | 580 | (todo-backward-item) |
| 576 | (message "")) | 581 | (message "")) |
| 577 | (error "No TODO list entry to file away"))) | 582 | (error "No TODO list entry to file away"))) |