Skip to content

Instantly share code, notes, and snippets.

@kmaed
Created February 24, 2013 06:28
Show Gist options
  • Save kmaed/5022876 to your computer and use it in GitHub Desktop.
Save kmaed/5022876 to your computer and use it in GitHub Desktop.
Patch to utf-tool.el for >= emacs-23. Replace only CJK characters.
--- utf-tool.el.orig 2013-02-24 15:24:54.914062345 +0900
+++ utf-tool.el 2013-02-24 15:23:21.947814237 +0900
@@ -58,11 +58,13 @@
;; (charset-description charset)
;; (split (split-char char))
(pos (point))
- (unicode nil))
+ (unicode nil)
+ (cjk (string-match "CJK" (get-char-code-property char 'name))))
(unless
- (memq charset '(ascii japanese-jisx0208 katakana-jisx0201))
+ (or (memq charset '(ascii japanese-jisx0208 katakana-jisx0201))
+ (not cjk))
(if (or (< char 256)
- (memq 'mule-utf-8 (find-coding-systems-region pos (1+ pos)))
+ (memq 'utf-8 (find-coding-systems-region pos (1+ pos)))
(get-char-property pos 'untranslated-utf-8))
(setq unicode (or (get-char-property pos 'untranslated-utf-8)
(encode-char char 'ucs))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment