From b33a8b8e575ad51d50dc09163d1dcb219e0789b9 Mon Sep 17 00:00:00 2001 From: OHASHI Akira Date: Fri, 6 Jun 2003 01:54:45 +0000 Subject: [PATCH] * riece-unread.el (riece-unread-display-message-function): Delete the target before adding to list. (riece-unread-switch-to-channel): New function. (riece-unread-insinuate): Follow change above. --- lisp/ChangeLog | 5 +++++ lisp/riece-unread.el | 20 +++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c8f2174..ab40c06 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,10 @@ 2003-06-06 OHASHI Akira + * riece-unread.el (riece-unread-display-message-function): Delete the + target before adding to list. + (riece-unread-switch-to-channel): New function. + (riece-unread-insinuate): Follow change above. + * riece.el (riece-channel-list-mode-map): Don't bind `riece-command-unread-channel'. 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) -- 2.25.1