Permalink
Browse files

Add sauron-identica module

sauron-identica shows how many new dents have been found by
identica-mode
  • Loading branch information...
ryuslash committed Jun 26, 2012
1 parent 000f64d commit 2752f8f09be648c518d06952298467e258869cb5
Showing with 67 additions and 2 deletions.
  1. +7 −2 README.org
  2. +60 −0 sauron-identica.el
View
@@ -229,8 +229,8 @@
** the backend modules
- Currently, four backend modules have been implemented - *ERC*, *org-mode*, *d-bus*
- and *notifications* (for emacs 24). Hopefully, more will follow.
+ Currently, five backend modules have been implemented - *ERC*, *org-mode*, *d-bus*,
+ *notifications* (for emacs 24) and *identica-mode*. Hopefully, more will follow.
*** erc
@@ -348,6 +348,11 @@
functions listed in the `sauron-event-added-functions' hook, as to not
create some infinite recursion.
+*** identi.ca
+
+ =sauron-identica= shows the number of new dents found by =identica-mode= whenever
+ there is at least one new dent.
+
** adding new modules
It may be interesting to track other modules as well; this shouldn't be too
View
@@ -0,0 +1,60 @@
+;;; sauron-identica.el --- Identica notifications for sauron
+;;
+;; Copyright (C) 2012 Tom Willemsen <tom@ryuslash.org>
+
+;; This file is not part of GNU Emacs.
+;;
+;; Sauron is free software: you can redistribute it and/or modify
+;; it under the terms of the GNU General Public License as published by
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
+
+;; Sauron is distributed in the hope that it will be useful,
+;; but WITHOUT ANY WARRANTY; without even the implied warranty of
+;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+;; GNU General Public License for more details.
+
+;; You should have received a copy of the GNU General Public License
+;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+;; For documentation, please see:
+;; https://github.com/djcb/sauron/blob/master/README.org
+
+;;; Code:
+(require 'identica-mode nil 'noerror)
+
+(defvar sr-identica-running nil
+ "*internal* whether sauron identica is running.")
+
+(defun sauron-identica-start ()
+ "Start watching identica."
+ (if (not (boundp 'identica-mode-version))
+ (progn
+ (message "sauron-identica not available")
+ nil)
+ (unless sr-identica-running
+ (add-hook 'identica-new-dents-hook
+ 'sr-identica-new-dents-func)
+ (setq sr-identica-running t))
+ t))
+
+(defun sauron-identica-stop ()
+ "Stop watching identica."
+ (when sr-identica-running
+ (remove-hook 'identica-new-dents-hook
+ 'sr-identica-new-dents-func)
+ (setq sr-identica-running nil)))
+
+(defun sr-identica-new-dents-func ()
+ "Print the # of new dents."
+ (sauron-add-event
+ 'identica 3
+ (if (= identica-new-dents-count 1)
+ "There is 1 new dent."
+ (format "There are %i new dents." identica-new-dents-count))
+ 'identica))
+
+(provide 'sauron-identica)
+
+;;; sauron-identica.el ends here

0 comments on commit 2752f8f

Please sign in to comment.