aboutsummaryrefslogtreecommitdiff
path: root/sx-inbox.el
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2014-12-22 13:21:20 -0200
committerArtur Malabarba <bruce.connor.am@gmail.com>2014-12-22 13:21:20 -0200
commit1fbab001d18fc73f14e235106c910131e16433e9 (patch)
treefcf2b650277f6947597ff627886b0b563abae2ce /sx-inbox.el
parent3b950f37f154e58c971b44e6323dcb41f6c53a51 (diff)
Implement sx-inbox
Diffstat (limited to 'sx-inbox.el')
-rw-r--r--sx-inbox.el36
1 files changed, 33 insertions, 3 deletions
diff --git a/sx-inbox.el b/sx-inbox.el
index 31fab5d..575d181 100644
--- a/sx-inbox.el
+++ b/sx-inbox.el
@@ -116,8 +116,7 @@ These are identified by their links.")
(lambda (page) (sx-inbox-get sx-inbox--notification-p page)))
(setq tabulated-list-format
[("Type" 30 t nil t) ("Date" 10 t :right-align t) ("Title" 0)])
- (setq header-line-format sx-inbox--header-line)
- (tabulated-list-revert))
+ (setq header-line-format sx-inbox--header-line))
;;; Keybinds
@@ -144,7 +143,9 @@ is an alist containing the elements:
(sx-assoc-let data
(vector
(list
- (concat (capitalize (replace-regexp-in-string "_" " " .item_type))
+ (concat (capitalize
+ (replace-regexp-in-string
+ "_" " " (or .item_type .notification_type)))
(cond (.answer_id " on Answer at:")
(.question_id " on:")))
'face 'font-lock-keyword-face)
@@ -165,6 +166,35 @@ is an alist containing the elements:
'face 'font-lock-function-name-face))))
'face 'default))))))
+
+;;; Entry commands
+(defvar sx-inbox--buffer nil
+ "Buffer being used to display inbox.")
+
+(defun sx-inbox (&optional notifications)
+ "Display a buffer listing inbox items.
+With prefix NOTIFICATIONS, list notifications instead of inbox."
+ (interactive "P")
+ (setq sx-inbox--buffer (get-buffer-create "*sx-inbox*"))
+ (let ((inhibit-read-only t))
+ (with-current-buffer sx-inbox--buffer
+ (erase-buffer)
+ (sx-inbox-mode)
+ (setq sx-inbox--notification-p notifications)
+ (tabulated-list-revert)))
+ (let ((w (get-buffer-window sx-inbox--buffer)))
+ (if (window-live-p w)
+ (select-window w)
+ (pop-to-buffer sx-inbox--buffer)
+ (enlarge-window
+ (- (+ fill-column 4) (window-width))
+ 'horizontal))))
+
+(defun sx-inbox-notifications ()
+ "Display a buffer listing notification items."
+ (interactive)
+ (sx-inbox t))
+
(provide 'sx-inbox)
;;; sx-inbox.el ends here