From: Stephen Berman Date: Sat, 14 Jul 2012 21:18:42 +0000 (+0100) Subject: * calendar/todos.el (todos-copy-item): New command. X-Git-Tag: emacs-24.3.90~173^2^2~42^2~45^2~387^2~2102 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=fd6c6328aefd206a2d81fd5a98fb6a8b90a4eeec;p=emacs.git * calendar/todos.el (todos-copy-item): New command. (todos-insertion-map): Add key binding for it. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 05c3436b3b8..0c58a997c81 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2012-09-24 Stephen Berman + + * calendar/todos.el (todos-copy-item): New command. + (todos-insertion-map): Add key binding for it. + 2012-09-24 Stephen Berman * calendar/todos.el (todos-undo-item-omit-comment): New defcustom. diff --git a/lisp/calendar/todos.el b/lisp/calendar/todos.el index b3ff3191b96..5c07f620770 100644 --- a/lisp/calendar/todos.el +++ b/lisp/calendar/todos.el @@ -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.")