From 4e13f8a7f1e55537f9256b6911b593d8b8829f84 Mon Sep 17 00:00:00 2001 From: Patrick Winter Date: Thu, 20 Dec 2018 21:04:56 +0100 Subject: [PATCH] Rename taskwarrior buffer --- taskwarrior.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/taskwarrior.el b/taskwarrior.el index c0edcfd..947704d 100644 --- a/taskwarrior.el +++ b/taskwarrior.el @@ -5,11 +5,14 @@ ;; 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) +;; TODO: Restore position after taskwarrior-update-buffer is called (require 'json) (defgroup taskwarrior nil "An emacs frontend to taskwarrior.") +(defvar taskwarrior-buffer-name "*taskwarrior*") + (defconst taskwarrior-mutating-commands '("add" "modify")) (defvar taskwarrior-description 'taskwarrior-description @@ -78,6 +81,7 @@ (taskwarrior-update-buffer new-filter)))) (defun taskwarrior--shell-command (command &optional filter modifications miscellaneous) + ;; Taskwarrior (shell-command-to-string (format "task %s %s %s %s" (or filter "") @@ -126,7 +130,8 @@ (defun taskwarrior-add (description) (interactive "sDescription: ") (message (taskwarrior--shell-command "add" "" description)) - (taskwarrior-update-buffer)) + (when (eq (buffer-name) taskwarrior-buffer-name) + (taskwarrior-update-buffer))) (defun taskwarrior-done () "Mark current task as done."