From fd6c6328aefd206a2d81fd5a98fb6a8b90a4eeec Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Sat, 14 Jul 2012 22:18:42 +0100 Subject: [PATCH] * calendar/todos.el (todos-copy-item): New command. (todos-insertion-map): Add key binding for it. --- lisp/ChangeLog | 5 +++++ lisp/calendar/todos.el | 12 ++++++++++++ 2 files changed, 17 insertions(+) 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.") -- 2.39.5