From 1d2d76d972706e4551e355dfd20b0a0c538343e2 Mon Sep 17 00:00:00 2001 From: Patrick Winter Date: Wed, 31 Oct 2018 20:38:57 +0100 Subject: [PATCH] Display due date in echo area --- taskwarrior.el | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/taskwarrior.el b/taskwarrior.el index e3b761a..defb7ce 100644 --- a/taskwarrior.el +++ b/taskwarrior.el @@ -22,15 +22,31 @@ (defvar taskwarrior-mode-map nil "Keymap for `taskwarrior-mode'") (progn (setq taskwarrior-mode-map (make-sparse-keymap)) - (define-key taskwarrior-mode-map (kbd "p") 'previous-line) - (define-key taskwarrior-mode-map (kbd "k") 'previous-line) - (define-key taskwarrior-mode-map (kbd "n") 'next-line) - (define-key taskwarrior-mode-map (kbd "j") 'next-line) + (define-key taskwarrior-mode-map (kbd "p") 'taskwarrior-previous-task) + (define-key taskwarrior-mode-map (kbd "k") 'taskwarrior-previous-task) + (define-key taskwarrior-mode-map (kbd "n") 'taskwarrior-next-task) + (define-key taskwarrior-mode-map (kbd "j") 'taskwarrior-next-task) (define-key taskwarrior-mode-map (kbd "q") 'quit-window) (define-key taskwarrior-mode-map (kbd "e") 'taskwarrior-change-description) (define-key taskwarrior-mode-map (kbd "u") 'taskwarrior-update-buffer) (define-key taskwarrior-mode-map (kbd "a") 'taskwarrior-add) - (define-key taskwarrior-mode-map (kbd "p") 'taskwarrior-change-project)) + (define-key taskwarrior-mode-map (kbd "P") 'taskwarrior-change-project)) + +(defun taskwarrior--display-task-details-in-echo-area () + (let* ((id (taskwarrior-id-at-point)) + (task (taskwarrior-export-task id)) + (due (alist-get 'due task))) + (message "Due: %s" due))) + +(defun taskwarrior-previous-task () + (interactive) + (previous-line) + (taskwarrior--display-task-details-in-echo-area)) + +(defun taskwarrior-next-task () + (interactive) + (next-line) + (taskwarrior--display-task-details-in-echo-area)) (defun taskwarrior-id-at-point () (let ((line (thing-at-point 'line t)))