From 7e1a1d1bc3e2622e39ec4ce359374f545985ebb1 Mon Sep 17 00:00:00 2001 From: Patrick Winter Date: Tue, 25 Jun 2019 13:02:06 +0200 Subject: [PATCH] Add ability to specify filter profiles This name for this might change in the future. --- taskwarrior.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/taskwarrior.el b/taskwarrior.el index 3d2bd23..c8a049f 100644 --- a/taskwarrior.el +++ b/taskwarrior.el @@ -16,6 +16,9 @@ (defvar taskwarrior-description 'taskwarrior-description "Taskwarrior mode face used for tasks with a priority of C.") +(defvar taskwarrior-profile-alist 'taskwarrior-profile-alist + "A list of named filters in the form an associative list.") + (defface taskwarrior-priority-high-face '((((min-colors 88) (class color)) (:foreground "red1")) @@ -76,6 +79,7 @@ (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) + (define-key taskwarrior-mode-map (kbd "l") 'taskwarrior-load-profile) (define-key taskwarrior-mode-map (kbd "o") 'taskwarrior-open-annotation) (define-key taskwarrior-mode-map (kbd "D") 'taskwarrior-delete) (define-key taskwarrior-mode-map (kbd "m") 'taskwarrior-mark-task) @@ -101,6 +105,16 @@ (when due (message "Due: %s | %i Annotations" due annotation-count)))) +(defun taskwarrior-load-profile () + (interactive) + (let* ((profiles (-map 'car taskwarrior-profile-alist)) + (profile (completing-read "Profile: " profiles)) + (filter (cdr (assoc-string profile taskwarrior-profile-alist)))) + (progn + (taskwarrior--set-filter filter) + (taskwarrior-update-buffer filter)))) + + (defun taskwarrior-previous-task () (interactive) (previous-line)