Turn taskwarrior-active-filters into buffer local variable
This commit is contained in:
parent
ad3cfba6e2
commit
032f4036ad
1 changed files with 15 additions and 7 deletions
|
@ -12,8 +12,6 @@
|
||||||
|
|
||||||
(defconst taskwarrior-mutating-commands '("add" "modify"))
|
(defconst taskwarrior-mutating-commands '("add" "modify"))
|
||||||
|
|
||||||
(defvar taskwarrior-active-filters '() 'taskwarrior-active-filters)
|
|
||||||
|
|
||||||
(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.")
|
||||||
|
|
||||||
|
@ -60,13 +58,23 @@
|
||||||
(string-match "^[0-9]*" line)
|
(string-match "^[0-9]*" line)
|
||||||
(match-string 0 line)))
|
(match-string 0 line)))
|
||||||
|
|
||||||
|
(defun taskwarrior--get-filter-as-string ()
|
||||||
|
(if (local-variable-p 'taskwarrior-active-filters)
|
||||||
|
(mapconcat 'identity taskwarrior-active-filters " ")
|
||||||
|
"")
|
||||||
|
)
|
||||||
|
|
||||||
|
(defun taskwarrior--set-filter (filter)
|
||||||
|
(cond ((stringp filter) (setq-local taskwarrior-active-filters (split-string filter " ")))
|
||||||
|
((listp filter) (setq-local taskwarrior-active-filters filter))
|
||||||
|
(t (error "Filter did not match any supported type."))))
|
||||||
|
|
||||||
(defun taskwarrior-filter ()
|
(defun taskwarrior-filter ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(let* ((current-filter-string (mapconcat 'identity taskwarrior-active-filters " "))
|
(let ((new-filter (read-from-minibuffer "Filter: " (taskwarrior--get-filter-as-string))))
|
||||||
(new-filter (read-from-minibuffer "Filter: " current-filter-string)))
|
(progn
|
||||||
(taskwarrior-update-buffer new-filter)))
|
(taskwarrior--set-filter 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)
|
||||||
(shell-command-to-string
|
(shell-command-to-string
|
||||||
|
|
Loading…
Reference in a new issue