Function: japanese-hankaku-region

japanese-hankaku-region is an autoloaded, interactive and byte-compiled function defined in japan-util.el.gz.

Signature

(japanese-hankaku-region FROM TO &optional ASCII-ONLY)

Documentation

Convert Japanese zenkaku chars in the region to hankaku chars.

Zenkaku chars belong to japanese-jisx0208 Hankaku chars belong to ascii or japanese-jisx0201-kana. Optional argument ASCII-ONLY non-nil means to convert only to ASCII char.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/language/japan-util.el.gz
;;;###autoload
(defun japanese-hankaku-region (from to &optional ascii-only)
  "Convert Japanese `zenkaku' chars in the region to `hankaku' chars.
`Zenkaku' chars belong to `japanese-jisx0208'
`Hankaku' chars belong to `ascii' or `japanese-jisx0201-kana'.
Optional argument ASCII-ONLY non-nil means to convert only to ASCII char."
  (interactive "r\nP")
  (save-restriction
    (narrow-to-region from to)
    (save-excursion
      (goto-char (point-min))
      (while (re-search-forward "\\cj" nil t)
	(let* ((zenkaku (preceding-char))
	       (hankaku (or (and (not ascii-only)
				 (get-char-code-property zenkaku 'jisx0201))
			    (get-char-code-property zenkaku 'ascii))))
	  (if hankaku
	      (japanese-replace-region (match-beginning 0) (match-end 0)
				       hankaku)))))))