2009-03-31

twitter

Emacs-users like to stay in their own little world, even when interacting with the Others - and they are right of course. Why leave the comforts of your well-configured emacs for the inconveniences of yet another app? For example, when using twitter, I prefer to do that from within emacs. There are different ways and packages to do so.

My favorite so far is twitter.el. Installation is easy: put twitter.el in your load-path (see installing packages if needed). After that, put something like

(autoload 'twitter-get-friends-timeline "twitter" nil t)
(autoload 'twitter-status-edit "twitter" nil t)
(add-hook 'twitter-status-edit-mode-hook 'longlines-mode)
and maybe make an easy keybinding (Shift-F1):
(global-set-key (kbd "<S-f1>")  'twitter-get-friends-timeline)
in your .emacs. Assuming that you already have a Twitter-account (which you'll need to get through its web-interface...), you can then get your friends' 'tweets' with M-x twitter-get-friends-timeline, and update your status with twitter-status-edit (when done, press C-c C-c). Can't be much easier, can it?

The first time in your emacs session you connect to twitter, twitter.el will ask for your username/password. You can in fact put those in your .emacs, but I would advise against that. The chance of inadvertently exposing plain-text username/passwords is a bit too big, esp. when you use your .emacs in many locations.

One small problem I faced with twitter.el is that it's default color are not very well-suited for my dark color theme. Therefore, I've added the following to my theme:

(twitter-user-name-face ((t (:bold t :foreground "white"  :background "blue"))))
   (twitter-time-stamp-face ((t (:bold nil :foreground "white" :background "blue"))))
Et voilà! The screen shot shows one weakness in twitter.el: it does not understand HTML.

The great Socrates once taught us that the unexamined life is not worth living. Thankfully, these days we have twitter now, so we can spend all day examining each others lives... and now without leaving emacs.

(btw, on twitter you can find me as djcb).

10 comments:

p4bl0 said...

this just made my day ! Thanks!

Anonymous said...

And for the Free-as-in-Freedom crowd, there's identica-mode. (My own feed is here.)

Tim "Fester" Baga said...

Thank you for this hint, i've been looking for good twitter client right now.

Bruce Durling said...

Just remember to put (require 'cl) in there if you don't have it loaded already.

Jonathan Arkell said...

There is also twit.el, with optional user icons, searches, and direct messages.

http://www.emacswiki.org/emacs/twit.el

Scott said...

I'd also recommend twittering-mode.el if you can still find it out there via Google. Optional avatars, clickable links, and automated @ replies.

vinhdizzo said...

i use dark colors too, and the following give me an error, function definition is void:
(twitter-user-name-face ((t (:bold t :foreground "white" :background "blue"))))
(twitter-time-stamp-face ((t (:bold nil :foreground "white" :background "blue"))))

i placed this code after the autoloads. any thoughts?

djcb said...

@vinhdizzo: the color thingies are not standalone statements, but they are
part of a color-theme, see:
http://emacs-fu.blogspot.com/2009/03/color-theming.html

For standalone use, you could do something like:

(set-face-foreground 'twitter-user-name-face "blue")
(set-face-background 'twitter-user-name-face "orange")

and set face-attributes for bold etc.

Anonymous said...

Interesting article as for me. It would be great to read a bit more concerning this topic. Thnx for posting this information.
Sexy Lady
Blonde Escorts

Unknown said...

Since a few days BitlBee features a Twitter gateway -- which means that it's now possible to use ERC for this as well :)