X-Git-Url: http://git.chise.org/gitweb/?a=blobdiff_plain;f=lisp%2Friece-unread.el;h=d2e3100570eba9f971a91400e6a40c989e3011be;hb=f8b723243538a43c4f82745a70336c1c707a45ca;hp=5c7ad7f60748ee95cdcd0ac3510029d808cf15fb;hpb=adc4a2ad99d3cda275305529556d2443c3361e0e;p=elisp%2Friece.git diff --git a/lisp/riece-unread.el b/lisp/riece-unread.el index 5c7ad7f..d2e3100 100644 --- a/lisp/riece-unread.el +++ b/lisp/riece-unread.el @@ -38,6 +38,8 @@ (defun riece-unread-display-message-function (message) (unless (or (riece-message-own-p message) (equal (riece-message-target message) riece-current-channel)) + (setq riece-unread-channels + (delete (riece-message-target message) riece-unread-channels)) (add-to-list 'riece-unread-channels (riece-message-target message)) (riece-unread-update-channel-list-buffer))) @@ -66,13 +68,29 @@ "\\3")))) (forward-line)))))) +(defun riece-unread-switch-to-channel () + (interactive) + (if (car riece-unread-channels) + (riece-command-switch-to-channel (car riece-unread-channels)) + (error "No unread channel!"))) + +(defvar riece-command-mode-map) +(defvar riece-dialogue-mode-map) +(defvar riece-channel-list-mode-map) + (defun riece-unread-insinuate () (add-hook 'riece-after-display-message-functions 'riece-unread-display-message-function) (add-hook 'riece-channel-switch-hook 'riece-unread-channel-switch-hook) (add-hook 'riece-update-buffers-hook - 'riece-unread-update-channel-list-buffer)) + 'riece-unread-update-channel-list-buffer) + (define-key riece-command-mode-map + "\C-c\C-u" 'riece-unread-switch-to-channel) + (define-key riece-dialogue-mode-map + "u" 'riece-unread-switch-to-channel) + (define-key riece-channel-list-mode-map + "u" 'riece-unread-switch-to-channel)) (provide 'riece-unread)