Skip to content

Instantly share code, notes, and snippets.

@portown
Created December 2, 2010 09:26
Show Gist options
  • Save portown/725029 to your computer and use it in GitHub Desktop.
Save portown/725029 to your computer and use it in GitHub Desktop.
Tween-like notification for twittering-mode
(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