Commit 89802f43 authored by Dave Love's avatar Dave Love
Browse files

Minor doc fixes and code tweaks.

parent 4a8c194f
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
;; Copyright (C) 1997, 2000 Free Software Foundation, Inc. ;; Copyright (C) 1997, 2000 Free Software Foundation, Inc.
;; Author: os10000@seidel-space.de ;; Author: os10000@seidel-space.de [not clear that this works, July 2000]
;; Created: 2 Aug 1997 ;; Created: 2 Aug 1997
;; Version: $Id: todo-mode.el,v 1.40 2000/06/02 18:37:43 fx Exp $ ;; Version: $Id: todo-mode.el,v 1.41 2000/06/06 16:43:40 fx Exp $
;; Keywords: Categorised TODO list editor, todo-mode ;; Keywords: Categorised TODO list editor, todo-mode
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
...@@ -117,7 +117,7 @@ ...@@ -117,7 +117,7 @@
;; ;;
;; Which version of todo-mode.el does this documentation refer to? ;; Which version of todo-mode.el does this documentation refer to?
;; ;;
;; $Id: todo-mode.el,v 1.40 2000/06/02 18:37:43 fx Exp $ ;; $Id: todo-mode.el,v 1.41 2000/06/06 16:43:40 fx Exp $
;; ;;
;; Operation ;; Operation
;; ;;
...@@ -364,7 +364,7 @@ Automatically generated when `todo-save-top-priorities' is non-nil." ...@@ -364,7 +364,7 @@ Automatically generated when `todo-save-top-priorities' is non-nil."
:type 'integer :type 'integer
:group 'todo) :group 'todo)
(defcustom todo-remove-separator t (defcustom todo-remove-separator t
"*Non-nil to remove category separators in\ "*Non-nil to remove category separators in \
\\[todo-top-priorities] and \\[todo-print]." \\[todo-top-priorities] and \\[todo-print]."
:type 'boolean :type 'boolean
:group 'todo) :group 'todo)
...@@ -528,8 +528,7 @@ Return nil if ITEM not found." ...@@ -528,8 +528,7 @@ Return nil if ITEM not found."
(defun todo-save () "Save the TODO list." (defun todo-save () "Save the TODO list."
(interactive) (interactive)
(save-buffer) (save-buffer)
(if todo-save-top-priorities-too (todo-save-top-priorities)) (if todo-save-top-priorities-too (todo-save-top-priorities)))
)
(defalias 'todo-cmd-save 'todo-save) (defalias 'todo-cmd-save 'todo-save)
(defun todo-quit () "Done with TODO list for now." (defun todo-quit () "Done with TODO list for now."
...@@ -547,7 +546,7 @@ Return nil if ITEM not found." ...@@ -547,7 +546,7 @@ Return nil if ITEM not found."
(todo-edit-multiline) (todo-edit-multiline)
(let ((new (read-from-minibuffer "Edit: " item))) (let ((new (read-from-minibuffer "Edit: " item)))
(todo-remove-item) (todo-remove-item)
(insert new "\n") (insert new ?\n)
(todo-backward-item) (todo-backward-item)
(message ""))))) (message "")))))
(defalias 'todo-cmd-edit 'todo-edit-item) (defalias 'todo-cmd-edit 'todo-edit-item)
...@@ -572,14 +571,14 @@ Return nil if ITEM not found." ...@@ -572,14 +571,14 @@ Return nil if ITEM not found."
(widen) (widen)
(goto-char (point-min)) (goto-char (point-min))
(let ((posn (search-forward "-*- mode: todo; " 17 t))) (let ((posn (search-forward "-*- mode: todo; " 17 t)))
(if (not (null posn)) (goto-char posn)) (if posn
(if (equal posn nil)
(progn (progn
(insert "-*- mode: todo; \n") (goto-char posn)
(forward-char -1)) (kill-line))
(kill-line))) (insert "-*- mode: todo; \n")
(backward-char)))
(insert (format "todo-categories: %S; -*-" todo-categories)) (insert (format "todo-categories: %S; -*-" todo-categories))
(forward-char 1) (forward-char)
(insert (format "%s%s%s\n%s\n%s %s\n" (insert (format "%s%s%s\n%s\n%s %s\n"
todo-prefix todo-category-beg cat todo-prefix todo-category-beg cat
todo-category-end todo-category-end
...@@ -604,7 +603,7 @@ Return nil if ITEM not found." ...@@ -604,7 +603,7 @@ Return nil if ITEM not found."
(while (> (- bottom top) todo-insert-threshold) (while (> (- bottom top) todo-insert-threshold)
(let* ((current (/ (+ top bottom) 2)) (let* ((current (/ (+ top bottom) 2))
(answer (if (< current bottom) (answer (if (< current bottom)
(todo-more-important-p current) nil))) (todo-more-important-p current))))
(if answer (if answer
(setq bottom current) (setq bottom current)
(setq top (1+ current))))) (setq top (1+ current)))))
...@@ -612,7 +611,7 @@ Return nil if ITEM not found." ...@@ -612,7 +611,7 @@ Return nil if ITEM not found."
;; goto-line doesn't have the desired behavior in a narrowed buffer ;; goto-line doesn't have the desired behavior in a narrowed buffer
(goto-char (point-min)) (goto-char (point-min))
(forward-line (1- top))) (forward-line (1- top)))
(insert new-item "\n") (insert new-item ?\n)
(todo-backward-item) (todo-backward-item)
(progn ;;; horrible os10000 hack to make items appear when inserting into empty buffer (progn ;;; horrible os10000 hack to make items appear when inserting into empty buffer
(widen) (widen)
...@@ -623,7 +622,7 @@ Return nil if ITEM not found." ...@@ -623,7 +622,7 @@ Return nil if ITEM not found."
(message ""))) (message "")))
;;;###autoload ;;;###autoload
(defun todo-insert-item (ARG) (defun todo-insert-item (arg)
"Insert new TODO list entry. "Insert new TODO list entry.
With a prefix argument solicit the category, otherwise use the current With a prefix argument solicit the category, otherwise use the current
category." category."
...@@ -639,12 +638,11 @@ category." ...@@ -639,12 +638,11 @@ category."
(history (cons 'categories (1+ todo-category-number))) (history (cons 'categories (1+ todo-category-number)))
(current-category (nth todo-category-number todo-categories)) (current-category (nth todo-category-number todo-categories))
(category (category
(if ARG (if arg
current-category current-category
(completing-read (completing-read
(concat "Category [" (concat "Category [" current-category "]: ")
current-category "]: ") (todo-category-alist) nil nil nil history current-category))))
(todo-category-alist) nil nil nil history))))
(todo-add-item-non-interactively new-item category)))) (todo-add-item-non-interactively new-item category))))
(defalias 'todo-cmd-inst 'todo-insert-item) (defalias 'todo-cmd-inst 'todo-insert-item)
...@@ -680,10 +678,9 @@ category." ...@@ -680,10 +678,9 @@ category."
(let* ((todo-entry (todo-item-string-start)) (let* ((todo-entry (todo-item-string-start))
(todo-answer (y-or-n-p (concat "Permanently remove '" (todo-answer (y-or-n-p (concat "Permanently remove '"
todo-entry "'? ")))) todo-entry "'? "))))
(if todo-answer (when todo-answer
(progn (todo-remove-item)
(todo-remove-item) (todo-backward-item))
(todo-backward-item)))
(message "")) (message ""))
(error "No TODO list entry to delete"))) (error "No TODO list entry to delete")))
(defalias 'todo-cmd-kill 'todo-delete-item) (defalias 'todo-cmd-kill 'todo-delete-item)
...@@ -695,7 +692,7 @@ category." ...@@ -695,7 +692,7 @@ category."
(todo-remove-item) (todo-remove-item)
(todo-backward-item) (todo-backward-item)
(save-excursion (save-excursion
(insert item "\n")) (insert item ?\n))
(message "")) (message ""))
(error "No TODO list entry to raise"))) (error "No TODO list entry to raise")))
(defalias 'todo-cmd-raise 'todo-raise-item) (defalias 'todo-cmd-raise 'todo-raise-item)
...@@ -708,7 +705,7 @@ category." ...@@ -708,7 +705,7 @@ category."
(todo-remove-item) (todo-remove-item)
(todo-forward-item) (todo-forward-item)
(save-excursion (save-excursion
(insert item "\n")) (insert item ?\n))
(message "")) (message ""))
(error "No TODO list entry to lower"))) (error "No TODO list entry to lower")))
(defalias 'todo-cmd-lowr 'todo-lower-item) (defalias 'todo-cmd-lowr 'todo-lower-item)
...@@ -719,15 +716,14 @@ category." ...@@ -719,15 +716,14 @@ category."
(or (> (count-lines (point-min) (point-max)) 0) (or (> (count-lines (point-min) (point-max)) 0)
(error "No TODO list entry to file away")) (error "No TODO list entry to file away"))
(let ((time-stamp-format todo-time-string-format)) (let ((time-stamp-format todo-time-string-format))
(if (and comment (> (length comment) 0)) (when (and comment (> (length comment) 0))
(progn (goto-char (todo-item-end))
(goto-char (todo-item-end)) (insert
(insert (if (save-excursion (beginning-of-line)
(if (save-excursion (beginning-of-line) (looking-at (regexp-quote todo-prefix)))
(looking-at (regexp-quote todo-prefix))) " "
" " "\n\t")
"\n\t") "(" comment ")"))
"(" comment ")")))
(goto-char (todo-item-end)) (goto-char (todo-item-end))
(insert " [" (nth todo-category-number todo-categories) "]") (insert " [" (nth todo-category-number todo-categories) "]")
(goto-char (todo-item-start)) (goto-char (todo-item-start))
...@@ -776,10 +772,9 @@ between each category." ...@@ -776,10 +772,9 @@ between each category."
(copy-to-buffer todo-print-buffer-name (point-min) (point-max)) (copy-to-buffer todo-print-buffer-name (point-min) (point-max))
(set-buffer todo-print-buffer-name) (set-buffer todo-print-buffer-name)
(goto-char (point-min)) (goto-char (point-min))
(if (re-search-forward (regexp-quote todo-header) nil t) (when (re-search-forward (regexp-quote todo-header) nil t)
(progn (beginning-of-line 1)
(beginning-of-line 1) (kill-line)) ;Remove mode line
(kill-line))) ;Remove mode line
(while (re-search-forward ;Find category start (while (re-search-forward ;Find category start
(regexp-quote (concat todo-prefix todo-category-beg)) (regexp-quote (concat todo-prefix todo-category-beg))
nil t) nil t)
...@@ -790,7 +785,7 @@ between each category." ...@@ -790,7 +785,7 @@ between each category."
(narrow-to-region beg end) ;In case we have too few entries. (narrow-to-region beg end) ;In case we have too few entries.
(goto-char (point-min)) (goto-char (point-min))
(if (= 0 nof-priorities) ;Traverse entries. (if (= 0 nof-priorities) ;Traverse entries.
(goto-char end) ;All entries (goto-char end) ;All entries
(todo-forward-item nof-priorities)) (todo-forward-item nof-priorities))
(setq beg (point)) (setq beg (point))
(delete-region beg end) (delete-region beg end)
...@@ -968,15 +963,15 @@ Number of entries for each category is given by ...@@ -968,15 +963,15 @@ Number of entries for each category is given by
(if (file-exists-p todo-file-do) (if (file-exists-p todo-file-do)
(find-file todo-file-do) (find-file todo-file-do)
(todo-initial-setup)) (todo-initial-setup))
(if (null todo-categories) (unless todo-categories
(if (null todo-cats) (if (null todo-cats)
(error "Error in %s: No categories in list `todo-categories'" (error "Error in %s: No categories in list `todo-categories'"
todo-file-do) todo-file-do)
(goto-char (point-min)) (goto-char (point-min))
(and (search-forward "todo-cats:" nil t) (and (search-forward "todo-cats:" nil t)
(replace-match "todo-categories:")) (replace-match "todo-categories:"))
(make-local-variable 'todo-categories) (make-local-variable 'todo-categories)
(setq todo-categories todo-cats))) (setq todo-categories todo-cats)))
(beginning-of-line) (beginning-of-line)
(todo-category-select)) (todo-category-select))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment