]> git.eshelyaron.com Git - emacs.git/commitdiff
* calendar/todos.el (todos-copy-item): New command.
authorStephen Berman <stephen.berman@gmx.net>
Sat, 14 Jul 2012 21:18:42 +0000 (22:18 +0100)
committerStephen Berman <stephen.berman@gmx.net>
Sat, 14 Jul 2012 21:18:42 +0000 (22:18 +0100)
(todos-insertion-map): Add key binding for it.

lisp/ChangeLog
lisp/calendar/todos.el

index 05c3436b3b8bd9314d8ff6d1e1051e4122d6f1bb..0c58a997c819e0b65c8ac2344ea347baaeb273ab 100644 (file)
@@ -1,3 +1,8 @@
+2012-09-24  Stephen Berman  <stephen.berman@gmx.net>
+
+       * calendar/todos.el (todos-copy-item): New command.
+       (todos-insertion-map): Add key binding for it.
+
 2012-09-24  Stephen Berman  <stephen.berman@gmx.net>
 
        * calendar/todos.el (todos-undo-item-omit-comment): New defcustom.
index b3ff3191b96a8771c673d28cac3b843731997c1d..5c07f620770f950e9cb93a451597c42eda21a172 100644 (file)
@@ -2382,6 +2382,7 @@ which is the value of the user option
 (defvar todos-insertion-map
   (let ((map (make-keymap)))
     (todos-insertion-key-bindings map)
+    (define-key map "p" 'todos-copy-item)
     map)
   "Keymap for Todos mode insertion commands.")
 
@@ -4241,6 +4242,17 @@ the priority is not given by HERE but by prompting."
        (if (or diary todos-include-in-diary) (todos-update-count 'diary 1))
        (todos-update-categories-sexp)))))
 
+(defun todos-copy-item ()
+  "Copy item at point and insert the copy as a new item."
+  (interactive)
+  (unless (or (todos-done-item-p) (looking-at "^$"))
+    (let ((copy (todos-item-string))
+         (diary-item (todos-diary-item-p)))
+      (todos-set-item-priority copy (todos-current-category) t)
+      (todos-update-count 'todo 1)
+      (when diary-item (todos-update-count 'diary 1))
+      (todos-update-categories-sexp))))
+
 (defvar todos-date-from-calendar nil
   "Helper variable for setting item date from the Emacs Calendar.")