From ed2dc9e1c01e467d56ef4e8460075defcf20b90b Mon Sep 17 00:00:00 2001 From: ueno Date: Thu, 18 Jan 2007 22:42:37 +0000 Subject: [PATCH] * riece-mcat.el: New file. * riece-mcat-japanese.el: New file. * COMPILE (riece-modules): Added riece-mcat and riece-mcat-japanese. * Makefile.am (EXTRA_DIST): Added riece-mcat.el and riece-mcat-japanese.el. --- lisp/COMPILE | 4 +++- lisp/ChangeLog | 8 ++++++++ lisp/Makefile.am | 8 +++++--- lisp/riece-commands.el | 3 ++- lisp/riece-mcat-japanese.el | 6 ++++++ lisp/riece-mcat.el | 47 +++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 71 insertions(+), 5 deletions(-) create mode 100644 lisp/riece-mcat-japanese.el create mode 100644 lisp/riece-mcat.el diff --git a/lisp/COMPILE b/lisp/COMPILE index 1369b6a..bf60599 100644 --- a/lisp/COMPILE +++ b/lisp/COMPILE @@ -12,6 +12,7 @@ riece-version riece-coding riece-complete + riece-mcat riece-addon-modules riece-addon riece-ruby @@ -48,7 +49,8 @@ riece-commands riece-irc - riece)))) + riece + riece-mcat-japanese)))) (defvar riece-icons '("riece-command-quit.xpm" diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0a60db8..420ecd8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,11 @@ +2007-01-18 Daiki Ueno + + * riece-mcat.el: New file. + * riece-mcat-japanese.el: New file. + * COMPILE (riece-modules): Added riece-mcat and riece-mcat-japanese. + * Makefile.am (EXTRA_DIST): Added riece-mcat.el and + riece-mcat-japanese.el. + 2006-12-18 Daiki Ueno * riece-package-info.el.in: New file. diff --git a/lisp/Makefile.am b/lisp/Makefile.am index e78f9c7..429f6f2 100644 --- a/lisp/Makefile.am +++ b/lisp/Makefile.am @@ -6,9 +6,11 @@ EXTRA_DIST = COMPILE ChangeLog ChangeLog.Liece \ riece-coding.el riece-commands.el riece-compat.el riece-complete.el \ riece-debug.el riece-display.el riece-emacs.el riece-filter.el \ riece-globals.el riece-handle.el riece-highlight.el riece-identity.el \ - riece-message.el riece-misc.el riece-mode.el riece-naming.el \ - riece-options.el riece-ruby.el riece-server.el riece-signal.el \ - riece-user.el riece-version.el riece-xemacs.el riece-irc.el riece.el \ + riece-mcat.el riece-message.el riece-misc.el riece-mode.el \ + riece-naming.el riece-options.el riece-ruby.el riece-server.el \ + riece-signal.el riece-user.el riece-version.el riece-xemacs.el \ + riece-irc.el riece.el \ + riece-mcat-japanese.el \ riece-ctcp.el riece-url.el riece-unread.el riece-ndcc.el \ riece-rdcc.el riece-log.el riece-mini.el riece-doctor.el \ riece-alias.el riece-layout.el riece-skk-kakutei.el riece-guess.el \ diff --git a/lisp/riece-commands.el b/lisp/riece-commands.el index 84bffe8..5241a68 100644 --- a/lisp/riece-commands.el +++ b/lisp/riece-commands.el @@ -32,6 +32,7 @@ (require 'riece-misc) (require 'riece-identity) (require 'riece-message) +(require 'riece-mcat) (autoload 'derived-mode-class "derived") @@ -633,7 +634,7 @@ If prefix argument ARG is non-nil, toggle frozen status." (progn (message "No server process") (ding)) - (if (y-or-n-p "Really quit IRC? ") + (if (y-or-n-p (riece-mcat "Really quit IRC? ")) (let ((message (if arg (read-string "Message: ") diff --git a/lisp/riece-mcat-japanese.el b/lisp/riece-mcat-japanese.el new file mode 100644 index 0000000..91d9e56 --- /dev/null +++ b/lisp/riece-mcat-japanese.el @@ -0,0 +1,6 @@ +;;; -*- coding: iso-2022-jp -*- + +(defconst riece-mcat-japanese-alist + '(("Really quit IRC? " . "本当にIRCをやめますか? "))) + +(provide 'riece-mcat-japanese) diff --git a/lisp/riece-mcat.el b/lisp/riece-mcat.el new file mode 100644 index 0000000..e1b5cbb --- /dev/null +++ b/lisp/riece-mcat.el @@ -0,0 +1,47 @@ +(defvar riece-mcat-alist + '(("Japanese" . riece-mcat-japanese))) + +(defun riece-mcat (string) + (let ((entry (assoc current-language-environment riece-mcat-alist))) + (when entry + (require (cdr entry)) + (or (cdr (assoc string (symbol-value (intern + (concat (symbol-name (cdr entry)) + "-alist"))))) + string)))) + +(defun riece-mcat-extract-from-form (form) + (if (and form (listp form)) + (if (eq (car form) 'riece-mcat) + (cdr form) + (delq nil (apply #'nconc + (mapcar #'riece-mcat-extract-from-form form)))))) + +(defun riece-mcat-extract (files alist) + (let (message-list pointer) + (while files + (save-excursion + (set-buffer (find-file-noselect (car files))) + (goto-char (point-min)) + (while (progn + (while (progn (skip-chars-forward " \t\n\f") + (looking-at ";")) + (forward-line 1)) + (not (eobp))) + (setq message-list + (nconc message-list + (riece-mcat-extract-from-form + (read (current-buffer))))))) + (setq files (cdr files))) + (setq message-list (sort message-list #'string-lessp) + pointer message-list) + (while pointer + (if (equal (car pointer) + (nth 1 pointer)) + (setcdr pointer (nth 2 pointer)) + (unless (assoc (car pointer) alist) + (setq alist (cons (list (car pointer)) alist)))) + (setq pointer (cdr pointer))) + alist)) + +(provide 'riece-mcat) -- 1.7.10.4