From 687dd4a6efbd51e1185e13a391966dd0e0038f39 Mon Sep 17 00:00:00 2001 From: Patrick Winter Date: Sun, 14 Apr 2019 20:51:27 +0200 Subject: [PATCH 1/4] Refactor taskwarrior--change-attribute --- taskwarrior.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/taskwarrior.el b/taskwarrior.el index 3a0618a..274270e 100644 --- a/taskwarrior.el +++ b/taskwarrior.el @@ -142,8 +142,7 @@ (task (taskwarrior-export-task id)) (old-value (cdr (assoc-string attribute task))) (new-value (read-from-minibuffer (concat prefix " ") old-value))) - (taskwarrior--shell-command "modify" id (concat prefix new-value)) - (taskwarrior-update-buffer))) + (taskwarrior--mutable-shell-command "modify" id (concat prefix new-value)))) (defun taskwarrior-change-description () "Change the description of a task" From 11c8e91432c820a056b05207f134099e20b08255 Mon Sep 17 00:00:00 2001 From: Patrick Winter Date: Sun, 14 Apr 2019 20:53:05 +0200 Subject: [PATCH 2/4] Cleanup code --- taskwarrior.el | 6 ------ 1 file changed, 6 deletions(-) diff --git a/taskwarrior.el b/taskwarrior.el index 274270e..caa735e 100644 --- a/taskwarrior.el +++ b/taskwarrior.el @@ -101,10 +101,6 @@ (taskwarrior--set-filter new-filter) (taskwarrior-update-buffer new-filter)))) - - -(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" @@ -268,5 +264,3 @@ the front and focus it. Otherwise, create one and load the data." (global-set-key (kbd "C-x t") 'taskwarrior) -(taskwarrior--set-filter "project:pro5") -(message (car taskwarrior-active-filters)) From 9be80da2cd57e56a5b9c6f5780979cf4741d0ef7 Mon Sep 17 00:00:00 2001 From: Patrick Winter Date: Sun, 14 Apr 2019 21:33:57 +0200 Subject: [PATCH 3/4] Quote value when changing an attribute --- taskwarrior.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/taskwarrior.el b/taskwarrior.el index caa735e..f58d554 100644 --- a/taskwarrior.el +++ b/taskwarrior.el @@ -137,8 +137,9 @@ (id (taskwarrior-id-at-point)) (task (taskwarrior-export-task id)) (old-value (cdr (assoc-string attribute task))) - (new-value (read-from-minibuffer (concat prefix " ") old-value))) - (taskwarrior--mutable-shell-command "modify" id (concat prefix new-value)))) + (new-value (read-from-minibuffer (concat prefix " ") old-value)) + (quoted-value (concat "\"" new-value "\""))) + (taskwarrior--mutable-shell-command "modify" id (concat prefix quoted-value)))) (defun taskwarrior-change-description () "Change the description of a task" From 8b133b3bc3053f3ccf59f6090bbceaa307ae7c7e Mon Sep 17 00:00:00 2001 From: Patrick Winter Date: Sun, 14 Apr 2019 21:38:40 +0200 Subject: [PATCH 4/4] Add function and binding to change priority of task --- taskwarrior.el | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/taskwarrior.el b/taskwarrior.el index f58d554..a05922c 100644 --- a/taskwarrior.el +++ b/taskwarrior.el @@ -33,6 +33,7 @@ (define-key taskwarrior-mode-map (kbd "j") 'taskwarrior-next-task) (define-key taskwarrior-mode-map (kbd "q") 'quit-window) (define-key taskwarrior-mode-map (kbd "e") 'taskwarrior-change-description) + (define-key taskwarrior-mode-map (kbd "U") 'taskwarrior-change-priority) (define-key taskwarrior-mode-map (kbd "g") 'taskwarrior-update-buffer) (define-key taskwarrior-mode-map (kbd "a") 'taskwarrior-add) (define-key taskwarrior-mode-map (kbd "d") 'taskwarrior-done) @@ -146,6 +147,11 @@ (interactive) (taskwarrior--change-attribute "description")) +(defun taskwarrior-change-priority () + "Change the priority of a task" + (interactive) + (taskwarrior--change-attribute "priority")) + (defun taskwarrior-change-project () "Change the project of a task" (interactive)