aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Berman2014-07-06 22:28:38 +0200
committerStephen Berman2014-07-06 22:28:38 +0200
commit41cd2704e2972a1aac00aa5d538d2f66c5f6f664 (patch)
treeef5cbc33b39f21b64a59ed8190781970378657eb
parentb16a9348e471253f67ad4520f013184404c008a1 (diff)
downloademacs-41cd2704e2972a1aac00aa5d538d2f66c5f6f664.tar.gz
emacs-41cd2704e2972a1aac00aa5d538d2f66c5f6f664.zip
* calendar/todo-mode.el: Fix wrong-type-argument error when
marking multiple consecutive items. (todo-toggle-mark-item): Don't try to mark the empty lines at the end of the todo and done items sections. Note in doc string that items marked by passing a numeric prefix argument can include the last todo and first done items. (todo-mark-category): Don't try to mark the empty line between the todo and done items sections.
-rw-r--r--lisp/ChangeLog11
-rw-r--r--lisp/calendar/todo-mode.el60
2 files changed, 48 insertions, 23 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 388adea5627..d97faa780c2 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,14 @@
12014-07-06 Stephen Berman <stephen.berman@gmx.net>
2
3 * calendar/todo-mode.el: Fix wrong-type-argument error when
4 marking multiple consecutive items.
5 (todo-toggle-mark-item): Don't try to mark the empty lines at the
6 end of the todo and done items sections. Note in doc string that
7 items marked by passing a numeric prefix argument can include the
8 last todo and first done items.
9 (todo-mark-category): Don't try to mark the empty line between the
10 todo and done items sections.
11
12014-07-05 Stefan Monnier <monnier@iro.umontreal.ca> 122014-07-05 Stefan Monnier <monnier@iro.umontreal.ca>
2 13
3 * emacs-lisp/edebug.el (edebug-eval-defun): Print result using 14 * emacs-lisp/edebug.el (edebug-eval-defun): Print result using
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index a1da75c20e8..d8bca81ed9b 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -1710,31 +1710,40 @@ means prompt user and omit comment only on confirmation."
1710 1710
1711(defun todo-toggle-mark-item (&optional n) 1711(defun todo-toggle-mark-item (&optional n)
1712 "Mark item with `todo-item-mark' if unmarked, otherwise unmark it. 1712 "Mark item with `todo-item-mark' if unmarked, otherwise unmark it.
1713With a positive numerical prefix argument N, change the 1713With positive numerical prefix argument N, change the marking of
1714marking of the next N items." 1714the next N items in the current category. If both the todo and
1715done items sections are visible, the sequence of N items can
1716consist of the the last todo items and the first done items."
1715 (interactive "p") 1717 (interactive "p")
1716 (when (todo-item-string) 1718 (when (todo-item-string)
1717 (unless (> n 1) (setq n 1)) 1719 (unless (> n 1) (setq n 1))
1718 (dotimes (i n) 1720 (catch 'end
1719 (let* ((cat (todo-current-category)) 1721 (dotimes (i n)
1720 (marks (assoc cat todo-categories-with-marks)) 1722 (let* ((cat (todo-current-category))
1721 (ov (progn 1723 (marks (assoc cat todo-categories-with-marks))
1722 (unless (looking-at todo-item-start) 1724 (ov (progn
1723 (todo-item-start)) 1725 (unless (looking-at todo-item-start)
1724 (todo-get-overlay 'prefix))) 1726 (todo-item-start))
1725 (pref (overlay-get ov 'before-string))) 1727 (todo-get-overlay 'prefix)))
1726 (if (todo-marked-item-p) 1728 (pref (overlay-get ov 'before-string)))
1727 (progn 1729 (if (todo-marked-item-p)
1728 (overlay-put ov 'before-string (substring pref 1)) 1730 (progn
1729 (if (= (cdr marks) 1) ; Deleted last mark in this category. 1731 (overlay-put ov 'before-string (substring pref 1))
1730 (setq todo-categories-with-marks 1732 (if (= (cdr marks) 1) ; Deleted last mark in this category.
1731 (assq-delete-all cat todo-categories-with-marks)) 1733 (setq todo-categories-with-marks
1732 (setcdr marks (1- (cdr marks))))) 1734 (assq-delete-all cat todo-categories-with-marks))
1733 (overlay-put ov 'before-string (concat todo-item-mark pref)) 1735 (setcdr marks (1- (cdr marks)))))
1734 (if marks 1736 (overlay-put ov 'before-string (concat todo-item-mark pref))
1735 (setcdr marks (1+ (cdr marks))) 1737 (if marks
1736 (push (cons cat 1) todo-categories-with-marks)))) 1738 (setcdr marks (1+ (cdr marks)))
1737 (todo-forward-item)))) 1739 (push (cons cat 1) todo-categories-with-marks))))
1740 (todo-forward-item)
1741 ;; Don't try to mark the empty lines at the end of the todo
1742 ;; and done items sections.
1743 (when (looking-at "^$")
1744 (if (eobp)
1745 (throw 'end nil)
1746 (todo-forward-item)))))))
1738 1747
1739(defun todo-mark-category () 1748(defun todo-mark-category ()
1740 "Mark all visible items in this category with `todo-item-mark'." 1749 "Mark all visible items in this category with `todo-item-mark'."
@@ -1751,7 +1760,12 @@ marking of the next N items."
1751 (if marks 1760 (if marks
1752 (setcdr marks (1+ (cdr marks))) 1761 (setcdr marks (1+ (cdr marks)))
1753 (push (cons cat 1) todo-categories-with-marks)))) 1762 (push (cons cat 1) todo-categories-with-marks))))
1754 (todo-forward-item))))) 1763 (todo-forward-item)
1764 ;; Don't try to mark the empty line between the todo and done
1765 ;; items sections.
1766 (when (looking-at "^$")
1767 (unless (eobp)
1768 (todo-forward-item)))))))
1755 1769
1756(defun todo-unmark-category () 1770(defun todo-unmark-category ()
1757 "Remove `todo-item-mark' from all visible items in this category." 1771 "Remove `todo-item-mark' from all visible items in this category."