+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.
(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.")
(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.")