From 8378018c8ee2626ffcfacb4d4586fe91a07b461a Mon Sep 17 00:00:00 2001 From: Patrick Winter Date: Tue, 22 Jan 2019 21:07:46 +0100 Subject: [PATCH] Implement mark and unmark --- taskwarrior.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/taskwarrior.el b/taskwarrior.el index d13c8e6..ca99720 100644 --- a/taskwarrior.el +++ b/taskwarrior.el @@ -37,6 +37,8 @@ (define-key taskwarrior-mode-map (kbd "a") 'taskwarrior-add) (define-key taskwarrior-mode-map (kbd "d") 'taskwarrior-done) (define-key taskwarrior-mode-map (kbd "D") 'taskwarrior-delete) + (define-key taskwarrior-mode-map (kbd "m") 'taskwarrior-mark-task) + (define-key taskwarrior-mode-map (kbd "u") 'taskwarrior-unmark-task) (define-key taskwarrior-mode-map (kbd "f") 'taskwarrior-filter) (define-key taskwarrior-mode-map (kbd "r") 'taskwarrior-reset-filter) (define-key taskwarrior-mode-map (kbd "P") 'taskwarrior-change-project)) @@ -58,6 +60,19 @@ (next-line) (taskwarrior--display-task-details-in-echo-area)) +(defun taskwarrior-unmark-task () + (interactive) + (let ((id (taskwarrior-id-at-point))) + (if (local-variable-p 'taskwarrior-marks) + (setq-local taskwarrior-marks (remove id taskwarrior-marks))))) + +(defun taskwarrior-mark-task () + (interactive) + (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))))) + (defun taskwarrior-id-at-point () (let ((line (thing-at-point 'line t))) (string-match "^[0-9]*" line)