*** emacs/lisp/calendar/todo-mode.el.~1.72.~ 2009-01-09 11:48:58.000000000 +0100 --- emacs/lisp/calendar/todo-mode.el 2009-01-21 10:36:15.000000000 +0100 *************** *** 596,610 **** "New TODO entry: " (if todo-entry-prefix-function (funcall todo-entry-prefix-function))))) - (categories todo-categories) - (history (cons 'categories (1+ todo-category-number))) (current-category (nth todo-category-number todo-categories)) ! (category ! (if arg ! current-category ! (completing-read (concat "Category [" current-category "]: ") ! (todo-category-alist) nil nil nil ! history current-category)))) (todo-add-item-non-interactively new-item category)))) (defalias 'todo-cmd-inst 'todo-insert-item) --- 596,603 ---- "New TODO entry: " (if todo-entry-prefix-function (funcall todo-entry-prefix-function))))) (current-category (nth todo-category-number todo-categories)) ! (category (if arg (todo-completing-read) current-category))) (todo-add-item-non-interactively new-item category)))) (defalias 'todo-cmd-inst 'todo-insert-item) *************** *** 801,812 **** (defun todo-jump-to-category () "Jump to a category. Default is previous category." (interactive) ! (let* ((categories todo-categories) ! (history (cons 'categories (1+ todo-category-number))) ! (default (nth todo-category-number todo-categories)) ! (category (completing-read ! (concat "Category [" default "]: ") ! (todo-category-alist) nil nil nil history default))) (if (string= "" category) (setq category (nth todo-category-number todo-categories))) (setq todo-category-number --- 794,800 ---- (defun todo-jump-to-category () "Jump to a category. Default is previous category." (interactive) ! (let ((category (todo-completing-read))) (if (string= "" category) (setq category (nth todo-category-number todo-categories))) (setq todo-category-number *************** *** 861,869 **** "Return non-nil if STRING spans several lines." (> (todo-string-count-lines string) 1)) ! (defun todo-category-alist () ! "Generate an alist for use in `completing-read' from `todo-categories'." ! (mapcar #'list todo-categories)) ;; --------------------------------------------------------------------------- --- 849,867 ---- "Return non-nil if STRING spans several lines." (> (todo-string-count-lines string) 1)) ! (defun todo-completing-read () ! "Return a category name, with completion, for use in Todo mode." ! ;; make a copy of todo-categories in case history-delete-duplicates is ! ;; non-nil, which makes completing-read alter todo-categories ! (let* ((categories (copy-sequence todo-categories)) ! (history (cons 'todo-categories (1+ todo-category-number))) ! (default (nth todo-category-number todo-categories)) ! (category (completing-read ! (concat "Category [" default "]: ") ! todo-categories nil nil nil history default))) ! ;; restore the original value of todo-categories ! (setq todo-categories categories) ! category)) ;; ---------------------------------------------------------------------------