* Coloring jabber contacts in org-mode tags according to availability
@ 2009-05-02 23:08 Andrew Hyatt
0 siblings, 0 replies; only message in thread
From: Andrew Hyatt @ 2009-05-02 23:08 UTC (permalink / raw
To: emacs-orgmode
I like to put coworker's usernames as tags to my tasks, if I need to
interact with them to get the task done. Looking over the agenda for
the day while i decide on my next task, I decided I wanted to see if
my coworkers were available so that I don't have to check around when
deciding on my next task. So, I wrote the following function to color
my tags based on the jabber availability of the person in question
(green / yellow / red). It's not super-efficient, but it should work
quickly for most people. If there is widespread interest in this, I
can develop it into a contrib package.
(defun ash-jabber-colorize-tags ()
(let ((contact-hash (make-hash-table :test 'equal)))
(dolist (jc jabber-connections)
(dolist (contact (plist-get (fsm-get-state-data jc) :roster))
(puthash (car (split-string (symbol-name contact) "@"))
contact contact-hash)))
(save-excursion
(goto-char (point-min))
(while (re-search-forward ":\\(\\w+\\):" nil t)
(let ((tag (match-string-no-properties 1)))
(when (and tag (gethash tag contact-hash))
(let* ((js (jabber-jid-symbol (gethash tag contact-hash)))
(connected (get js 'connected))
(show (get js 'show)))
(if connected
(let ((o (make-overlay (match-beginning 1) (-
(point) 1))))
(overlay-put o 'face
(cons 'foreground-color
(cond ((equal "away" show)
"yellow")
((equal "dnd" show)
"red")
(t "green")))))))))
(backward-char)))))
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2009-05-02 23:08 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-02 23:08 Coloring jabber contacts in org-mode tags according to availability Andrew Hyatt
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.