Mercurial > emacs
comparison lisp/language/japan-util.el @ 23722:b0c66c87b29b
(japanese-zenkaku-region): New optional arg KATAKANA-ONLY.
author | Kenichi Handa <handa@m17n.org> |
---|---|
date | Mon, 16 Nov 1998 06:26:27 +0000 |
parents | 708271862495 |
children | cc03e8352d48 |
comparison
equal
deleted
inserted
replaced
23721:e593fb9c68c3 | 23722:b0c66c87b29b |
---|---|
289 (if hankaku | 289 (if hankaku |
290 (japanese-replace-region (match-beginning 0) (match-end 0) | 290 (japanese-replace-region (match-beginning 0) (match-end 0) |
291 hankaku))))))) | 291 hankaku))))))) |
292 | 292 |
293 ;;;###autoload | 293 ;;;###autoload |
294 (defun japanese-zenkaku-region (from to) | 294 (defun japanese-zenkaku-region (from to &optional katakana-only) |
295 "Convert hankaku' chars in the region to Japanese `zenkaku' chars. | 295 "Convert hankaku' chars in the region to Japanese `zenkaku' chars. |
296 `Zenkaku' chars belong to `japanese-jisx0208' | 296 `Zenkaku' chars belong to `japanese-jisx0208' |
297 `Hankaku' chars belong to `ascii' or `japanese-jisx0201-kana'." | 297 `Hankaku' chars belong to `ascii' or `japanese-jisx0201-kana'. |
298 (interactive "r") | 298 Optional argument KATAKANA-ONLY non-nil means to convert only KATAKANA char." |
299 (interactive "r\nP") | |
299 (save-restriction | 300 (save-restriction |
300 (narrow-to-region from to) | 301 (narrow-to-region from to) |
301 (save-excursion | 302 (save-excursion |
302 (goto-char (point-min)) | 303 (goto-char (point-min)) |
303 (while (re-search-forward "\\ca\\|\\ck" nil t) | 304 (while (or (and katakana-only |
305 (re-search-forward "\\ck" nil t)) | |
306 (and (not katakana-only) | |
307 (re-search-forward "\\ca\\|\\ck" nil t))) | |
304 (let* ((hankaku (preceding-char)) | 308 (let* ((hankaku (preceding-char)) |
305 (composition (get-char-code-property hankaku 'kana-composition)) | 309 (composition (get-char-code-property hankaku 'kana-composition)) |
306 next slot) | 310 next slot) |
307 (if (and composition (setq slot (assq (following-char) composition))) | 311 (if (and composition (setq slot (assq (following-char) composition))) |
308 (japanese-replace-region (match-beginning 0) (1+ (point)) | 312 (japanese-replace-region (match-beginning 0) (1+ (point)) |