emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-24 r117358: * calendar/todo-mode.el: Fix wrong-type-


From: Stephen Berman
Subject: [Emacs-diffs] emacs-24 r117358: * calendar/todo-mode.el: Fix wrong-type-argument error when
Date: Sun, 06 Jul 2014 20:28:46 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117358
revision-id: address@hidden
parent: address@hidden
committer: Stephen Berman <address@hidden>
branch nick: emacs-24
timestamp: Sun 2014-07-06 22:28:38 +0200
message:
  * 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.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/calendar/todo-mode.el     todos.el-20120911155047-0ytqo2nidwqquefa-1
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-07-05 19:11:59 +0000
+++ b/lisp/ChangeLog    2014-07-06 20:28:38 +0000
@@ -1,3 +1,14 @@
+2014-07-06  Stephen Berman  <address@hidden>
+
+       * 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.
+
 2014-07-05  Stefan Monnier  <address@hidden>
 
        * emacs-lisp/edebug.el (edebug-eval-defun): Print result using

=== modified file 'lisp/calendar/todo-mode.el'
--- a/lisp/calendar/todo-mode.el        2014-07-04 15:53:25 +0000
+++ b/lisp/calendar/todo-mode.el        2014-07-06 20:28:38 +0000
@@ -1710,31 +1710,40 @@
 
 (defun todo-toggle-mark-item (&optional n)
   "Mark item with `todo-item-mark' if unmarked, otherwise unmark it.
-With a positive numerical prefix argument N, change the
-marking of the next N items."
+With positive numerical prefix argument N, change the marking of
+the next N items in the current category.  If both the todo and
+done items sections are visible, the sequence of N items can
+consist of the the last todo items and the first done items."
   (interactive "p")
   (when (todo-item-string)
     (unless (> n 1) (setq n 1))
-    (dotimes (i n)
-      (let* ((cat (todo-current-category))
-            (marks (assoc cat todo-categories-with-marks))
-            (ov (progn
-                  (unless (looking-at todo-item-start)
-                    (todo-item-start))
-                  (todo-get-overlay 'prefix)))
-            (pref (overlay-get ov 'before-string)))
-       (if (todo-marked-item-p)
-           (progn
-             (overlay-put ov 'before-string (substring pref 1))
-             (if (= (cdr marks) 1)     ; Deleted last mark in this category.
-                 (setq todo-categories-with-marks
-                       (assq-delete-all cat todo-categories-with-marks))
-               (setcdr marks (1- (cdr marks)))))
-         (overlay-put ov 'before-string (concat todo-item-mark pref))
-         (if marks
-             (setcdr marks (1+ (cdr marks)))
-           (push (cons cat 1) todo-categories-with-marks))))
-      (todo-forward-item))))
+    (catch 'end
+      (dotimes (i n)
+       (let* ((cat (todo-current-category))
+              (marks (assoc cat todo-categories-with-marks))
+              (ov (progn
+                    (unless (looking-at todo-item-start)
+                      (todo-item-start))
+                    (todo-get-overlay 'prefix)))
+              (pref (overlay-get ov 'before-string)))
+         (if (todo-marked-item-p)
+             (progn
+               (overlay-put ov 'before-string (substring pref 1))
+               (if (= (cdr marks) 1)   ; Deleted last mark in this category.
+                   (setq todo-categories-with-marks
+                         (assq-delete-all cat todo-categories-with-marks))
+                 (setcdr marks (1- (cdr marks)))))
+           (overlay-put ov 'before-string (concat todo-item-mark pref))
+           (if marks
+               (setcdr marks (1+ (cdr marks)))
+             (push (cons cat 1) todo-categories-with-marks))))
+       (todo-forward-item)
+       ;; Don't try to mark the empty lines at the end of the todo
+       ;; and done items sections.
+       (when (looking-at "^$")
+         (if (eobp)
+             (throw 'end nil)
+           (todo-forward-item)))))))
 
 (defun todo-mark-category ()
   "Mark all visible items in this category with `todo-item-mark'."
@@ -1751,7 +1760,12 @@
            (if marks
                (setcdr marks (1+ (cdr marks)))
              (push (cons cat 1) todo-categories-with-marks))))
-       (todo-forward-item)))))
+       (todo-forward-item)
+       ;; Don't try to mark the empty line between the todo and done
+       ;; items sections.
+       (when (looking-at "^$")
+         (unless (eobp)
+           (todo-forward-item)))))))
 
 (defun todo-unmark-category ()
   "Remove `todo-item-mark' from all visible items in this category."


reply via email to

[Prev in Thread] Current Thread [Next in Thread]