From bbf95285a036398ed993e6051249f094b1c4d354 Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Mon, 3 Dec 2012 00:37:25 +0100 Subject: [PATCH] * calendar/todos.el (todos-show): Fix a comment. (todos-add-category): Prompt for a new category if passed category is the empty string, not nil. --- lisp/ChangeLog | 40 ++++++++++++++++++++++++++++++++++++++++ lisp/calendar/todos.el | 9 +++++---- 2 files changed, 45 insertions(+), 4 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 21e15256a05..98df5d3fe92 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2012-12-02 Stephen Berman + + * calendar/todos.el (todos-show): Fix a comment. + (todos-add-category): Prompt for a new category if passed category + is the empty string, not nil. + 2012-11-26 Stephen Berman * calendar/todos.el (todos-make-categories-list) @@ -42,11 +48,13 @@ 2012-09-24 Stephen Berman + Changes from 2012-07-14 (revision 110020). * calendar/todos.el (todos-copy-item): New command. (todos-insertion-map): Add key binding for it. 2012-09-24 Stephen Berman + Changes from 2012-07-13 (revision 110019). * calendar/todos.el (todos-undo-item-omit-comment): New defcustom. (todos-item-undo): Use it. (todos-allcats-file, todos-all-categories-alist): New variables. @@ -57,6 +65,7 @@ 2012-09-24 Stephen Berman + Changes from 2012-06-27 (revision 110018). * calendar/todos.el: Further code rearrangement; further new and revised comments. (todos-reevaluate-filelist-defcustoms): Rename from @@ -73,6 +82,7 @@ 2012-09-23 Stephen Berman + Changes from 2012-06-25 (revision 110017). * calendar/todos.el (todos-item-undo): Fix restoration on cancelling; use buffer-substring-no-properties; comment out code removing mark overlay; fix insertion of undone items; display any @@ -80,6 +90,7 @@ 2012-09-23 Stephen Berman + Changes from 2012-06-24 (revision 110016). * calendar/todos.el: Further significant code rearrangement; further comment revision. (todos-mode-display): New defgroup. @@ -108,6 +119,7 @@ 2012-09-23 Stephen Berman + Changes from 2012-06-21 (revision 110015). * calendar/todos.el: Further comment revision. (todos-sorted-column): Change default value, also taking tty into account. @@ -137,6 +149,7 @@ 2012-09-23 Stephen Berman + Changes from 2012-06-15 (revision 110014). * calendar/todos.el (todos-reset-done-separator) (todos-reset-and-enable-done-separator): New functions. (todos-reset-done-separator-string): Rewrite using @@ -148,6 +161,7 @@ 2012-09-23 Stephen Berman + Changes from 2012-06-14 (revision 110013). * calendar/todos.el (todos-done-separator-string): New defcustom. (todos-done-separator): New variable replacing defcustom of the same name. @@ -161,6 +175,7 @@ 2012-09-23 Stephen Berman + Changes from 2012-06-03 (revision 110012). * calendar/todos.el: Further comment revision. (todos-sorted-column): Change default value. (todos-item-start): Handle empty category (needed in @@ -187,6 +202,7 @@ 2012-09-23 Stephen Berman + Changes from 2012-06-02 (revision 110011). * calendar/todos.el: Significant code rearrangement; further comment revision. (todos-filtered-items-buffer): Rename from todos-filter-buffer and @@ -210,6 +226,7 @@ 2012-09-22 Stephen Berman + Changes from 2012-06-02 (revision 110010). * calendar/todos.el: Further code rearrangement and comment revision. (todos-item-start): Handle empty line between todo and done items @@ -226,6 +243,7 @@ 2012-09-22 Stephen Berman + Changes from 2012-06-01 (revision 110009). * calendar/todos.el: Further code rearrangement and comment revision. (todos-add-to-buffer-list, todos-update-buffer-list): New functions. @@ -261,6 +279,7 @@ 2012-09-21 Stephen Berman + Changes from 2012-05-29 (revision 110008). * calendar/todos.el: Further comment revision. (todos-item-end): Replace use of command todos-forward-item by regexp searches using internal variables. @@ -269,6 +288,7 @@ 2012-09-21 Stephen Berman + Changes from 2012-05-29 (revision 110007). * calendar/todos.el (todos-ignore-archived-categories): Revert last change; remove :initialize and :set functions; change use and change users accordingly. @@ -295,11 +315,13 @@ 2012-09-21 Stephen Berman + Changes from 2012-05-28 (revision 110006). * calendar/todos.el: Doubts about todos-ignore-archived-categories. (todos-ignore-archived-categories): Change default value. 2012-09-21 Stephen Berman + Changes from 2012-05-27 (revision 110005). * calendar/todos.el: Further comment revision. (todos-reset-global-current-todos-file): Try to make this not slow down kill-buffer. @@ -315,6 +337,7 @@ 2012-09-21 Stephen Berman + Changes from 2012-05-25 (revision 110004). * calendar/todos.el: Further comment revision. (todos-set-item-top-priority): New command. (todos-reset-global-current-todos-file): @@ -352,6 +375,7 @@ 2012-09-21 Stephen Berman + Changes from 2012-05-23 (revision 110003). * calendar/todos.el (todos-key-bindings): Remove binding of deleted command. (todos-menu): Remove entry of deleted command. @@ -362,6 +386,7 @@ 2012-09-21 Stephen Berman + Changes from 2012-05-22 (revision 110002). * calendar/todos.el (todos-set-show-current-file): Rename from todos-toggle-show-current-file and adjust callers. (todos-number-priorities): Rename from todos-number-prefix and @@ -380,6 +405,7 @@ 2012-09-21 Stephen Berman + Changes from 2012-05-21 (revision 110001). * calendar/todos.el: Further comment revision and code rearrangement. (todos-item-end): Revert last change. @@ -396,6 +422,7 @@ 2012-09-21 Stephen Berman + Changes from 2012-05-19 (revision 110000). * calendar/todos.el: Add and revise further doc strings and comments. (todos-filter-function, todos-custom-items) @@ -418,6 +445,7 @@ 2012-09-20 Stephen Berman + Changes from 2012-05-17 (revision 109999). * calendar/todos.el: Add and revise further doc strings and comments; major code rearrangement. (todos-merged-files, todos-prompt-merged-files) @@ -554,11 +582,13 @@ 2012-09-19 Stephen Berman + Changes from 2011-12-03 (revision 109998). * calendar/todos.el (todos-item-start): Restore commented out code to prevent wrongly moving point in widened buffer. 2012-09-19 Stephen Berman + Changes from 2011-12-02 (revision 109997). * calendar/todos.el: Remove old commentary from todo-mode.el; add and revise further doc strings and comments; require cl.el at compile time for remove-duplicates; use function powerset from @@ -764,6 +794,7 @@ 2012-09-18 Stephen Berman + Changes from 2011-05-16 (revision 109996). * calendar/todos.el Add and revise various doc strings, remove further commented out code; add further comments; further code rearrangement. @@ -988,6 +1019,7 @@ 2012-09-14 Stephen Berman + Changes from 2010-07-09 (revision 109995). * calendar/todos.el Remove lots of commented out code; add various comments; further code rearrangement. (todos-insert-item-here-ask-date-time) @@ -1053,6 +1085,7 @@ 2012-09-13 Stephen Berman + Changes from 2010-06-18 (revision 109994). * calendar/todos.el: Numerous spelling and comment fixes, doc string fixes to conform with checkdoc, further rearrangement of definitions, etc. @@ -1148,6 +1181,7 @@ 2012-09-13 Stephen Berman + Changes from 2010-05-25 (revision 109993). * calendar/todos.el: Comment out calendar require, since diary-lib requires calendar. Rearrange file to group definitions according to their use (types of commands, internal functions, etc.) @@ -1242,6 +1276,7 @@ 2012-09-12 Stephen Berman + Changes from 2009-11-07 (revision 109992). * calendar/todos.el: Comment out time-stamp require; require calendar and diary-lib. (todos-prefix): Change default value and doc string to reflect new @@ -1300,6 +1335,7 @@ 2012-09-12 Stephen Berman + Changes from 2009-07-04 (revision 109991). * calendar/todos.el (todos-window-configuration): Comment out. (todos-display-categories): Comment out use of todos-window-configuration; use switch-to-buffer instead of @@ -1313,6 +1349,7 @@ 2012-09-12 Stephen Berman + Changes from 2009-06-26 (revision 109989). * calendar/todos.el (todos-file-do, todos-file-done): Change default location to directory "~/.emacs.d/". (todos-completion-ignore-case, todos-categories-buffer): @@ -1336,11 +1373,13 @@ 2012-09-12 Stephen Berman + Changes from 2009-02-16 (revision 109988). * calendar/todos.el (todos-list-categories): Fix typos. (todos-show): Ensure file is in todos-mode. 2012-09-12 Stephen Berman + Changes from 2009-02-12 (revision 109987). * calendar/todos.el (todos-header): Remove defvar. (todos-add-category): Comment out code that inserts and updates the file local variables first line of the file todos-file-do. @@ -1349,6 +1388,7 @@ 2012-09-11 Stephen Berman + Changes from 2009-02-12 (revision 109986). * calendar/todos.el: New file. This is a copy of todo-mode.el from revision 94343 except for the following changes: replace all occurrences of the namespace prefix "todo-" with "todos-", delete diff --git a/lisp/calendar/todos.el b/lisp/calendar/todos.el index 0e2ee569faa..70f144d8004 100644 --- a/lisp/calendar/todos.el +++ b/lisp/calendar/todos.el @@ -2792,9 +2792,8 @@ corresponding Todos file, displaying the corresponding category." ;; file, if it exists. (when (assoc cat todos-categories) (setq todos-category-number (todos-category-number cat))) - ;; If no Todos file exists, initialize one. + ;; If this is a new Todos file, add its first category. (when (zerop (buffer-size)) - ;; Call with empty category name to get initial prompt. (setq todos-category-number (todos-add-category ""))) (save-excursion (todos-category-select))) (setq todos-first-visit nil))) @@ -3641,6 +3640,7 @@ The items are those in the files listed in `todos-filter-files'." (todos-filter-items 'regexp t) (todos-filtered-buffer-name buf files))) +;; --------------------------------------------------------------------------- ;;; Editing Commands (defun todos-add-file () @@ -3665,7 +3665,6 @@ Noninteractively, return the name of the new file." (todos-show)) file))) -;; --------------------------------------------------------------------------- ;;; Category editing commands (defun todos-add-category (&optional cat) @@ -3677,7 +3676,9 @@ the category name and the return value is the category number." (let* ((buffer-read-only) (num (1+ (length todos-categories))) (counts (make-vector 4 0))) ; [todo diary done archived] - (unless cat + ;; If cat is passed from caller, don't prompt, unless it is "", + ;; which means the file was just added and has no category yet. + (unless (and cat (> (length cat) 0)) (setq cat (todos-read-category "Enter new category name: " nil t))) (setq todos-categories (append todos-categories (list (cons cat counts)))) (widen) -- 2.11.4.GIT