aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2014-12-21 10:48:41 -0200
committerArtur Malabarba <bruce.connor.am@gmail.com>2014-12-22 10:46:42 -0200
commit0a3a9540b3033e9e93927c92fb6df39a3785563d (patch)
treee89f546228cc9a5dfb1cb57f2cb5d2bd23ba70c3
parent04ffa4b891161ce98fa203812768f06808417e0d (diff)
Move mode-line logic to sx-notify
-rw-r--r--sx-inbox.el17
-rw-r--r--sx-notify.el66
2 files changed, 66 insertions, 17 deletions
diff --git a/sx-inbox.el b/sx-inbox.el
index f01d90b..3bc95c8 100644
--- a/sx-inbox.el
+++ b/sx-inbox.el
@@ -63,23 +63,6 @@ KEYWORDS are added to the method call along with PAGE.
:keywords keywords
:filter sx-inbox-filter))
-
-;;; mode-line notification
-(defvar sx-inbox--unread-inbox nil
- "List of inbox items still unread.")
-
-(defvar sx-inbox--unread-notifications nil
- "List of notifications items still unread.")
-
-(defvar sx-inbox--mode-line
- '("["
- (sx-inbox--unread-inbox
- ("i:" (:eval (length sx-inbox--unread-inbox))))
- (sx-inbox--unread-notifications
- ("n:" (:eval (length sx-inbox--unread-notifications))))
- "]")
- "")
-
(provide 'sx-inbox)
;;; sx-inbox.el ends here
diff --git a/sx-notify.el b/sx-notify.el
new file mode 100644
index 0000000..bc88ceb
--- /dev/null
+++ b/sx-notify.el
@@ -0,0 +1,66 @@
+;;; sx-notify.el --- Mode-line notifications. -*- lexical-binding: t; -*-
+
+;; Copyright (C) 2014 Artur Malabarba
+
+;; Author: Artur Malabarba <bruce.connor.am@gmail.com>
+
+;; This program 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.
+
+;; This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
+
+;;; Commentary:
+
+
+;;; Code:
+
+(require 'sx)
+(require 'sx-inbox)
+
+
+;;; mode-line notification
+(defvar sx-notify--unread-inbox nil
+ "List of inbox items still unread.")
+
+(defvar sx-notify--unread-notifications nil
+ "List of notifications items still unread.")
+
+(defvar sx-notify--mode-line
+ '((sx-notify--unread-inbox (sx-notify--unread-notifications "["))
+ (sx-notify--unread-inbox
+ (:propertize
+ (:eval (format "i:%s" (length sx-notify--unread-inbox)))
+ face mode-line-buffer-id
+ mouse-face mode-line-highlight))
+ (sx-notify--unread-inbox (sx-notify--unread-notifications ","))
+ (sx-notify--unread-notifications
+ (:propertize
+ (:eval (format "n:%s" (length sx-notify--unread-notifications)))
+ mouse-face mode-line-highlight))
+ (sx-notify--unread-inbox (sx-notify--unread-notifications "]")))
+ "")
+(put 'sx-notify--mode-line 'risky-local-variable t)
+
+
+;;; minor-mode definition
+(define-minor-mode sx-notify-mode nil nil "sx" nil
+ (if sx-notify-mode
+ (add-to-list 'global-mode-string '(t sx-notify--mode-line) 'append)
+ (setq global-mode-string
+ (delete '(t sx-notify--mode-line) global-mode-string))))
+
+
+(provide 'sx-notify)
+;;; sx-notify.el ends here
+
+;; Local Variables:
+;; indent-tabs-mode: nil
+;; End: