Add abilitiy to create tasks from org links

This is very handy to create tasks based on mu4e mails and dired files.
This commit is contained in:
Patrick Winter 2019-05-21 13:35:40 +02:00
parent 8cc5226972
commit 9064d99a01

View file

@ -148,6 +148,18 @@
(switch-to-buffer-other-window buf) (switch-to-buffer-other-window buf)
(insert (taskwarrior--shell-command "info" "" id))))) (insert (taskwarrior--shell-command "info" "" id)))))
(defun taskwarrior--parse-created-task-id (output)
(when (string-match "^.*Created task \\([0-9]+\\)\\.*$" output)
(message (match-string 1 output))))
(defun taskwarrior-org-store-link (arg)
(interactive "P")
(let* ((link (org-store-link arg))
(description (read-from-minibuffer "Description: "))
(id (taskwarrior--parse-created-task-id
(shell-command-to-string (format "task add %s" description)))))
(shell-command-to-string (format "task %s annotate %s" id link))))
(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)