From d972136b3b74ccad6659909650aa2db99d3da3de Mon Sep 17 00:00:00 2001 From: Patrick Winter Date: Wed, 8 May 2019 20:06:13 +0200 Subject: [PATCH] Work on marks (WIP) --- README.md | 28 ++++++++++++++++++++++++++++ taskwarrior.el | 30 ++++++++++++++++++++++-------- 2 files changed, 50 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index e9d633e..453208d 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,31 @@ Taskwarrior.el ============== An emacs frontend for taskwarrior. + + +Annotations +----------- +Taskwarrior already has the option to add annotations to a task. + +(taskwarrior-create-task-from-dired-file) +(taskwarrior-create-task-from-mu4e-mail) + +Capture Templates +----------------- +With taskwarrior you often spending way to many keystrokes on capturing metadata around a new task +(Especially if you are a heavy user of UDA's). Capture templates to the rescue: + +``` +(taskwarrior-capture + "Work task" + "context:work customer:? project:?) +``` + +The `?` automatically present autocompletion options based on `task _unique` in case of UDA or `task _...` + + +Review +------ +Quiet often you want to review a list of different +(taskwarrior-review + '("contex:work" "context:school") diff --git a/taskwarrior.el b/taskwarrior.el index 6bcb7d1..0ab3b04 100644 --- a/taskwarrior.el +++ b/taskwarrior.el @@ -19,7 +19,8 @@ "Taskwarrior mode face used for tasks with a priority of C.") (setq taskwarrior-highlight-regexps - `(("^[0-9]*" . font-lock-variable-name-face) + `(("^\\*.*$" . font-lock-variable-name-face) + ("^ [0-9]*" . font-lock-variable-name-face) ("([0-9.]*?)" . font-lock-builtin-face) ("\\[.*\\]" . font-lock-preprocessor-face) ("[:space:].*:" . font-lock-function-name-face))) @@ -45,6 +46,13 @@ (define-key taskwarrior-mode-map (kbd "RET") 'taskwarrior-info) (define-key taskwarrior-mode-map (kbd "P") 'taskwarrior-change-project)) + +(defun test () + (interactive) + (let ((line (thing-at-point 'line t))) + (string-match (rx "* 1")) + (string-trim-left (match-string 0 line)))) + (defun taskwarrior--display-task-details-in-echo-area () (let* ((id (taskwarrior-id-at-point)) (task (taskwarrior-export-task id)) @@ -71,9 +79,16 @@ (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))))) + (progn + (if (local-variable-p 'taskwarrior-marks) + (setq-local taskwarrior-marks (delete-dups (cons id taskwarrior-marks))) + (setq-local taskwarrior-marks (list id)))) + (save-excursion + (read-only-mode -1) + (beginning-of-line) + (insert "*") + (read-only-mode 1)))) + (defun taskwarrior-info () (interactive) @@ -85,8 +100,8 @@ (defun taskwarrior-id-at-point () (let ((line (thing-at-point 'line t))) - (string-match "^[0-9]*" line) - (match-string 0 line))) + (string-match "^ [0-9]*" line) + (string-trim-left (match-string 0 line)))) (defun taskwarrior--get-filter-as-string () (if (local-variable-p 'taskwarrior-active-filters) @@ -221,7 +236,6 @@ the front and focus it. Otherwise, create one and load the data." (interactive) (let ((filter (taskwarrior--get-filter-as-string))) (progn - (goto-char (point-min)) (read-only-mode -1) (erase-buffer) (taskwarrior-load-tasks (concat "1-1000 " filter)) @@ -260,7 +274,7 @@ the front and focus it. Otherwise, create one and load the data." (project-spacing (- project-max-length (length project))) (description (alist-get 'description entry))) (insert (if project - (format (concat "%-2d (%05.2f) [%s]%-" (number-to-string project-spacing) "s %s\n") id urgency project "" description) + (format (concat " %-2d (%05.2f) [%s]%-" (number-to-string project-spacing) "s %s\n") id urgency project "" description) (format (concat "%-2d (%05.2f) %-" (number-to-string (+ 3 project-max-length)) "s%s\n") id urgency "" description)))))))