Add experimental mark support
This commit is contained in:
parent
82f4561a05
commit
195a9a5ded
1 changed files with 40 additions and 16 deletions
|
@ -130,20 +130,30 @@
|
|||
(interactive)
|
||||
(let ((id (taskwarrior-id-at-point)))
|
||||
(if (local-variable-p 'taskwarrior-marks)
|
||||
(setq-local taskwarrior-marks (remove id taskwarrior-marks)))))
|
||||
(setq-local taskwarrior-marks (remove id taskwarrior-marks))))
|
||||
(progn
|
||||
(save-excursion
|
||||
(read-only-mode -1)
|
||||
(beginning-of-line)
|
||||
(delete-forward-char 1)
|
||||
(insert " ")
|
||||
(read-only-mode 1))
|
||||
(next-line)))
|
||||
|
||||
(defun taskwarrior-mark-task ()
|
||||
(interactive)
|
||||
(let ((id (taskwarrior-id-at-point)))
|
||||
(progn
|
||||
(if (local-variable-p 'taskwarrior-marks)
|
||||
(setq-local taskwarrior-marks (delete-dups (cons id taskwarrior-marks)))
|
||||
(setq-local taskwarrior-marks (list id))))
|
||||
(setq-local taskwarrior-marks (list id)))
|
||||
(progn
|
||||
(save-excursion
|
||||
(read-only-mode -1)
|
||||
(beginning-of-line)
|
||||
(delete-forward-char 1)
|
||||
(insert "*")
|
||||
(read-only-mode 1))))
|
||||
(read-only-mode 1))
|
||||
(next-line))))
|
||||
|
||||
(defun taskwarrior-open-annotation ()
|
||||
(interactive)
|
||||
|
@ -286,13 +296,27 @@
|
|||
(interactive "sDescription: ")
|
||||
(taskwarrior--mutable-shell-command "add" "" description))
|
||||
|
||||
(defun taskwarrior-mark-p ()
|
||||
"Whether there are any marked tasks"
|
||||
(and
|
||||
(boundp 'taskwarrior-marks)
|
||||
(> (length taskwarrior-marks) 0)))
|
||||
|
||||
(defun taskwarrior-done ()
|
||||
"Mark current task as done."
|
||||
(interactive)
|
||||
(let ((id (taskwarrior-id-at-point))
|
||||
(confirmation (yes-or-no-p "Done?")))
|
||||
(when confirmation
|
||||
(taskwarrior--mutable-shell-command "done" id))))
|
||||
(taskwarrior-multi-action 'taskwarrior--done "Done?"))
|
||||
|
||||
(defun taskwarrior-multi-action (action confirmation-text)
|
||||
(when (yes-or-no-p confirmation-text)
|
||||
(if (taskwarrior-mark-p)
|
||||
(dolist (id taskwarrior-marks)
|
||||
(funcall action id))
|
||||
(let ((id (taskwarrior-id-at-point)))
|
||||
(funcall action id)))))
|
||||
|
||||
(defun taskwarrior--done (id)
|
||||
"Mark task as done."
|
||||
(taskwarrior--mutable-shell-command "done" id))
|
||||
|
||||
(defun taskwarrior-delete ()
|
||||
"Delete current task."
|
||||
|
|
Loading…
Reference in a new issue