From: bg66 Date: Thu, 27 May 2004 09:38:44 +0000 (+0000) Subject: * riece-biff.el: New add-on. X-Git-Tag: riece-1_0_0~9 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=9dd59786b9132f46104bc4d8a00f983e9911965a;p=elisp%2Friece.git * riece-biff.el: New add-on. * COMPILE (riece-modules): Add riece-biff. * Makefile.am (EXTRA_DIST): Add riece-biff.el. --- diff --git a/lisp/COMPILE b/lisp/COMPILE index 1cfd0ba..798db28 100644 --- a/lisp/COMPILE +++ b/lisp/COMPILE @@ -66,7 +66,8 @@ riece-xface riece-ctlseq riece-ignore - riece-hangman)))) + riece-hangman + riece-biff)))) (defun riece-compile-modules (modules) (let ((load-path (cons nil load-path))) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3cb9dcd..788185e 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2004-05-27 OHASHI Akira + + * riece-biff.el: New add-on. + * COMPILE (riece-modules): Add riece-biff. + * Makefile.am (EXTRA_DIST): Add riece-biff.el. + 2004-05-26 Daiki Ueno * riece.el (riece-exit): Don't disable addons. diff --git a/lisp/Makefile.am b/lisp/Makefile.am index 5679e50..a1d1d18 100644 --- a/lisp/Makefile.am +++ b/lisp/Makefile.am @@ -11,7 +11,8 @@ EXTRA_DIST = COMPILE ChangeLog ChangeLog.Liece \ riece-doctor.el riece-alias.el riece-layout.el riece-skk-kakutei.el \ riece-guess.el riece-history.el riece-button.el riece-keyword.el \ riece-menu.el riece-icon.el riece-async.el riece-lsdb.el \ - riece-xface.el riece-ctlseq.el riece-ignore.el riece-hangman.el + riece-xface.el riece-ctlseq.el riece-ignore.el riece-hangman.el \ + riece-biff.el CLEANFILES = auto-autoloads.el custom-load.el *.elc FLAGS ?= -batch -q -no-site-file diff --git a/lisp/riece-biff.el b/lisp/riece-biff.el new file mode 100644 index 0000000..4157f26 --- /dev/null +++ b/lisp/riece-biff.el @@ -0,0 +1,111 @@ +;;; riece-biff.el --- biff add-on +;; Copyright (C) 2003 OHASHI Akira + +;; Author: OHASHI Akira +;; Keywords: IRC, riece + +;; This file is part of Riece. + +;; This program is free software; you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation; either version 2, or (at your option) +;; any later version. + +;; This program is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs; see the file COPYING. If not, write to the +;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, +;; Boston, MA 02111-1307, USA. + +;;; Commentary: + +;; To use, add the following line to your ~/.riece/init.el: +;; (add-to-list 'riece-addons 'riece-biff) + +;;; Code: + +(eval-when-compile (require 'riece-message)) + +(defgroup riece-biff nil + "Biff for new arrival messages" + :group 'riece) + +(defcustom riece-biff-check-channels nil + "*If non-nil, riece-biff checks only the channel contained in this list." + :type '(repeat string) + :group 'riece-biff) + +(defcustom riece-biff-default-mode-string "[-]" + "*String displayed when there is no arrival message." + :type 'string + :group 'riece-biff) + +(defcustom riece-biff-biff-mode-string "[R]" + "*String displayed when there are new arrival messages." + :type 'string + :group 'riece-biff) + +(defcustom riece-biff-functions nil + "*Functions for processing new arrival messages." + :type 'function + :group 'riece-biff) + +(defvar riece-biff-mode-string 'riece-biff-default-mode-string) + +(defvar riece-biff-enabled nil) + +(defconst riece-biff-description + "Biff for new arrival messages") + +(defun riece-biff-after-display-message-function (message) + (when (and riece-biff-enabled + (not (or (eq (window-buffer (selected-window)) + (get-buffer riece-command-buffer)) + (riece-message-own-p message) + (riece-message-type message)))) + (when (or (null riece-biff-channels) + (member (riece-format-identity (riece-message-target message)) + riece-biff-check-channels)) + (setq riece-biff-mode-string 'riece-biff-biff-mode-string) + (run-hook-with-args 'riece-biff-functions message)))) + +(defun riece-biff-clear (&optional dummy) + (when riece-biff-enabled + (setq riece-biff-mode-string 'riece-biff-default-mode-string))) + +(defun riece-biff-insinuate () + (add-hook 'riece-after-display-message-functions + 'riece-biff-after-display-message-function) + (add-hook 'riece-redisplay-buffers-hook 'riece-biff-clear) + (add-hook 'riece-after-switch-to-channel-functions 'riece-biff-clear)) + +(defun riece-biff-enable () + (setq global-mode-string + (cond + ((nlistp global-mode-string) + (list "" 'riece-biff-mode-string global-mode-string)) + ((not (memq 'riece-biff-mode-string global-mode-string)) + (append '("" riece-biff-mode-string) + (remove "" global-mode-string))) + (t + global-mode-string))) + (setq riece-biff-enabled t)) + +(defun riece-biff-disable () + (setq global-mode-string + (cond + ((and (listp global-mode-string) + (memq 'riece-biff-mode-string global-mode-string)) + (remq 'riece-biff-mode-string global-mode-string)) + (t + global-mode-string))) + (riece-biff-clear) + (setq riece-biff-enabled nil)) + +(provide 'riece-biff) + +;;; riece-biff.el ends here