九月 02, 2009

Send org status change to identica

microblog的一个功能算告诉世界What are you doing?以下一段代码把正在计时的任务和刚刚完成的任务记录在identi.ca或者任何自己建立的laconi.ca上。

(defun wl-org-clock-in-update ()
  (let ((current-heading (org-get-heading t))
        (tags (org-get-tags-at)))
    (when (member "@office" tags)
      (with-current-buffer identica-buffer
        (identica-update-status-if-not-blank "statuses" "update"
                                             current-heading)))))

(add-hook 'org-clock-in-hook 'wl-org-clock-in-update)

(defun wl-org-todo-state-change-update ()
  (let ((current-heading (org-get-heading t))
        (tags (org-get-tags-at)))
    (when (and (member "@office" tags)
               (string-match "^\(DONE\|CANCELED\|GOT\) " current-heading))
      (with-current-buffer identica-buffer
        (identica-update-status-if-not-blank "statuses" "update"
                                             (concat "#" current-heading))))))

(add-hook 'org-after-todo-state-change-hook 'wl-org-todo-state-change-update)

我在公司的机器上装了laconica,所以只在上面记录跟工作相关的内容,其中(member "@office" tags)保证只发送含有@office标签的任务。

0 条评论:

发表评论

指向此帖子的链接:

创建链接

<< 主页