Top / twittering-mode及びrieceの新着通知
twittering-mode及びrieceの新着通知

Last update on 2010-02-24 (水) 16:26:14 (197d) | 編集 | 凍結 | 複製 | 名前変更 | 差分 | バックアップ | 添付

半端なEmacsユーザーである私は、できるだけEmacsで作業を済ませたいと思います。

twitterクライアント、ircクライアントにもなるEmacsなので、それを利用したい。
だが、これらは新着通知機能がないのでメッセージを見逃す。なので、それを別のプログラムを使って補完しようとしたのです。

notify-send

新着通知機能として、notify-sendというプログラムがあります。これのインストールは

aptitude install libnotify-bin

でできます。たぶん…あれこれ試行錯誤の後なので不確かです。すみません。
UbuntuやDebianでGNOME環境ならば最初から入っているかと思われます。

twittering-modeの設定

emacsの設定ファイル(.emacsや.emacs.elなど)に

(add-hook 'twittering-new-tweets-hook (lambda ()
  (let ((n twittering-new-tweets-count))
    (start-process "twittering-notify" nil "notify-send"
                   "-i" "任意のアイコンを指定"
                   "New tweets"
                   (format "You have %d new tweet%s"
                           n (if (> n 1) "s" ""))))))

とすることで、更新の時に新着tweetがあれば知らせてくれます。更新時間間隔の設定などの細かいことはここでは触れません。

Riece

riece設定ファイル(~/.riece/initなど)に

(add-hook 'riece-message-filter-functions 'riece-popup-message)
(defun riece-popup-message (message)
(let ((speaker (riece-format-identity (riece-message-speaker message) t))
(text (riece-message-text message))
(channel (riece-identity-prefix (riece-message-target message))))
(call-process-shell-command
(concat "notify-send -t 5000 " "'<" channel "> " speaker "' '" text "'")))
message) 

とすることで新着のたびに知らせてくれます。

あとがき

notify-sendはGNOME環境に適しているようです(あまりよくわかっていない)。
現在KDEユーザーである私には、notify-sendよりもknotifyが適していると思うのですが、使い方がわかりませんでした。引き続き調査中です。

また、これら2つの通知を行うlispは参考サイトからのコピペなので随分異なった記述がなされています。同じようなプログラムで書けるのではないかと思うのですが……。

参考サイト

http://www.emacswiki.org/emacs/TwitteringMode
http://www.moetora.com/log/20090602.html
http://emacs.g.hatena.ne.jp/k1LoW/20080904/1220530129