]> git.eshelyaron.com Git - emacs.git/commitdiff
* todos.el (todos-edit-quit): Don't allow dateless item.
authorStephen Berman <stephen.berman@gmx.net>
Wed, 22 May 2013 11:23:36 +0000 (13:23 +0200)
committerStephen Berman <stephen.berman@gmx.net>
Wed, 22 May 2013 11:23:36 +0000 (13:23 +0200)
lisp/calendar/ChangeLog
lisp/calendar/todos.el

index 029066176af113f3d1d264aaa4a1ada976b3a1cb..54e6e633345eec336deb1e81c3635c9ffb159595 100644 (file)
@@ -1,3 +1,7 @@
+2013-05-22  Stephen Berman  <stephen.berman@gmx.net>
+
+       * todos.el (todos-edit-quit): Don't allow dateless item.
+
 2013-05-21  Stephen Berman  <stephen.berman@gmx.net>
 
        * todos.el (todos-key-bindings, todos-archive-mode-map)
index 3f34aee94304518b64e2af65e47a714e9126cda1..54847c92a2fea4514212b0c3b890518d4b314b1a 100644 (file)
@@ -5031,35 +5031,41 @@ recalculate the Todos categories sexp, in case changes were made
 in the number or names of categories."
   (interactive)
   (if (> (buffer-size) (- (point-max) (point-min)))
+      ;; We got here via `e m'.
       (let ((item (buffer-string))
            (regex "\\(\n\\)[^[:blank:]]"))
+       (while (not (string-match (concat todos-date-string-start
+                                         todos-date-pattern) item))
+         (setq item (read-from-minibuffer
+                    "Item must start with a date: " item)))
        ;; Ensure lines following hard newlines are indented.
        (when (string-match regex (buffer-string))
          (setq item (replace-regexp-in-string regex "\n\t" item nil nil 1))
          (delete-region (point-min) (point-max))
          (insert item))
        (kill-buffer))
-      (when (todos-check-format)
-       ;; FIXME: separate out sexp check?
-       ;; If manual editing makes e.g. item counts change, have to
-       ;; call this to update todos-categories, but it restores
-       ;; category order to list order.
-       ;; (todos-repair-categories-sexp)
-       ;; Compare (todos-make-categories-list t) with sexp and if
-       ;; different ask (todos-update-categories-sexp) ?
-       (todos-mode)
-       (let* ((cat-beg (concat "^" (regexp-quote todos-category-beg)
-                               "\\(.*\\)$"))
-              (curline (buffer-substring-no-properties
-                        (line-beginning-position) (line-end-position)))
-              (cat (cond ((string-match cat-beg curline)
-                          (match-string-no-properties 1 curline))
-                         ((or (re-search-backward cat-beg nil t)
-                              (re-search-forward cat-beg nil t))
-                          (match-string-no-properties 1)))))
-         (todos-category-number cat)
-         (todos-category-select)
-         (goto-char (point-min))))))
+    ;; We got here via `F e'.
+    (when (todos-check-format)
+      ;; FIXME: separate out sexp check?
+      ;; If manual editing makes e.g. item counts change, have to
+      ;; call this to update todos-categories, but it restores
+      ;; category order to list order.
+      ;; (todos-repair-categories-sexp)
+      ;; Compare (todos-make-categories-list t) with sexp and if
+      ;; different ask (todos-update-categories-sexp) ?
+      (todos-mode)
+      (let* ((cat-beg (concat "^" (regexp-quote todos-category-beg)
+                             "\\(.*\\)$"))
+            (curline (buffer-substring-no-properties
+                      (line-beginning-position) (line-end-position)))
+            (cat (cond ((string-match cat-beg curline)
+                        (match-string-no-properties 1 curline))
+                       ((or (re-search-backward cat-beg nil t)
+                            (re-search-forward cat-beg nil t))
+                        (match-string-no-properties 1)))))
+       (todos-category-number cat)
+       (todos-category-select)
+       (goto-char (point-min))))))
 
 (defun todos-edit-item-header-1 (what &optional inc)
   "Function underlying commands to edit item date/time header.