From: bg66 Date: Tue, 17 Jun 2003 01:42:33 +0000 (+0000) Subject: * riece-mini.el: New add-on. X-Git-Tag: riece-0_0-branchpoint~10 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=5f340611c56a3390fd6ee34dc30224555bc9de72;p=elisp%2Friece.git * riece-mini.el: New add-on. * COMPILE (riece-modules): Add `riece-mini'. * Makefile.am (EXTRA_DIST): Add `riece-mini.el'. --- diff --git a/lisp/COMPILE b/lisp/COMPILE index 8408a5e..9b9c2bf 100644 --- a/lisp/COMPILE +++ b/lisp/COMPILE @@ -42,6 +42,7 @@ riece-ctcp riece-highlight riece-log + riece-mini riece-rdcc riece-url riece-unread)))) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 4e6c194..52ddf28 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,9 @@ 2003-06-17 OHASHI Akira + * riece-mini.el: New add-on. + * COMPILE (riece-modules): Add `riece-mini'. + * Makefile.am (EXTRA_DIST): Add `riece-mini.el'. + * riece-display.el (riece-channel-buffer-create): Add new hook. * riece-log.el: New add-on for saving irc logs. * COMPILE (riece-modules): Add `riece-log'. diff --git a/lisp/Makefile.am b/lisp/Makefile.am index 4c4885d..0322658 100644 --- a/lisp/Makefile.am +++ b/lisp/Makefile.am @@ -7,7 +7,7 @@ EXTRA_DIST = COMPILE ChangeLog ChangeLog.Liece \ riece-options.el riece-server.el riece-user.el riece-version.el \ riece-xemacs.el riece.el \ riece-ctcp.el riece-url.el riece-unread.el \ - riece-ndcc.el riece-rdcc.el riece-log.el + riece-ndcc.el riece-rdcc.el riece-log.el riece-mini.el CLEANFILES = auto-autoloads.el custom-load.el *.elc FLAGS ?= -batch -q -no-site-file diff --git a/lisp/riece-log.el b/lisp/riece-log.el index fe4a25c..42ac8b3 100644 --- a/lisp/riece-log.el +++ b/lisp/riece-log.el @@ -43,7 +43,7 @@ :group 'riece-log) (defcustom riece-log-directory-map nil - "The map of channel name and directory name." + "*The map of channel name and directory name." :type '(repeat (cons (string :tag "Channel name") (string :tag "Directory name"))) :group 'riece-log) diff --git a/lisp/riece-mini.el b/lisp/riece-mini.el new file mode 100644 index 0000000..8c6bbc3 --- /dev/null +++ b/lisp/riece-mini.el @@ -0,0 +1,101 @@ +;;; riece-mini.el --- "riece on minibuffer" 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: + +;; This add-on shows arrival messages to minibuffer. And you can send +;; message using minibuffer. +;; +;; By using this add-on, you can use always "mini riece", even if you +;; are visiting other buffers. + +;; To use, add the following line to your ~/.riece/init.el: +;; (add-to-list 'riece-addons 'riece-mini t) +;; +;; And for using conveniently, bind any global key to +;; `riece-mini-send-message'. +;; For example: +;; (global-set-key "\C-cm" 'riece-mini-send-message) + +;;; Code: + +(eval-when-compile (require 'riece-message)) + +(defvar riece-mini-last-channel nil) + +(defmacro riece-mini-message-no-log (string &rest args) + "Like `message', except that message logging is disabled." + (if (featurep 'xemacs) + (if args + `(display-message 'no-log (format ,string ,@args)) + `(display-message 'no-log ,string)) + `(let (message-log-max) + (message ,string ,@args)))) + +(defun riece-mini-display-message-function (message) + "Show arrival messages to minibuffer." + (unless (or (eq (window-buffer (selected-window)) + (get-buffer riece-command-buffer)) + (riece-message-own-p message) + (active-minibuffer-window)) + (let ((open-bracket + (funcall riece-message-make-open-bracket-function message)) + (close-bracket + (funcall riece-message-make-close-bracket-function message)) + (global-name + (funcall riece-message-make-global-name-function message))) + (setq riece-mini-last-channel (riece-message-target message)) + (riece-mini-message-no-log + "%s" (concat (format-time-string "%H:%M") " " + open-bracket global-name close-bracket + " " (riece-message-text message)))))) + +(defun riece-mini-send-message (arg) + "Send message using minibuffer. +Prefix argument onece (C-u), send message to last received channel. +If twice (C-u C-u), then ask the channel." + (interactive "P") + (let* ((completion-ignore-case t) + (target + (cond + ((equal arg '(16)) + (completing-read "Channel/User: " + (mapcar #'list riece-current-channels) nil t)) + (arg (or riece-mini-last-channel riece-current-channel)) + (t riece-current-channel))) + (message (read-string (format "Message to %s: " target)))) + (unless (equal message "") + (riece-switch-to-channel target) + (riece-send-string + (format "PRIVMSG %s :%s\r\n" + (riece-identity-prefix target) + message)) + (riece-own-channel-message message target)))) + +(defun riece-mini-insinuate () + (add-hook 'riece-after-display-message-functions + 'riece-mini-display-message-function)) + +(provide 'riece-mini) + +;;; riece-mini.el ends here