From ecb61feb9f0572bd17801d723dc03a09701e0ec2 Mon Sep 17 00:00:00 2001 From: MORIOKA Tomohiko Date: Wed, 20 Nov 2013 12:25:00 +0900 Subject: [PATCH] (japanese-traditionalize-string): Use `selector' instead of `ideo-trans-select-char'. (japanese-traditionalize-region): Add new optional argument `selector'. --- ideo-trans.el | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) 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) -- 1.7.10.4