Created
December 2, 2010 09:26
-
-
Save portown/725029 to your computer and use it in GitHub Desktop.
Tween-like notification for twittering-mode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(add-hook 'twittering-new-tweets-hook | |
#'(lambda () | |
(let ((n twittering-new-tweets-count) | |
(statuses twittering-new-tweets-statuses)) | |
(start-process "twittering-notify" nil "notify-send" | |
"-i" "/usr/share/pixmaps/gnome-emacs.png" | |
(format "New %d tweet%s" | |
n (if (> n 1) "s" "")) | |
(let ((func (lambda (stat) | |
(concat (cdr (assq 'user-screen-name stat)) | |
": " | |
(let ((text (cdr (assq 'text stat)))) | |
(if (> (length text) 20) | |
(concat (substring text 0 20) "...") | |
text)))))) | |
(if (< n 4) | |
(mapconcat func statuses "\n") | |
(concat (mapconcat func (butlast statuses (- n 3)) "\n") "\n..."))))))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment