TwitteringMode

Description

twittering-mode.el is a Twitter client

TwitteringModeScreenshot

Home page: http://twmode.sourceforge.net/

Github page: http://github.com/hayamiz/twittering-mode/tree/master

git clone git://github.com/hayamiz/twittering-mode.git

Installation Guide

For Windows users

For example, if you uncompressed it under `C:\foo\`, there may be a directory `C:\foo\twittering-mode-X.X.X\` which contains `twittering-mode.el`. So add the following code to your `.emacs`
        (add-to-list 'load-path "C:/foo/twittering-mode-X.X.X")

For Linux and other Unix users

For example, if you uncompressed it under `/path/to/foo`, there may be a directory `/path/to/foo/twittering-mode-X.X.X/` which contains `twittering-mode.el`. So add the following code to your `.emacs`
        (add-to-list 'load-path "/path/to/foo/twittering-mode-X.X.X")

NOTE: For twittering-mode-2.0.0, if you have the latest emacs (or version 22 or later), you only need to put twittering-mode.el in your load path; you do not need the other directories or files that are in the archive file. For example, if you have this in your `.emacs`:

(add-to-list 'load-path "~/.emacs.d/site-lisp/")

just

mv twittering-mode-2.0.0/twittering-mode.el ~/.emacs.d/site-lisp/

Set up your Emacs

      (require 'twittering-mode)
      (setq twittering-use-master-password t)

This requires GnuPG. And also, either EasyPG (included as part of emacs v. 23) or alpaca.el (0.13) is necessary.

      (setq twittering-cert-file "/etc/ssl/certs/ca-bundle.crt")

Run twittering-mode

  1. Execute `M-x twit` to run twittering-mode.
  2. Open OAuth authorization page with your browser, click “Allow”, and enter the PIN code. If you use the master password, the PIN code is required only at the first time.
  3. (Optional) Input the passphrase if you use the master password. This is required only at the first time.
  4. Your friends’ timeline will appear. You can also open other timelines by ‘V’ with timeline-spec. Enjoy!

Key-bindings on View mode

‘M-x twit’, and you enter to this mode. You can see various timelines.

Move the cursor on the current timeline

‘j’
Go to the next tweet. If the cursor placed on the oldest tweet, older tweets are retrieved. You can specify how many tweets will be retrieved by the variable ‘twittering-number-of-tweets-on-retrieval’.(‘twittering-goto-next-status’)
‘k’
Go to the previous tweet. (‘twittering-goto-previous-status’)
‘n’
Go to the next tweet whose author is the same as the current tweet. (‘twittering-goto-next-status-of-user’)
‘p’
Go to the previous tweet whose author is the same as the current tweet. (‘twittering-goto-previous-status-of-user’)
‘l’
Go to the next character. (‘forward-char’)
‘h’
Go to the previous character. (‘backward-char’)
‘0’
Go to the beginning of the current line. (‘beginning-of-line’)
`^’
Go to the beginning of the text on the current line. (‘beginning-of-line-text’)
`$’
Go to the end of the current line. (‘end-of-line’)
‘C-i’
Go to the next username, URI, or timeline symbol. (‘twittering-goto-next-thing’)
‘M-C-i’, `<backtab>’
Go to the previous username, URI, or timeline symbol. (‘twittering-goto-previous-thing’)
`<backspace>’, ‘M-v’
Scroll down. (‘twittering-scroll-down’)
`<space>’, ‘C-v’
Scroll up. (‘twittering-scroll-up’)
‘H’
Go to the beginning of the current buffer. (‘twittering-goto-first-status’)
‘G’
Go to the end of the current buffer. (‘end-of-buffer’)

Apply some operation to the current timeline

‘g’
Retrieve new tweets of the current timeline. (‘twittering-current-timeline’)
‘r’
Display replied tweets related to the current tweet. (‘twittering-toggle-show-replied-statuses’)
‘C-c D’
Delete the current tweet. You can delete only yours. (‘twittering-delete-status’)
‘C-c C-e’
Remove all tweets of the current timeline from Emacs cache. (‘twittering-erase-old-statuses’)
‘q’
Kill the current timeline buffer. (‘twittering-kill-buffer’)

Open other timeline

If you open a new timeline, a new buffer is generated.

‘v’
Open a timeline pointed by the cursor. (‘twittering-other-user-timeline’)
‘V’
Open a various timeline. You can specify the timeline by timeline-spec. (‘twittering-visit-timeline’)
For convenience, there are following short-cuts.
‘L’
Open a timeline of a certain list. (‘twittering-other-user-list-interactive’)
‘C-c C-q’
Search. (‘twittering-search’)
‘f’
Switch to the next timeline buffer. (‘twittering-switch-to-next-timeline’)
‘b’
Switch to the previous timeline buffer. (‘twittering-switch-to-previous-timeline’)

Post a tweet

‘u’, ‘C-c C-s’
Post a tweet. (‘twittering-update-status-interactive’)
‘C-m’, ‘Enter’
Post a reply to the tweet pointed by the cursor. If the cursor points a URI, invoke ‘browse-url’ for the URI. (‘twittering-enter’)
‘C-c C-m’, ‘C-c Enter’
Post a non-official (organic) retweet for the tweet pointed by the cursor. (‘twittering-retweet’)
‘C-u C-c C-m’, ‘C-u C-c Enter’
Post a official (native) retweet for the tweet pointed by the cursor. (‘twittering-retweet’)
‘d’
Send a direct message. (‘twittering-direct-message’)

Invoke an external browser

`<mouse-1>’
Open user page or URI by ‘browse-url’. (‘twittering-click’)
‘C-c C-v’
Open the pointed user’s page by ‘browse-url’. (‘twittering-view-user-page’)

Change display mode

‘a’
Toggle automatic retrieval of the current timeline. (‘twittering-toggle-activate-buffer’)
‘i’
Toggle displaying icons of the current timeline. (‘twittering-icon-mode’)
‘s’
Toggle scroll mode for the current timeline. (‘twittering-scroll-mode’)
‘t’, ‘C-c C-p’
Toggle proxy. (‘twittering-toggle-proxy’)

Others

‘C-c C-t’
Set the current hashtag. (‘twittering-set-current-hashtag’)
‘C-c C-l’
Post the message “λかわいいよλ”(“Lambda is cute, lambda.”). (‘twittering-update-lambda’)
`C-<mouse-3>’
Push the current tweet to kill-ring. (‘twittering-push-tweet-onto-kill-ring’)
‘U’
Push the URL of the current tweet to kill-ring. (‘twittering-push-uri-onto-kill-ring’)

Key-bindings on Edit mode

‘M-p’
Replace a tweet being edited with the previous tweet on history. (‘twittering-edit-previous-history’)
‘M-n’
Replace a tweet being edited with the next tweet on history. (‘twittering-edit-next-history’)
`<f4>’
Shorten the URL pointed by the cursor. (‘twittering-edit-replace-at-point’)
‘C-c C-k’
Cancel editing a tweet. (‘twittering-edit-cancel-status’)
‘C-c C-c’
Post the current tweet. (‘twittering-edit-post-status’)

Timeline spec

When pressing ‘V’ (‘twittering-visit-timeline’), you can open any timeline with timeline spec. Since twittering-mode stores the history of visited timelines, EmacsSession and incremental backward search on the prompt of ‘V’ (‘twittering-visit-timeline’) may be useful when you open a timeline which you have opened.

The timeline spec can be used anywhere you have to specify a timeline.

Basic timeline

:home
the home timeline.
:mentions
the timeline consisting of tweets mentioning you.
:public
the public timeline.
USER
the timeline consisting of tweets posted by USER.
USER/LISTNAME
the list timeline owned by USER and named LISTNAME.

Direct message

:direct_messages
the timeline consisting of direct messages sent to you.
:direct_messages_sent
the timeline consisting of direct messages that you sent.

Favorite

:favorites
the timeline consisting of tweets that you marked as a favorite.
:favorites/USER
the timeline consisting of tweets that USER marked as a favorite.

Hashtag

#HASHTAG
the timeline consisting of tweets including #HASHTAG.

Retweet

:retweeted_by_me
retweets that you posted.
:retweeted_by_user/USER
(only on development version) retweets that USER posted.
:retweeted_to_me
retweets sent to your home timeline.
:retweeted_to_user/USER
(only on development version) retweets sent to USER’s home timeline.
:retweets_of_me
your tweets that have been retweeted by others.

Search

:search/QUERY-STRING/
the timeline consisting of tweets matching QUERY-STRING. In QUERY-STRING, / (slash) and \ (backslash) must be escaped as \/ or \\.

Alias

You can define an alias for timeline spec. By defining a short alias as a long timeline spec, you can refer it more easily. There are two types of alias, fixed and functional as below. Both types are defined in the association list bound to the variable ‘twittering-timeline-spec-alias’.

$ALIAS-NAME
the timeline spec bound to ALIAS-NAME in ‘twittering-timeline-spec-alias’.
$ALIAS-NAME(ARGUMENT)
the timeline spec generated by calling the function, which is bound to ALIAS-NAME in ‘twittering-timeline-spec-alias’, with the argument ARGUMENT. The function can be specified as a symbol or a lambda expression. Functions must receive one string argument.

As an example, consider the following definition of ‘twittering-timeline-spec-alias’.

(setq twittering-timeline-spec-alias
      '(("FRIENDS" . "my-account/friends-list")
        ("related-to" .
         (lambda (username)
           (if username
               (format ":search/to:%s OR from:%s OR @%s/"
                       username username username)
             ":home")))
        ("related-to-twitter" . "$related-to(twitter)")))

With this configuration, you can use the below aliases.

aliasequivalent
$FRIENDSmy-account/friends-list
$related-to:home
$related-to(twitterapi):search/to:twitterapi OR from:twitterapi OR @twitterapi/
$related-to-twitter:search/to:twitter OR from:twitter OR @twitter/

You can use an alias on defining other aliases, but a definition including a circular-reference is forbidden.

Initial timeline

By setting the ‘twittering-initial-timeline-spec-string’, you can specify timelines that should be opened initially. Timelines are specified by timeline-spec as follows.

(setq twittering-initial-timeline-spec-string
      '(":home"
        ":replies"
        ":favorites"
        ":direct_messages"
        ":search/emacs/"
        "user_name/list_name"))

Commands corresponding to operations on Twitter

You can use the following commands.

‘M-x twittering-follow’, ‘M-x twittering-unfollow’ to follow or unfollow a user.

‘M-x twittering-favorite’, ‘M-x twittering-unfavorite’ to fav a tweet.

‘M-x twittering-mute’, ‘M-x twittering-unmute’ to mute or unmute a user.

‘M-x twittering-block’ to block the user who posted the tweet at the current cursor position.

‘M-x twittering-block-and-report-as-spammer’ to block and report the user who posted the tweet at the current cursor position.

Customizing your key bindings

You can use ‘twittering-mode-hook’ to customize your configuration. This example shows how to define a few key bindings:

 (add-hook 'twittering-mode-hook
           (lambda ()
             (mapc (lambda (pair)
                     (let ((key (car pair))
                           (func (cdr pair)))
                       (define-key twittering-mode-map
                         (read-kbd-macro key) func)))
                   '(("F" . twittering-friends-timeline)
                     ("R" . twittering-replies-timeline)
                     ("U" . twittering-user-timeline)
                     ("W" . twittering-update-status-interactive)))))

Other useful options

 (setq twittering-icon-mode t)                ; Show icons
 (setq twittering-timer-interval 300)         ; Update your timeline each 300 seconds (5 minutes)
 (setq twittering-url-show-status nil)        ; Keeps the echo area from showing all the http processes

twittering-mode also provides hooks that are run when new tweets arrive. This example calls notify-send (included in the libnotify package) to display a message when new tweets arrive:

 (add-hook 'twittering-new-tweets-hook (lambda ()
   (let ((n twittering-new-tweets-count))
     (start-process "twittering-notify" nil "notify-send"
                    "-i" "/usr/share/pixmaps/gnome-emacs.png"
                    "New tweets"
                    (format "You have %d new tweet%s"
                            n (if (> n 1) "s" ""))))))

URL shortening service

The default URL shortening service for twittering-mode-2.0.0 is tinyurl.com.

You can use bit.ly (or j.mp); add these lines to your `.emacs`

(setq twittering-tinyurl-service 'bit.ly)
(setq twittering-bitly-login "YOURbitlyUsername")
(setq twittering-bitly-api-key "YOURbitlyAPIkey")

If your not sure what your username is, look at your bit.ly “Public Timeline” to find it → https://bitly.com/u/USERNAME

Find your API Key in bit.ly settings.

You can also set your default short domain (e.g., j.mp) in the bit.ly settings.

Enabling Spell Check for Tweets

Add the hook below to enable spell checking before tweets

(add-hook 'twittering-edit-mode-hook (lambda () (ispell-minor-mode) (flyspell-mode)))

Numbering mode

twittering-numbering.el lets one navigate to links using numbers, the same way as is done in emacs-w3m.


See also: Twitter Identica-mode