Bit side of life

Technical notes of digital heart

Be Social

| Comments

Emacs isn’t only a best-class editor which offers you productivity boost for free. It’s also all-in-one environment which embeds most frequently used tools like console (eshell), irc (erc), news reader (gnus) and… well known “social” gadgets like gtalk and twitter. Yes, that means, you may communicate with friends and check your tweets not even leaving editor window.

Let me show how to configure both.

GTalk

Gtalk bases on open protocol (jabber), so the only thing we need is a jabber client. Looking at emacs wiki you will easily find this one along with exhaustive documentation.

There is also additional wiki page dedicated to jabber+gtalk configuration, so if you need details take a look at it.

You may also base on my own configuration:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
(setq jabber-account-list '(("username@gmail.com"
                              (:password . nil)
                              (:network-server . "talk.google.com")
                              (:port . 443)
                              (:connection-type . ssl)))

      jabber-vcard-avatars-retrieve nil

      my-chat-prompt "[%t] %n "
      jabber-muc-private-foreign-prompt-format "[%t] %g/%n "
      jabber-chat-foreign-prompt-format my-chat-prompt
      jabber-chat-local-prompt-format my-chat-prompt
      jabber-groupchat-prompt-format my-chat-prompt

      jabber-chat-header-line-format
      '(" " (:eval (jabber-jid-displayname jabber-chatting-with))
      " " (:eval (jabber-jid-resource jabber-chatting-with)) "\t";
      (:eval (let ((buddy (jabber-jid-symbol jabber-chatting-with)))
                 (propertize
                  (or
                   (cdr (assoc (get buddy 'show) jabber-presence-strings))
                   (get buddy 'show))
                  'face
                  (or (cdr (assoc (get buddy 'show) jabber-presence-faces))
                      'jabber-roster-user-online))))
      "\t" (:eval (get (jabber-jid-symbol jabber-chatting-with) 'status))
      (:eval (unless (equal "" *jabber-current-show*)
                 (concat "\t You're " *jabber-current-show*
                         " (" *jabber-current-status* ")")))))

It looks complicated at the first sight, but in fact there is nothing more than setting account details jabber-account-list, disabling retrieval of other people’s avatars jabber-vcard-avatars-retrieve and customizing prompts and header line jabber-chat-header-line-format.

To launch jabber just with one command I use following function:

1
2
3
4
5
6
7
(defun jabber()
  (interactive)

  (require 'jabber)
  (setq jabber-chat-fill-long-lines nil)
  (auto-fill-mode -1)
  (jabber-connect-all))

Now, M-x jabber connects immediately to gtalk kindly asking for password.

Twitter

Twittering Mode is all you need here. Similar to gtalk, I wrote a function which simplifies twitter launching:

1
2
3
4
(defun twitter()
  (interactive)
  (require 'twittering-mode)
  (twit))

and simple configuration:

1
2
3
4
5
(setq twittering-use-master-password t
      twittering-initial-timeline-spec-string
      '(":home"
        ":replies"
        ":direct_messages"))

twittering-use-master-password avoid having to authorize twittering-mode each time it’s launched. It keeps tokens in encrypted .twittering-mode.gpg file. As you noticed, encryption is based on gpg so you also need GnuPG and either EasyPG or alpaca.el which I found here.

Once it’s all installed, you are ready to start twittering mode M-x twitter. If it’s run first time, twittering mode will ask for authorizing PIN number which you can gather from twitter page. This page shows up immediately in your browser if you only allow emacs running web browser for you.

Last thing is setting a password to .twittering-mode.gpg and exactly this password you have to provide each time you will run twittering-mode in the future.

Good luck!

Comments