From: MORIOKA Tomohiko Date: Wed, 20 Nov 2013 03:25:00 +0000 (+0900) Subject: (japanese-traditionalize-string): Use `selector' instead of X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ecb61feb9f0572bd17801d723dc03a09701e0ec2;p=chise%2Ftomoyo-tools.git (japanese-traditionalize-string): Use `selector' instead of `ideo-trans-select-char'. (japanese-traditionalize-region): Add new optional argument `selector'. --- diff --git a/ideo-trans.el b/ideo-trans.el index 3c8087b..355192a 100644 --- a/ideo-trans.el +++ b/ideo-trans.el @@ -266,7 +266,7 @@ (setq ret (or (char-feature ret '<-simplified@JP/Jouyou) (char-feature ret '<-simplified@JP)))) (if (cdr ret) - (ideo-trans-select-char ret (format "%c => " chr)) + (funcall selector ret) (car ret))) ((setq ret (char-feature chr '=>ucs@jis)) (decode-char '=ucs@jis ret)) @@ -281,9 +281,13 @@ 'japanese-traditionalize-string) ;;;###autoload -(defun japanese-traditionalize-region (start end) +(defun japanese-traditionalize-region (start end &optional selector) "Convert Japanese simplified Kanji in the region into traditional characters." (interactive "r") + (unless selector + (setq selector + (lambda (chars) + (ideo-trans-select-char chars (format "%c => " chr))))) (save-excursion (save-restriction (narrow-to-region start end) @@ -300,7 +304,7 @@ (progn (if (cdr ret) (progn - (setq rret (ideo-trans-select-char ret)) + (setq rret (funcall selector ret)) (delete-char) (insert rret)) (delete-char)