-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathsauron-identica.el
63 lines (51 loc) · 1.97 KB
/
sauron-identica.el
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
;;; 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 sauron-prio-identica-new-dents 3
"Identica new dents event priority.")
(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 sauron-prio-identica-new-dents
(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