aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Berman2012-05-23 00:22:20 +0100
committerStephen Berman2012-05-23 00:22:20 +0100
commit47011bed9269db359bd9c9a447e5617409bd30be (patch)
tree2d827d718a60356ddc1d8d4f2abdfddea01ca368
parent3af3cd0bb9e53beb8c2fd1dd2971a36c19df22a4 (diff)
downloademacs-47011bed9269db359bd9c9a447e5617409bd30be.tar.gz
emacs-47011bed9269db359bd9c9a447e5617409bd30be.zip
* calendar/todos.el (todos-key-bindings): Remove binding of
deleted command. (todos-menu): Remove entry of deleted command. (todos-show-archive): Fix last change. (todos-done-item-add-or-edit-comment): Rename from todos-comment-done-item and adjust callers; prompt to edit an existing comment.
-rw-r--r--lisp/ChangeLog10
-rw-r--r--lisp/calendar/todos.el119
2 files changed, 48 insertions, 81 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 198361e4822..4e6a3bff7a1 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,15 @@
12012-09-21 Stephen Berman <stephen.berman@gmx.net> 12012-09-21 Stephen Berman <stephen.berman@gmx.net>
2 2
3 * calendar/todos.el (todos-key-bindings): Remove binding of
4 deleted command.
5 (todos-menu): Remove entry of deleted command.
6 (todos-show-archive): Fix last change.
7 (todos-done-item-add-or-edit-comment): Rename from
8 todos-comment-done-item and adjust callers; prompt to edit an
9 existing comment.
10
112012-09-21 Stephen Berman <stephen.berman@gmx.net>
12
3 * calendar/todos.el: (todos-set-show-current-file): Rename from 13 * calendar/todos.el: (todos-set-show-current-file): Rename from
4 todos-toggle-show-current-file and adjust callers. 14 todos-toggle-show-current-file and adjust callers.
5 (todos-number-priorities): Rename from todos-number-prefix and 15 (todos-number-priorities): Rename from todos-number-prefix and
diff --git a/lisp/calendar/todos.el b/lisp/calendar/todos.el
index 4e7e19d9556..f2b31e00e00 100644
--- a/lisp/calendar/todos.el
+++ b/lisp/calendar/todos.el
@@ -2243,7 +2243,6 @@ which is the value of the user option
2243 ("PF" . todos-print-to-file) 2243 ("PF" . todos-print-to-file)
2244 ("v" . todos-hide-show-done-items) 2244 ("v" . todos-hide-show-done-items)
2245 ("V" . todos-show-done-only) 2245 ("V" . todos-show-done-only)
2246 ("Av" . todos-view-archived-items)
2247 ("As" . todos-show-archive) 2246 ("As" . todos-show-archive)
2248 ("Ac" . todos-choose-archive) 2247 ("Ac" . todos-choose-archive)
2249 ("Y" . todos-diary-items) 2248 ("Y" . todos-diary-items)
@@ -2290,7 +2289,7 @@ which is the value of the user option
2290 ;; ("" . todos-edit-category-diary-inclusion) 2289 ;; ("" . todos-edit-category-diary-inclusion)
2291 ("eyn" . todos-edit-item-diary-nonmarking) 2290 ("eyn" . todos-edit-item-diary-nonmarking)
2292 ;;("" . todos-edit-category-diary-nonmarking) 2291 ;;("" . todos-edit-category-diary-nonmarking)
2293 ("ec" . todos-comment-done-item) ;FIXME: or just "c"? 2292 ("ec" . todos-done-item-add-or-edit-comment) ;FIXME: or just "c"?
2294 ("i" . ,todos-insertion-map) 2293 ("i" . ,todos-insertion-map)
2295 ("k" . todos-delete-item) 2294 ("k" . todos-delete-item)
2296 ("m" . todos-move-item) 2295 ("m" . todos-move-item)
@@ -2349,7 +2348,6 @@ which is the value of the user option
2349 ["View Top Priority Items" todos-top-priorities t] 2348 ["View Top Priority Items" todos-top-priorities t]
2350 ["View Multifile Top Priority Items" todos-top-priorities-multifile t] 2349 ["View Multifile Top Priority Items" todos-top-priorities-multifile t]
2351 "---" 2350 "---"
2352 ["View Archive" todos-view-archive t]
2353 ["Print Category" todos-print t]) 2351 ["Print Category" todos-print t])
2354 ("Editing" 2352 ("Editing"
2355 ["Insert New Item" todos-insert-item t] 2353 ["Insert New Item" todos-insert-item t]
@@ -2731,55 +2729,6 @@ are shown in `todos-archived-only' face."
2731 (setq todos-show-done-only (not todos-show-done-only)) 2729 (setq todos-show-done-only (not todos-show-done-only))
2732 (todos-category-select)) 2730 (todos-category-select))
2733 2731
2734;; (defun todos-view-archived-items ()
2735;; "Display the archived items of the current category.
2736;; The buffer showing these items is in Todos Archive mode."
2737;; (interactive)
2738;; (let ((cat (todos-current-category)))
2739;; (if (zerop (todos-get-count 'archived cat))
2740;; (message "There are no archived items from this category.")
2741;; (let* ((tfile-base (file-name-sans-extension todos-current-todos-file))
2742;; (afile (concat tfile-base ".toda")))
2743;; (set-window-buffer (selected-window) (set-buffer
2744;; (find-file-noselect afile)))
2745;; (todos-category-number cat)
2746;; (todos-jump-to-category cat)))))
2747
2748;; (defun todos-show-archive (&optional ask)
2749;; "Visit the archive of the current Todos category, if it exists.
2750;; If the category has no archived items, prompt to visit the
2751;; archive anyway. If there is no archive for this file or with
2752;; non-nil argument ASK, prompt to visit another archive.
2753
2754;; With non-nil argument ASK prompt to choose an archive to visit;
2755;; see `todos-choose-archive'. The buffer showing the archive is in
2756;; Todos Archive mode. The first visit in a session displays the
2757;; first category in the archive, subsequent visits return to the
2758;; last category displayed." ;FIXME
2759;; (interactive)
2760;; (let* ((cat (todos-current-category))
2761;; (count (todos-get-count 'archived cat))
2762;; (tfile-base (file-name-sans-extension todos-current-todos-file))
2763;; (afile (if ask
2764;; (todos-read-file-name "Choose a Todos archive: " t t)
2765;; (concat tfile-base ".toda")))
2766;; (answer t))
2767;; (when (not (file-exists-p afile))
2768;; (if (y-or-n-p "This file has no archive; visit another archive? ")
2769;; (setq afile (todos-read-file-name "Choose a Todos archive: " t t))
2770;; (setq answer nil)))
2771;; (when answer
2772;; (if (zerop count)
2773;; (when (y-or-n-p (concat "This category has no archived items; "
2774;; "visit archive anyway? "))
2775;; (set-window-buffer (selected-window)
2776;; (set-buffer (find-file-noselect afile)))
2777;; (todos-category-select))
2778;; (set-window-buffer (selected-window)
2779;; (set-buffer (find-file-noselect afile)))
2780;; (todos-category-number cat)
2781;; (todos-jump-to-category cat)))))
2782
2783(defun todos-show-archive (&optional ask) 2732(defun todos-show-archive (&optional ask)
2784 "Visit the archive of the current Todos category, if it exists. 2733 "Visit the archive of the current Todos category, if it exists.
2785If the category has no archived items, prompt to visit the 2734If the category has no archived items, prompt to visit the
@@ -2796,28 +2745,26 @@ last category displayed." ;FIXME
2796 (count (todos-get-count 'archived cat)) 2745 (count (todos-get-count 'archived cat))
2797 (archive (concat (file-name-sans-extension todos-current-todos-file) 2746 (archive (concat (file-name-sans-extension todos-current-todos-file)
2798 ".toda")) 2747 ".toda"))
2799 (answer 'this-archive)) 2748 place)
2800 (when (or ask 2749 (setq place (cond (ask 'other-archive)
2801 (and (not (file-exists-p archive)) 2750 ((file-exists-p archive) 'this-archive)
2802 (y-or-n-p (concat "This file has no archive; " 2751 (t (when (y-or-n-p (concat "This file has no archive; "
2803 "visit another archive? ")))) 2752 "visit another archive? "))
2804 (setq archive (todos-read-file-name 2753 'other-archive))))
2805 "Choose a Todos archive: " t t)) 2754 (when (eq place 'other-archive)
2806 'other-archive)) 2755 (setq archive (todos-read-file-name "Choose a Todos archive: " t t)))
2807 (when (and (eq answer 'this-archive) 2756 (when (and (eq place 'this-archive) (zerop count))
2808 (zerop count)) 2757 (setq place (when (y-or-n-p
2809 (setq answer (if (y-or-n-p 2758 (concat "This category has no archived items;"
2810 (concat "This category has no archived items;" 2759 " visit archive anyway? "))
2811 " visit archive anyway? ")) 2760 'other-cat)))
2812 'other-cat 2761 (when place
2813 'same-cat)))
2814 (when answer
2815 (set-window-buffer (selected-window) 2762 (set-window-buffer (selected-window)
2816 (set-buffer (find-file-noselect archive))) 2763 (set-buffer (find-file-noselect archive)))
2817 (if (eq answer 'same-cat) 2764 (if (member place '(other-archive other-cat))
2818 (todos-category-number cat) 2765 (setq todos-category-number 1)
2819 (setq todos-category-number 1)) 2766 (todos-category-number cat))
2820 (todos-category-select))) 2767 (todos-category-select))))
2821 2768
2822(defun todos-choose-archive () 2769(defun todos-choose-archive ()
2823 "Choose an archive and visit it." 2770 "Choose an archive and visit it."
@@ -4378,7 +4325,7 @@ With non-nil argument LOWER lower item's priority."
4378 (todos-raise-item-priority t)) 4325 (todos-raise-item-priority t))
4379 4326
4380;; FIXME: incorporate todos-(raise|lower)-item-priority ? 4327;; FIXME: incorporate todos-(raise|lower)-item-priority ?
4381;; FIXME: does this DTRT in todos-categories-mode? 4328;; FIXME: this does not DTRT in todos-categories-mode
4382(defun todos-set-item-priority (item cat &optional new) 4329(defun todos-set-item-priority (item cat &optional new)
4383 "Set todo ITEM's priority in category CAT, moving item as needed. 4330 "Set todo ITEM's priority in category CAT, moving item as needed.
4384Interactively, the item and the category are the current ones, 4331Interactively, the item and the category are the current ones,
@@ -4590,14 +4537,25 @@ relocated to the category's (by default hidden) done section."
4590 (save-excursion (todos-category-select)))))) 4537 (save-excursion (todos-category-select))))))
4591 4538
4592;; FIXME: only if there's no comment, or edit an existing comment? 4539;; FIXME: only if there's no comment, or edit an existing comment?
4593(defun todos-comment-done-item () 4540(defun todos-done-item-add-or-edit-comment ()
4594 "Add a comment to this done item." 4541 "Add a comment to this done item or edit an existing comment."
4595 (interactive) 4542 (interactive)
4596 (when (todos-done-item-p) 4543 (when (todos-done-item-p)
4597 (let ((comment (read-string "Enter a comment: ")) 4544 (let ((item (todos-item-string))
4598 buffer-read-only) 4545 (end (save-excursion (todos-item-end)))
4599 (todos-item-end) 4546 comment buffer-read-only)
4600 (insert " [" todos-comment-string ": " comment "]")))) 4547 (save-excursion
4548 (todos-item-start)
4549 (if (re-search-forward (concat " \\["
4550 (regexp-quote todos-comment-string)
4551 ": \\([^]]+\\)\\]") end t)
4552 (progn
4553 (setq comment (read-string "Edit comment: "
4554 (cons (match-string 1) 1)))
4555 (replace-match comment nil nil nil 1))
4556 (setq comment (read-string "Enter a comment: "))
4557 (todos-item-end)
4558 (insert " [" todos-comment-string ": " comment "]"))))))
4601 4559
4602;; FIXME: implement this or done item editing? 4560;; FIXME: implement this or done item editing?
4603(defun todos-uncomment-done-item () 4561(defun todos-uncomment-done-item ()
@@ -4722,8 +4680,7 @@ this category does not exist in the archive, it is created."
4722 (todos-update-count 'done (if (or marked all) count 1)) 4680 (todos-update-count 'done (if (or marked all) count 1))
4723 (todos-update-categories-sexp) 4681 (todos-update-categories-sexp)
4724 ;; Save to file now (using write-region in order not to visit 4682 ;; Save to file now (using write-region in order not to visit
4725 ;; afile) so we can visit it later with todos-view-archived-items 4683 ;; afile) so we can visit it later with todos-show-archive.
4726 ;; or todos-show-archive.
4727 (write-region nil nil afile) 4684 (write-region nil nil afile)
4728 (setq todos-current-todos-file current))) 4685 (setq todos-current-todos-file current)))
4729 (with-current-buffer tbuf 4686 (with-current-buffer tbuf