Fix deletion of tasks

This commit is contained in:
Patrick Winter 2019-01-16 19:46:37 +01:00
parent ce8bae17cd
commit 888dd38a40

View file

@ -86,12 +86,18 @@
(taskwarrior--set-filter new-filter) (taskwarrior--set-filter new-filter)
(taskwarrior-update-buffer new-filter)))) (taskwarrior-update-buffer new-filter))))
(defun taskwarrior--shell-command (command &optional filter modifications miscellaneous)
(let ((cmd (format "task %s %s %s %s"
(or filter "") (shell-command-to-string "echo yes | task 34 delete")
command
(or modifications "") (defun taskwarrior--shell-command (command &optional filter modifications miscellaneous confirm)
(or miscellaneous "")))) (let* ((confirmation (if confirm (concat "echo " confirm " |") ""))
(cmd (format "%s task %s %s %s %s"
(or confirmation "")
(or filter "")
(or command "")
(or modifications "")
(or miscellaneous ""))))
(progn (progn
(message cmd) (message cmd)
(shell-command-to-string cmd)))) (shell-command-to-string cmd))))
@ -155,9 +161,7 @@
(let ((id (taskwarrior-id-at-point)) (let ((id (taskwarrior-id-at-point))
(confirmation (read-from-minibuffer "Delete [y/n]?: "))) (confirmation (read-from-minibuffer "Delete [y/n]?: ")))
(when (string= confirmation "y") (when (string= confirmation "y")
(taskwarrior--shell-command "config" "" "confirmation off") (message (taskwarrior--shell-command "delete" id "" "" "yes"))
(message (taskwarrior--shell-command "delete" id))
(taskwarrior--shell-command "config" "" "confirmation on")
(taskwarrior-update-buffer)))) (taskwarrior-update-buffer))))
;; Setup a major mode for taskwarrior ;; Setup a major mode for taskwarrior