Skip to content

Commit

Permalink
Unread status notifier uses the hook invoked when rendering tweets.
Browse files Browse the repository at this point in the history
* twittering-mode.el: Unread status notifier uses the new hook
invoked when rendering tweets. This corrects the number of unread
statuses on composite timelines.
(twittering-update-unread-status-info): modified for use in
`twittering-new-tweets-rendered-hook'.
(twittering-enable-unread-status-notifier): use
`twittering-new-tweets-rendered-hook' instead of
`twittering-new-tweets-hook'.
  • Loading branch information
cvmat committed Feb 5, 2012
1 parent 96bad7e commit a8c1426
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 4 deletions.
9 changes: 9 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,15 @@
(twittering-rerender-timeline-all): call
`twittering-render-timeline' with nil INVOKE-HOOK.

* twittering-mode.el: Unread status notifier uses the new hook
invoked when rendering tweets. This corrects the number of unread
statuses on composite timelines.
(twittering-update-unread-status-info): modified for use in
`twittering-new-tweets-rendered-hook'.
(twittering-enable-unread-status-notifier): use
`twittering-new-tweets-rendered-hook' instead of
`twittering-new-tweets-hook'.

2012-01-29 Tadashi MATSUO <tad@mymail.twin.jp>

* twittering-mode.el: Follow the header conventions. Thanks to
Expand Down
10 changes: 6 additions & 4 deletions twittering-mode.el
Original file line number Diff line number Diff line change
Expand Up @@ -7912,10 +7912,11 @@ means the number of statuses retrieved after the last visiting of the buffer.")

(defun twittering-update-unread-status-info ()
"Update `twittering-unread-status-info' with new tweets."
(let* ((buffer (twittering-get-buffer-from-spec twittering-new-tweets-spec))
(let* ((buffer (twittering-get-buffer-from-spec
twittering-rendered-new-tweets-spec))
(current (or (cadr (assq buffer twittering-unread-status-info)) 0))
(result (+ current twittering-new-tweets-count)))
(when (and buffer (not (eq buffer (current-buffer))))
(result (+ current (length twittering-rendered-new-tweets))))
(when buffer
(twittering-set-number-of-unread buffer result))))

(defun twittering-enable-unread-status-notifier ()
Expand All @@ -7924,7 +7925,8 @@ means the number of statuses retrieved after the last visiting of the buffer.")
(setq twittering-unread-status-info
(mapcar (lambda (buffer) `(,buffer ,0))
(twittering-get-buffer-list)))
(add-hook 'twittering-new-tweets-hook 'twittering-update-unread-status-info)
(add-hook 'twittering-new-tweets-rendered-hook
'twittering-update-unread-status-info)
(add-hook 'post-command-hook
'twittering-reset-unread-status-info-if-necessary)
(add-to-list 'global-mode-string
Expand Down

0 comments on commit a8c1426

Please sign in to comment.