Fix extraction of old-value

This commit is contained in:
Patrick Winter 2018-11-13 20:31:06 +01:00
parent b24d019882
commit 34a5a07d96

View file

@ -3,6 +3,8 @@
;; TODO: Implement modeline indicator for deadline and entries ;; TODO: Implement modeline indicator for deadline and entries
;; TODO: Update buffer if command modifies the state ;; TODO: Update buffer if command modifies the state
;; TODO: Extract "1-1000" id filter into variable ;; TODO: Extract "1-1000" id filter into variable
;; TODO: Figure out the difference between assoc and assoc-string
;; (and why alist-get does not work with strings)
(require 'json) (require 'json)
@ -81,11 +83,10 @@
(defun taskwarrior--change-attribute (attribute) (defun taskwarrior--change-attribute (attribute)
"Change an attribute of a task" "Change an attribute of a task"
(let* ((prefix (concat (upcase attribute) ": ")) (let* ((prefix (concat attribute ": "))
(id (taskwarrior-id-at-point)) (id (taskwarrior-id-at-point))
(task (taskwarrior-export-task id)) (task (taskwarrior-export-task id))
(key (make-symbol attribute)) (old-value (cdr (assoc-string attribute task)))
(old-value (alist-get key task))
(new-value (read-from-minibuffer prefix old-value))) (new-value (read-from-minibuffer prefix old-value)))
(taskwarrior--shell-command "modify" id new-value) (taskwarrior--shell-command "modify" id new-value)
(taskwarrior-update-buffer))) (taskwarrior-update-buffer)))