aboutsummaryrefslogtreecommitdiff
path: root/sx-inbox.el
diff options
context:
space:
mode:
authorArtur Malabarba <bruce.connor.am@gmail.com>2014-12-21 21:35:21 -0200
committerArtur Malabarba <bruce.connor.am@gmail.com>2014-12-22 10:46:42 -0200
commit5675fc89e2b06b1533cb588368c1ffa4e414d0f4 (patch)
tree81dd12b2ba995ac4a38f42924d19aad0f798b0b7 /sx-inbox.el
parente313ae05f86ed93dd7731fdb496bdf8b43bbf3e5 (diff)
Fix up the major-mode
Diffstat (limited to 'sx-inbox.el')
-rw-r--r--sx-inbox.el51
1 files changed, 27 insertions, 24 deletions
diff --git a/sx-inbox.el b/sx-inbox.el
index 75a3d57..00e5e9d 100644
--- a/sx-inbox.el
+++ b/sx-inbox.el
@@ -100,20 +100,18 @@ These are identified by their links.")
(define-derived-mode sx-inbox-mode
sx-question-list-mode "Question List"
"Mode used to list inbox and notification items."
- (setq sx-question-list--print-function
- #'sx-inbox--print-info)
- (setq sx-question-list--dataset sx-inbox--unread-inbox)
+ (toggle-truncate-lines 1)
+ (setq fill-column 40)
+ (setq sx-question-list--print-function #'sx-inbox--print-info)
+ (setq sx-question-list--dataset (sx-inbox-get))
(setq tabulated-list-format
- [("Type" 30 t :right-align t)
- ("Date" 10 t :right-align t)
- ("Title" 0 sx-inbox--date-more-recent-p)])
- (setq header-line-format sx-inbox--header-line))
+ [("Type" 30 t nil t) ("Date" 10 t :right-align t) ("Title" 0)])
+ (setq header-line-format sx-inbox--header-line)
+ (tabulated-list-revert))
;;; Keybinds
-(mapc
- (lambda (x) (define-key sx-inbox-mode-map
- (car x) (cadr x)))
+(mapc (lambda (x) (define-key sx-inbox-mode-map (car x) (cadr x)))
'(
("t" nil)
("a" nil)
@@ -132,27 +130,32 @@ These are identified by their links.")
This is the default printer used by `sx-inbox'. It assumes DATA
is an alist containing the elements:
`answer_id', `body', `comment_id', `creation_date', `is_unread',
- `item_type', `link', `question_id', `site', `title'.
-
-Also see `sx-question-list-refresh'."
+ `item_type', `link', `question_id', `site', `title'."
(list
data
(sx-assoc-let data
(vector
(list
(concat (capitalize (replace-regexp-in-string "_" " " .item_type))
- (cond
- (.answer_id " on Answer at:")
- (.question_id " on:"))))
- (list (propertize (concat (sx-time-since .last_activity_date)
- sx-question-list-ago-string)
- 'face 'sx-question-list-date))
+ (cond (.answer_id " on Answer at:")
+ (.question_id " on:")))
+ 'face 'font-lock-keyword-face)
+ (list
+ (concat (sx-time-since .creation_date)
+ sx-question-list-ago-string)
+ 'face 'sx-question-list-date)
(list
- (concat
- (propertize " " 'display "\n")
- .title
- (propertize " " 'display "\n")
- .body))))))
+ (propertize
+ " " 'display
+ (concat "\n " .title "\n"
+ (let ((col fill-column))
+ (with-temp-buffer
+ (setq fill-column col)
+ (insert " " .body)
+ (fill-region (point-min) (point-max))
+ (propertize (buffer-string)
+ 'face 'font-lock-function-name-face))))
+ 'face 'default))))))
(provide 'sx-inbox)
;;; sx-inbox.el ends here