aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorOliver Seidel1997-10-15 14:00:12 +0000
committerOliver Seidel1997-10-15 14:00:12 +0000
commit91e9443e0bbbdf77ac97970073d72b0321b67041 (patch)
treee6d743bed8e975db6ee2a290ca8667f4f34b074e /lisp
parent2186b97448f7dfff2f472fee68b016dfdd9c4ac8 (diff)
downloademacs-91e9443e0bbbdf77ac97970073d72b0321b67041.tar.gz
emacs-91e9443e0bbbdf77ac97970073d72b0321b67041.zip
Fixed 'file-item' and added 20.02 split-string function.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/calendar/todo-mode.el54
1 files changed, 34 insertions, 20 deletions
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index 3494c9b2de9..3b96f8987b7 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.14 1997/10/09 09:24:50 os10000 Exp os10000 $ 7;; Version: $Id: todo-mode.el,v 1.15 1997/10/14 22:22:35 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.
@@ -225,6 +225,11 @@
225;;; Change Log: 225;;; Change Log:
226 226
227;; $Log: todo-mode.el,v $ 227;; $Log: todo-mode.el,v $
228;; Revision 1.15 1997/10/14 22:22:35 os10000
229;; Added string-split (which I stole from ediff-util), changed
230;; pop-to-buffer to switch-to-buffer and added message on how
231;; to exit the multi-line-edit mode.
232;;
228;; Revision 1.14 1997/10/09 09:24:50 os10000 233;; Revision 1.14 1997/10/09 09:24:50 os10000
229;; Harald Meland <harald.meland@usit.uio.no> asked for 234;; Harald Meland <harald.meland@usit.uio.no> asked for
230;; the latest version, got 1.13, and returned this. 235;; the latest version, got 1.13, and returned this.
@@ -546,9 +551,6 @@ For details see the variable `time-stamp-format'.")
546 (if (> (count-lines (point-min) (point-max)) 0) 551 (if (> (count-lines (point-min) (point-max)) 0)
547 (let ((comment (read-from-minibuffer "Comment: ")) 552 (let ((comment (read-from-minibuffer "Comment: "))
548 (time-stamp-format todo-time-string-format)) 553 (time-stamp-format todo-time-string-format))
549 (goto-char (todo-item-start))
550 (delete-region (point) (search-forward todo-prefix))
551 (insert (time-stamp-string))
552 (goto-char (todo-item-end)) 554 (goto-char (todo-item-end))
553 (insert (if (save-excursion (beginning-of-line) 555 (insert (if (save-excursion (beginning-of-line)
554 (looking-at (regexp-quote todo-prefix))) 556 (looking-at (regexp-quote todo-prefix)))
@@ -556,8 +558,14 @@ For details see the variable `time-stamp-format'.")
556 "\n\t") 558 "\n\t")
557 "(" (nth todo-category-number todo-categories) ": " 559 "(" (nth todo-category-number todo-categories) ": "
558 comment ")") 560 comment ")")
559 (append-to-file (todo-item-start) (todo-item-end) todo-file-done) 561 (widen)
560 (todo-remove-item) 562 (goto-char (todo-item-start))
563 (delete-region (point) (search-forward todo-prefix))
564 (let ((temp-point (point)))
565 (insert (time-stamp-string))
566 (append-to-file temp-point (todo-item-end) todo-file-done)
567 (delete-region temp-point (1+ (todo-item-end)))
568 )
561 (todo-backward-item) 569 (todo-backward-item)
562 (message "")) 570 (message ""))
563 (error "No TODO list entry to file away"))) 571 (error "No TODO list entry to file away")))
@@ -628,20 +636,26 @@ For details see the variable `time-stamp-format'.")
628 636
629;; splits at a white space, returns a list 637;; splits at a white space, returns a list
630(if (not (fboundp 'split-string)) 638(if (not (fboundp 'split-string))
631 (defun split-string (string regex) 639 (defun split-string (string &optional separators)
632 (let ((start 0) 640 "Splits STRING into substrings where there are matches for SEPARATORS.
633 (result '()) 641Each match for SEPARATORS is a splitting point.
634 substr) 642The substrings between the splitting points are made into a list
635 (while (string-match regex string start) 643which is returned.
636 (let ((match (string-match regex string start))) 644If SEPARATORS is absent, it defaults to \"[ \\f\\t\\n\\r\\v]+\"."
637 (setq substr (substring string start match)) 645 (let ((rexp (or separators "[ \f\t\n\r\v]+"))
638 (if (> (length substr) 0) 646 (start 0)
639 (setq result (cons substr result))) 647 (list nil))
640 (setq start (match-end 0)))) 648 (while (string-match rexp string start)
641 (setq substr (substring string start nil)) 649 (or (eq (match-beginning 0) 0)
642 (if (> (length substr) 0) 650 (setq list
643 (setq result (cons substr result))) 651 (cons (substring string start (match-beginning 0))
644 (nreverse result)))) 652 list)))
653 (setq start (match-end 0)))
654 (or (eq start (length string))
655 (setq list
656 (cons (substring string start)
657 list)))
658 (nreverse list))))
645 659
646;; --------------------------------------------------------------------------- 660;; ---------------------------------------------------------------------------
647 661