From: ueno Date: Fri, 19 Jan 2007 07:09:56 +0000 (+0000) Subject: * riece-options.el (riece-addons): Insinuate riece-mcat by default. X-Git-Tag: riece-3_1_2~32 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=044af1a85ffe3064eeec32e8ac5272e5f6eacdc8;p=elisp%2Friece.git * riece-options.el (riece-addons): Insinuate riece-mcat by default. * riece-addon-modules.el (riece-addon-modules): Add riece-mcat. * riece-mcat.el: Implement add-on interface. (riece-mcat-description): New constant. (riece-mcat-insinuate): New function. (riece-mcat-uninstall): New function. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 220859b..a8b36a4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,14 @@ 2007-01-19 Daiki Ueno + * riece-options.el (riece-addons): Insinuate riece-mcat by default. + * riece-addon-modules.el (riece-addon-modules): Add riece-mcat. + * riece-mcat.el: Implement add-on interface. + (riece-mcat-description): New constant. + (riece-mcat-insinuate): New function. + (riece-mcat-uninstall): New function. + +2007-01-19 Daiki Ueno + * riece-mcat.el (riece-mcat-update): New function. * Makefile.am (update-mcat): New target. * COMPILE (riece-modules): Moved riece-mcat-japanese.el to diff --git a/lisp/riece-addon-modules.el b/lisp/riece-addon-modules.el index 615b006..4bd4b3a 100644 --- a/lisp/riece-addon-modules.el +++ b/lisp/riece-addon-modules.el @@ -22,6 +22,7 @@ (riece-keyword . "Detect keywords in IRC buffers.") (riece-log . "Save IRC logs.") (riece-lsdb . "Help register nicknames in LSDB rolodex program.") + (riece-mcat . "Translate messages.") (riece-menu . "Setup Riece's command menus.") (riece-mini . "Use Riece only on the minibuffer.") ;;(riece-ndcc . "DCC file sending protocol support (written in elisp.)") diff --git a/lisp/riece-mcat.el b/lisp/riece-mcat.el index bf15b54..ad15348 100644 --- a/lisp/riece-mcat.el +++ b/lisp/riece-mcat.el @@ -22,17 +22,19 @@ ;;; Code: -(defvar riece-mcat-alist - '(("Japanese" . riece-mcat-japanese))) +(require 'pp) (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)))) + (let ((feature (get-language-info current-language-environment + 'riece-mcat-feature))) + (if feature + (progn + (require feature) + (or (cdr (assoc string + (symbol-value + (intern (concat (symbol-name feature) "-alist"))))) + string)) + string))) (defun riece-mcat-extract-from-form (form) (if (and form (listp form) (listp (cdr form))) @@ -69,7 +71,8 @@ alist))) (defun riece-mcat-update (files mcat-file mcat-alist) - (let (alist) + (let ((pp-escape-newlines t) + alist) (save-excursion (set-buffer (find-file-noselect mcat-file)) (goto-char (point-min)) @@ -85,14 +88,22 @@ (setq alist (riece-mcat-extract files (symbol-value mcat-alist))) (insert "(defconst " (symbol-name mcat-alist) "\n '(") (while alist - (insert "(" (prin1-to-string (car (car alist))) " . " - (prin1-to-string (cdr (car alist))) ")") + (insert "(" (pp-to-string (car (car alist))) " . " + (pp-to-string (cdr (car alist))) ")") (if (cdr alist) (insert "\n ")) (setq alist (cdr alist))) (insert "))") (save-buffer)))) +(defconst riece-mcat-description "Translate messages") + +(defun riece-mcat-insinuate () + (set-language-info "Japanese" 'riece-mcat-feature 'riece-mcat-japanese)) + +(defun riece-mcat-uninstall () + (set-language-info "Japanese" 'riece-mcat-feature nil)) + (provide 'riece-mcat) ;;; riece-mcat.el ends here diff --git a/lisp/riece-options.el b/lisp/riece-options.el index fad5461..6987933 100644 --- a/lisp/riece-options.el +++ b/lisp/riece-options.el @@ -131,7 +131,8 @@ way is to put Riece variables on .emacs or file loaded from there." riece-alias riece-ctlseq riece-keyword - riece-shrink-buffer) + riece-shrink-buffer + riece-mcat) "Add-ons insinuated into Riece." :type '(repeat symbol) :group 'riece-options)