Allow load pre configured profiles
This commit is contained in:
parent
5ad8fee1a9
commit
9e8747037b
1 changed files with 17 additions and 14 deletions
|
@ -13,11 +13,14 @@
|
||||||
|
|
||||||
(defvar taskwarrior-buffer-name "*taskwarrior*")
|
(defvar taskwarrior-buffer-name "*taskwarrior*")
|
||||||
|
|
||||||
(defvar taskwarrior-filter nil)
|
(defvar taskwarrior-active-filter nil "Currently active filter.")
|
||||||
|
|
||||||
|
(defvar taskwarrior-active-profile nil "Name of the currently active profile.")
|
||||||
|
|
||||||
(defvar taskwarrior-description 'taskwarrior-description
|
(defvar taskwarrior-description 'taskwarrior-description
|
||||||
"Taskwarrior mode face used for tasks with a priority of C.")
|
"Taskwarrior mode face used for tasks with a priority of C.")
|
||||||
|
|
||||||
(defvar taskwarrior-profile-alist 'taskwarrior-profile-alist
|
(defvar taskwarrior-profile-alist nil
|
||||||
"A list of named filters in the form an associative list.")
|
"A list of named filters in the form an associative list.")
|
||||||
|
|
||||||
(defface taskwarrior-priority-high-face
|
(defface taskwarrior-priority-high-face
|
||||||
|
@ -88,14 +91,14 @@
|
||||||
(define-key taskwarrior-mode-map (kbd "RET") 'taskwarrior-info)
|
(define-key taskwarrior-mode-map (kbd "RET") 'taskwarrior-info)
|
||||||
(define-key taskwarrior-mode-map (kbd "P") 'taskwarrior-edit-project))
|
(define-key taskwarrior-mode-map (kbd "P") 'taskwarrior-edit-project))
|
||||||
|
|
||||||
(defun taskwarrior-load-profile ()
|
(defun taskwarrior-load-profile (profile)
|
||||||
(interactive)
|
(interactive
|
||||||
(let* ((profiles (-map 'car taskwarrior-profile-alist))
|
(list (completing-read "Profile: " (-map 'car taskwarrior-profile-alist))))
|
||||||
(profile (completing-read "Profile: " profiles))
|
(let ((filter (cdr (assoc-string profile taskwarrior-profile-alist))))
|
||||||
(filter (cdr (assoc-string profile taskwarrior-profile-alist))))
|
|
||||||
(progn
|
(progn
|
||||||
(taskwarrior--set-filter filter)
|
(setq taskwarrior-active-profile profile)
|
||||||
(taskwarrior-update-buffer filter))))
|
(setq taskwarrior-active-filter filter)
|
||||||
|
(taskwarrior-update-buffer))))
|
||||||
|
|
||||||
(defun taskwarrior-unmark-task ()
|
(defun taskwarrior-unmark-task ()
|
||||||
(interactive)
|
(interactive)
|
||||||
|
@ -168,14 +171,14 @@
|
||||||
(defun taskwarrior-reset-filter ()
|
(defun taskwarrior-reset-filter ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(progn
|
(progn
|
||||||
(setq-local taskwarrior-filter nil)
|
(setq-local taskwarrior-active-filter nil)
|
||||||
(taskwarrior-update-buffer)))
|
(taskwarrior-update-buffer)))
|
||||||
|
|
||||||
(defun taskwarrior-set-filter ()
|
(defun taskwarrior-set-filter ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((new-filter (read-from-minibuffer "Filter: " taskwarrior-filter)))
|
(let ((new-filter (read-from-minibuffer "Filter: " taskwarrior-active-filter)))
|
||||||
(progn
|
(progn
|
||||||
(setq-local taskwarrior-filter new-filter)
|
(setq-local taskwarrior-active-filter new-filter)
|
||||||
(taskwarrior-update-buffer))))
|
(taskwarrior-update-buffer))))
|
||||||
|
|
||||||
(defun taskwarrior--shell-command (command &optional filter modifications miscellaneous confirm)
|
(defun taskwarrior--shell-command (command &optional filter modifications miscellaneous confirm)
|
||||||
|
@ -221,8 +224,8 @@
|
||||||
(interactive)
|
(interactive)
|
||||||
(progn
|
(progn
|
||||||
(setq tabulated-list-entries
|
(setq tabulated-list-entries
|
||||||
(if taskwarrior-filter
|
(if taskwarrior-active-filter
|
||||||
(taskwarrior-export taskwarrior-filter)
|
(taskwarrior-export taskwarrior-active-filter)
|
||||||
(taskwarrior-export)))
|
(taskwarrior-export)))
|
||||||
(tabulated-list-print t)))
|
(tabulated-list-print t)))
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue