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)
|
(interactive)
|
||||||
(let ((id (taskwarrior-id-at-point)))
|
(let ((id (taskwarrior-id-at-point)))
|
||||||
(if (local-variable-p 'taskwarrior-marks)
|
(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 ()
|
(defun taskwarrior-mark-task ()
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((id (taskwarrior-id-at-point)))
|
(let ((id (taskwarrior-id-at-point)))
|
||||||
|
(if (local-variable-p 'taskwarrior-marks)
|
||||||
|
(setq-local taskwarrior-marks (delete-dups (cons id taskwarrior-marks)))
|
||||||
|
(setq-local taskwarrior-marks (list id)))
|
||||||
(progn
|
(progn
|
||||||
(if (local-variable-p 'taskwarrior-marks)
|
(save-excursion
|
||||||
(setq-local taskwarrior-marks (delete-dups (cons id taskwarrior-marks)))
|
(read-only-mode -1)
|
||||||
(setq-local taskwarrior-marks (list id))))
|
(beginning-of-line)
|
||||||
(save-excursion
|
(delete-forward-char 1)
|
||||||
(read-only-mode -1)
|
(insert "*")
|
||||||
(beginning-of-line)
|
(read-only-mode 1))
|
||||||
(insert "*")
|
(next-line))))
|
||||||
(read-only-mode 1))))
|
|
||||||
|
|
||||||
(defun taskwarrior-open-annotation ()
|
(defun taskwarrior-open-annotation ()
|
||||||
(interactive)
|
(interactive)
|
||||||
|
@ -176,7 +186,7 @@
|
||||||
|
|
||||||
(defun taskwarrior-id-at-point ()
|
(defun taskwarrior-id-at-point ()
|
||||||
(let ((line (thing-at-point 'line t)))
|
(let ((line (thing-at-point 'line t)))
|
||||||
(string-match "^ [0-9]*" line)
|
(string-match "^ [0-9]*" line)
|
||||||
(string-trim-left (match-string 0 line))))
|
(string-trim-left (match-string 0 line))))
|
||||||
|
|
||||||
(defun taskwarrior--get-filter-as-string ()
|
(defun taskwarrior--get-filter-as-string ()
|
||||||
|
@ -286,13 +296,27 @@
|
||||||
(interactive "sDescription: ")
|
(interactive "sDescription: ")
|
||||||
(taskwarrior--mutable-shell-command "add" "" description))
|
(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 ()
|
(defun taskwarrior-done ()
|
||||||
"Mark current task as done."
|
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((id (taskwarrior-id-at-point))
|
(taskwarrior-multi-action 'taskwarrior--done "Done?"))
|
||||||
(confirmation (yes-or-no-p "Done?")))
|
|
||||||
(when confirmation
|
(defun taskwarrior-multi-action (action confirmation-text)
|
||||||
(taskwarrior--mutable-shell-command "done" id))))
|
(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 ()
|
(defun taskwarrior-delete ()
|
||||||
"Delete current task."
|
"Delete current task."
|
||||||
|
@ -382,7 +406,7 @@ the front and focus it. Otherwise, create one and load the data."
|
||||||
;; (project-max-length (taskwarrior--get-max-length 'project entries))
|
;; (project-max-length (taskwarrior--get-max-length 'project entries))
|
||||||
;; (project-spacing (- project-max-length (length project)))
|
;; (project-spacing (- project-max-length (length project)))
|
||||||
(description (alist-get 'description entry)))
|
(description (alist-get 'description entry)))
|
||||||
(insert (concat " " id " " urgency " " priority " " project " " tags " " description "\n"))))))
|
(insert (concat " " id " " urgency " " priority " " project " " tags " " description "\n"))))))
|
||||||
|
|
||||||
|
|
||||||
(defun taskwarrior--concat-tag-list (tags)
|
(defun taskwarrior--concat-tag-list (tags)
|
||||||
|
|
Loading…
Reference in a new issue