Rename taskwarrior buffer

This commit is contained in:
Patrick Winter 2018-12-20 21:04:56 +01:00
parent f1fad58220
commit 4e13f8a7f1

View file

@ -5,11 +5,14 @@
;; 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 ;; TODO: Figure out the difference between assoc and assoc-string
;; (and why alist-get does not work with strings) ;; (and why alist-get does not work with strings)
;; TODO: Restore position after taskwarrior-update-buffer is called
(require 'json) (require 'json)
(defgroup taskwarrior nil "An emacs frontend to taskwarrior.") (defgroup taskwarrior nil "An emacs frontend to taskwarrior.")
(defvar taskwarrior-buffer-name "*taskwarrior*")
(defconst taskwarrior-mutating-commands '("add" "modify")) (defconst taskwarrior-mutating-commands '("add" "modify"))
(defvar taskwarrior-description 'taskwarrior-description (defvar taskwarrior-description 'taskwarrior-description
@ -78,6 +81,7 @@
(taskwarrior-update-buffer new-filter)))) (taskwarrior-update-buffer new-filter))))
(defun taskwarrior--shell-command (command &optional filter modifications miscellaneous) (defun taskwarrior--shell-command (command &optional filter modifications miscellaneous)
;; Taskwarrior
(shell-command-to-string (shell-command-to-string
(format "task %s %s %s %s" (format "task %s %s %s %s"
(or filter "") (or filter "")
@ -126,7 +130,8 @@
(defun taskwarrior-add (description) (defun taskwarrior-add (description)
(interactive "sDescription: ") (interactive "sDescription: ")
(message (taskwarrior--shell-command "add" "" description)) (message (taskwarrior--shell-command "add" "" description))
(taskwarrior-update-buffer)) (when (eq (buffer-name) taskwarrior-buffer-name)
(taskwarrior-update-buffer)))
(defun taskwarrior-done () (defun taskwarrior-done ()
"Mark current task as done." "Mark current task as done."