Open pyluyten opened 5 years ago
This does the first version, but automatically "e"dits the task. I have a few things like this in my .emacs / init.el :)
(defun todotxt-duplicate-item ()
(interactive)
(todotxt-add-item (todotxt-get-current-line-as-string))
(todotxt-edit-item))
This one does your 2nd suggestion :)
The one bug/gotcha is that it duplicates the item first, so if you C-g cancel the edit, you'll still find your cursor on an empty task with the tags/priority.
(defun todotxt-duplicate-item ()
(interactive)
(let* ((line (todotxt-get-current-line-as-string))
(prio (todotxt-get-priority line)))
(todotxt-add-item
(mapconcat 'identity
(cons (if prio (concat "(" prio ")") "")
(nreverse (todotxt-get-tag-completion-list-from-string line)))
" ")))
(todotxt-edit-item))
Copy task could be done in two ways I guess the second one is the right thing