From 888dd38a4090e07794c2892194111f42e7c8babc Mon Sep 17 00:00:00 2001 From: Patrick Winter Date: Wed, 16 Jan 2019 19:46:37 +0100 Subject: [PATCH] Fix deletion of tasks --- taskwarrior.el | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/taskwarrior.el b/taskwarrior.el index 562a916..d13c8e6 100644 --- a/taskwarrior.el +++ b/taskwarrior.el @@ -86,12 +86,18 @@ (taskwarrior--set-filter 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 "") - command - (or modifications "") - (or miscellaneous "")))) + + +(shell-command-to-string "echo yes | task 34 delete") + +(defun taskwarrior--shell-command (command &optional filter modifications miscellaneous confirm) + (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 (message cmd) (shell-command-to-string cmd)))) @@ -155,9 +161,7 @@ (let ((id (taskwarrior-id-at-point)) (confirmation (read-from-minibuffer "Delete [y/n]?: "))) (when (string= confirmation "y") - (taskwarrior--shell-command "config" "" "confirmation off") - (message (taskwarrior--shell-command "delete" id)) - (taskwarrior--shell-command "config" "" "confirmation on") + (message (taskwarrior--shell-command "delete" id "" "" "yes")) (taskwarrior-update-buffer)))) ;; Setup a major mode for taskwarrior