diff options
| author | Stephen Berman | 2013-05-11 22:50:28 +0200 |
|---|---|---|
| committer | Stephen Berman | 2013-05-11 22:50:28 +0200 |
| commit | 5bdcc430533161f63d03eff01cf8601cb2dbf730 (patch) | |
| tree | a8f172aa0fbfdfd43b67f2e5e2e320ea08c3a5dc | |
| parent | caa229d50ae09275af0453c44458a00c1c7d110c (diff) | |
| download | emacs-5bdcc430533161f63d03eff01cf8601cb2dbf730.tar.gz emacs-5bdcc430533161f63d03eff01cf8601cb2dbf730.zip | |
* todos.el (todos-item-undone): Remove item highlighting when user
quits before deciding whether to omit comment. Fix misplaced
closing paren. Change two uses of `if' to `when'.
| -rw-r--r-- | lisp/calendar/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/calendar/todos.el | 74 |
2 files changed, 44 insertions, 36 deletions
diff --git a/lisp/calendar/ChangeLog b/lisp/calendar/ChangeLog index 10b2d750344..fcdcf20151d 100644 --- a/lisp/calendar/ChangeLog +++ b/lisp/calendar/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2013-05-11 Stephen Berman <stephen.berman@gmx.net> | ||
| 2 | |||
| 3 | * todos.el (todos-item-undone): Remove item highlighting when user | ||
| 4 | quits before deciding whether to omit comment. Fix misplaced | ||
| 5 | closing paren. Change two uses of `if' to `when'. | ||
| 6 | |||
| 1 | 2013-05-10 Stephen Berman <stephen.berman@gmx.net> | 7 | 2013-05-10 Stephen Berman <stephen.berman@gmx.net> |
| 2 | 8 | ||
| 3 | * todos.el: Rename numerous commands and defcustoms and adjust all | 9 | * todos.el: Rename numerous commands and defcustoms and adjust all |
diff --git a/lisp/calendar/todos.el b/lisp/calendar/todos.el index e203949c10a..aff12e62158 100644 --- a/lisp/calendar/todos.el +++ b/lisp/calendar/todos.el | |||
| @@ -5770,41 +5770,43 @@ comments without asking." | |||
| 5770 | (and marked (goto-char (point-min))) | 5770 | (and marked (goto-char (point-min))) |
| 5771 | (catch 'done | 5771 | (catch 'done |
| 5772 | (while (not (eobp)) | 5772 | (while (not (eobp)) |
| 5773 | (if (or (not marked) (and marked (todos-marked-item-p))) | 5773 | (when (or (not marked) (and marked (todos-marked-item-p))) |
| 5774 | (if (not (todos-done-item-p)) | 5774 | (if (not (todos-done-item-p)) |
| 5775 | (error "Only done items can be undone") | 5775 | (error "Only done items can be undone") |
| 5776 | (todos-item-start) | 5776 | (todos-item-start) |
| 5777 | (unless marked | 5777 | (unless marked |
| 5778 | (setq ov (make-overlay (save-excursion (todos-item-start)) | 5778 | (setq ov (make-overlay (save-excursion (todos-item-start)) |
| 5779 | (save-excursion (todos-item-end)))) | 5779 | (save-excursion (todos-item-end)))) |
| 5780 | (overlay-put ov 'face 'todos-search)) | 5780 | (overlay-put ov 'face 'todos-search)) |
| 5781 | ;; Find the end of the date string added upon tagging item as | 5781 | ;; Find the end of the date string added upon tagging item as |
| 5782 | ;; done. | 5782 | ;; done. |
| 5783 | (setq start (search-forward "] ")) | 5783 | (setq start (search-forward "] ")) |
| 5784 | (setq item-count (1+ item-count)) | 5784 | (setq item-count (1+ item-count)) |
| 5785 | (unless (looking-at (regexp-quote todos-nondiary-start)) | 5785 | (unless (looking-at (regexp-quote todos-nondiary-start)) |
| 5786 | (setq diary-count (1+ diary-count))) | 5786 | (setq diary-count (1+ diary-count))) |
| 5787 | (setq end (save-excursion (todos-item-end))) | 5787 | (setq end (save-excursion (todos-item-end))) |
| 5788 | ;; Ask (once) whether to omit done item's comment. If | 5788 | ;; Ask (once) whether to omit done item's comment. If |
| 5789 | ;; affirmed, omit subsequent comments without asking. | 5789 | ;; affirmed, omit subsequent comments without asking. |
| 5790 | (when (re-search-forward | 5790 | (when (re-search-forward |
| 5791 | (concat " \\[" (regexp-quote todos-comment-string) | 5791 | (concat " \\[" (regexp-quote todos-comment-string) |
| 5792 | ": [^]]+\\]") end t) | 5792 | ": [^]]+\\]") end t) |
| 5793 | (if (eq first 'first) | 5793 | (unwind-protect |
| 5794 | (setq first | 5794 | (if (eq first 'first) |
| 5795 | (if (eq todos-undo-item-omit-comment 'ask) | 5795 | (setq first |
| 5796 | (when (y-or-n-p (concat "Omit comment" pl | 5796 | (if (eq todos-undo-item-omit-comment 'ask) |
| 5797 | " from restored item" | 5797 | (when (y-or-n-p (concat "Omit comment" pl |
| 5798 | pl "? ")) | 5798 | " from restored item" |
| 5799 | 'omit) | 5799 | pl "? ")) |
| 5800 | (when todos-undo-item-omit-comment 'omit))) | 5800 | 'omit) |
| 5801 | t) | 5801 | (when todos-undo-item-omit-comment 'omit))) |
| 5802 | (when (eq first 'omit) | 5802 | t) |
| 5803 | (setq end (match-beginning 0))) | 5803 | (when (and (eq first 'first) ov) (delete-overlay ov))) |
| 5804 | (setq item (concat item | 5804 | (when (eq first 'omit) |
| 5805 | (buffer-substring-no-properties start end) | 5805 | (setq end (match-beginning 0)))) |
| 5806 | (when marked "\n"))) | 5806 | (setq item (concat item |
| 5807 | (unless marked (throw 'done nil))))) | 5807 | (buffer-substring-no-properties start end) |
| 5808 | (when marked "\n"))) | ||
| 5809 | (unless marked (throw 'done nil)))) | ||
| 5808 | (todos-forward-item))) | 5810 | (todos-forward-item))) |
| 5809 | (unwind-protect | 5811 | (unwind-protect |
| 5810 | (progn | 5812 | (progn |
| @@ -5814,7 +5816,7 @@ comments without asking." | |||
| 5814 | (todos-set-item-priority item cat t) | 5816 | (todos-set-item-priority item cat t) |
| 5815 | (setq npoint (point)) | 5817 | (setq npoint (point)) |
| 5816 | (setq undone t)) | 5818 | (setq undone t)) |
| 5817 | (if ov (delete-overlay ov)) | 5819 | (when ov (delete-overlay ov)) |
| 5818 | (if (not undone) | 5820 | (if (not undone) |
| 5819 | (goto-char opoint) | 5821 | (goto-char opoint) |
| 5820 | (if marked | 5822 | (if marked |