* riece-mcat.el: New file.
authorueno <ueno>
Thu, 18 Jan 2007 22:42:37 +0000 (22:42 +0000)
committerueno <ueno>
Thu, 18 Jan 2007 22:42:37 +0000 (22:42 +0000)
* 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
lisp/ChangeLog
lisp/Makefile.am
lisp/riece-commands.el
lisp/riece-mcat-japanese.el [new file with mode: 0644]
lisp/riece-mcat.el [new file with mode: 0644]

index 1369b6a..bf60599 100644 (file)
@@ -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"
index 0a60db8..420ecd8 100644 (file)
@@ -1,3 +1,11 @@
+2007-01-18  Daiki Ueno  <ueno@unixuser.org>
+
+       * 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  <ueno@unixuser.org>
 
        * riece-package-info.el.in: New file.
index e78f9c7..429f6f2 100644 (file)
@@ -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 \
index 84bffe8..5241a68 100644 (file)
@@ -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 (file)
index 0000000..91d9e56
--- /dev/null
@@ -0,0 +1,6 @@
+;;; -*- coding: iso-2022-jp -*-
+
+(defconst riece-mcat-japanese-alist
+  '(("Really quit IRC? " . "\e$BK\Ev$K\e(BIRC\e$B$r$d$a$^$9$+\e(B? ")))
+
+(provide 'riece-mcat-japanese)
diff --git a/lisp/riece-mcat.el b/lisp/riece-mcat.el
new file mode 100644 (file)
index 0000000..e1b5cbb
--- /dev/null
@@ -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)