changeset 20171:e691c040353f

Rafael Laboissiere <rafael@icp.inpg.fr> writes: I was just annoyed with the fact that there is no way to dynamically control the insertion accuracy. I mean: the variable `todo-insert-threshold' does the job, but it is not very handy if one wants to mix the two behaviors (bisection and "insert right here under the cursor"). Therefore I did a quick hack in the function `todo-insert-item'. Now by giving a prefix argument to the insert command (i.e. by typing "C-u i"), entries are inserted exactly at the line where the cursor is. It would be better to give the value of `todo-insert-threshold' as a numeric argument of `todo-insert-item' (like "M-8 i"), but it's too late now for continuing to hack.
author Oliver Seidel <os10000@seidel-space.de>
date Fri, 24 Oct 1997 16:51:02 +0000
parents 500c446cd5be
children 14aea7edd810
files lisp/calendar/todo-mode.el
diffstat 1 files changed, 37 insertions(+), 20 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/calendar/todo-mode.el	Fri Oct 24 01:14:24 1997 +0000
+++ b/lisp/calendar/todo-mode.el	Fri Oct 24 16:51:02 1997 +0000
@@ -4,7 +4,7 @@
 
 ;; Author: Oliver.Seidel@cl.cam.ac.uk (was valid on Aug 2, 1997)
 ;; Created: 2 Aug 1997
-;; Version: $Id: todo-mode.el,v 1.19 1997/10/16 21:21:16 os10000 Exp os10000 $
+;; Version: $Id: todo-mode.el,v 1.21 1997/10/18 13:31:40 os10000 Exp $
 ;; Keywords: Categorised TODO list editor, todo-mode
 
 ;; This file is part of GNU Emacs.
@@ -77,7 +77,7 @@
 ;;
 ;;      Which version of todo-mode.el does this documentation refer to?
 ;;
-;;      $Id:$
+;;      $Id: todo-mode.el,v 1.21 1997/10/18 13:31:40 os10000 Exp $
 ;;
 ;;  Pre-Requisites
 ;;
@@ -250,6 +250,20 @@
 ;;; Change Log:
 
 ;; $Log: todo-mode.el,v $
+;; Revision 1.20  1997/10/17  15:41:57  os10000
+;; Thanks to Harald Backer <harald.backer@fou.telenor.no>, we now have
+;; the following facilities available:
+;;
+;; Added todo-print, todo-top-priorities and todo-jump with matching
+;; variables; Parameterized todo-header, todo-category-beg,
+;; todo-category-end and todo-category-sep; Added autoload comments;
+;; todo-category-select: Modified regexp to make category names unique;
+;; todo-forward-item: Added optional COUNT vaiable; todo-insert-item:
+;; Rewrote completing read entry.
+;;
+;; Also, check out the extended list of things left to be done to this
+;; package at the end of the documentation!
+;;
 ;; Revision 1.19  1997/10/16  21:21:16  os10000
 ;; Jari Aalto <jari.aalto@poboxes.com> writes:
 ;;
@@ -259,7 +273,7 @@
 ;;     automatically generated from the source file.  As an example, I
 ;;     generated the attached page using the following command:
 ;;     ripdoc.pls < todo-mode.el | t2html.pls -a "Oliver.Seidel" -e \
-;;     Oliver.Seidel@cl.cam.ac.uk -simple
+;;     Oliver.Seidel@cl.cam.ac.uk -simple -base
 ;;
 ;; And of course I appreciate it.  Jari's stuff can be found at:
 ;; ftp://cs.uta.fi/pub/ssjaaa/, while I'm making the rev 1.18 page
@@ -562,9 +576,9 @@
   0)
 
 ;;;### autoload
-(defun todo-insert-item ()
+(defun todo-insert-item (ARG)
   "Insert new TODO list entry."
-  (interactive)
+  (interactive "P")
   (let* ((new-item (concat todo-prefix " "
 			   (read-from-minibuffer
                             "New TODO entry: "
@@ -583,21 +597,24 @@
             (if cat-exists
                 (- (length todo-categories) (length cat-exists))
               (todo-add-category category))))
-    (todo-show)
-    (setq todo-previous-line 0)
-    (let ((top 1)
-          (bottom (1+ (count-lines (point-min) (point-max)))))
-      (while (> (- bottom top) todo-insert-threshold)
-        (let* ((current (/ (+ top bottom) 2))
-               (answer (if (< current bottom)
-                           (todo-more-important-p current) nil)))
-          (if answer
-              (setq bottom current)
-            (setq top (1+ current)))))
-      (setq top (/ (+ top bottom) 2))
-      ;; goto-line doesn't have the desired behavior in a narrowed buffer
-      (goto-char (point-min))
-      (forward-line (1- top)))
+    (if (not ARG)
+	(progn
+	  (todo-show)
+	  (setq todo-previous-line 0)
+	  (let ((top 1)
+		(bottom (1+ (count-lines (point-min) (point-max)))))
+	    (while (> (- bottom top) todo-insert-threshold)
+	      (let* ((current (/ (+ top bottom) 2))
+		     (answer (if (< current bottom)
+				 (todo-more-important-p current) nil)))
+		(if answer
+		    (setq bottom current)
+		  (setq top (1+ current)))))
+	    (setq top (/ (+ top bottom) 2))
+	    ;; goto-line doesn't have the desired behavior in a narrowed buffer
+	    (goto-char (point-min))
+	    (forward-line (1- top))))
+      (beginning-of-line))
     (insert new-item "\n")
     (todo-backward-item)
     (save-buffer)