4 ms·
The Unicode has a Unihan_Readings.txt file that can be transformed into a readings-table for Emacs to help you accelerate your learning the character definition
by abudabi123 4y ago
The Unicode has a Unihan_Readings.txt file that can be transformed into a readings-table for Emacs to help you accelerate your learning the character definition and key sequence for input method. To help your eyesight you can configure Emacs to enlarge the East Asia fonts. What I don't know how is to append to the "chinese-ctlaub" input method missing key sequence for input method.
For example, 雈, code point #x96c8, the chinese-ctlaub input sequence is missing. I'd like to update chinese-ctlaub with the reading "woon4".
See https://humanum.arts.cuhk.edu.hk/Lexis/lexi-mf/search.php?word=雈 https://humanum.arts.cuhk.edu.hk/Lexis/lexi-mf/search.php?wo...
Here is the emacs lisp configuration.
1
2
3
4 ;; --- create readings table
5
6 ;; #!/bin/sh
7 ;; M='path_to/unidata/Unihan_Readings.awk'
8 ;; X='path_to/unidata/Unihan_Readings.txt'
9 ;; Y='./uni-unihan-readings.el'
10 ;; awk -f "$M" "$X" > "$Y"
11
12
13 ;; --- readings table to load
14
15 ;; (defvar readings-table
16 ;; (make-char-table 'readings-table nil)
17 ;; "Char table of definitions for East Asian characters.")
18 ;; (aset readings-table #x340C "a tribe of savages in South China")
19 ;; (aset readings-table #x3416 "㐖毒, an old name for India")
20
21 ;; --- keybindings to locate definition or key sequence
22
23 (load "~/lib/emacs/x/Unihan_Readings.el")
24
25 (defun x/define-char ()
26 (interactive)
27 (message "%s" (aref readings-table (following-char))))
28
29 (defun xb/quail-show-key ()
30 "Always apply quail-show-key to chinese-ctlaub input method."
31 (interactive)
32 (if (string= current-input-method "chinese-ctlaub")
33 (quail-show-key)
34 (progn
35 (set-input-method "chinese-ctlaub")
36 (quail-show-key)
37 (toggle-input-method))))
38
39 (defun xxb/quail-show-key ()
40 "Always apply quail-show-key to chinese-py-b5 input method."
41 (interactive)
42 (if (string= current-input-method "chinese-py-b5")
43 (quail-show-key)
44 (progn
45 (set-input-method "chinese-py-b5")
46 (quail-show-key)
47 (toggle-input-method))))
48
49 (add-hook 'text-mode-hook
50 (lambda ()
51 (define-key text-mode-map (kbd "<f1> <up>") 'x/define-char)
52 (define-key text-mode-map (kbd "<f1> <right>") 'xb/quail-show-key)
53 (define-key text-mode-map (kbd "<f1> <left>") 'xxb/quail-show-key)))
54
55 ;; (setq view-mode-hook nil)
56 (add-hook 'view-mode-hook
57 (lambda ()
58 (define-key view-mode-map "w" 'x/define-char)
59 (define-key view-mode-map "a" 'xxb/quail-show-key)
60 (define-key view-mode-map "d" 'xb/quail-show-key)))
61
62 (dolist (charset '(kana han symbol cjk-misc bopomofo))
63 (set-fontset-font
64 "fontset-default"
65 charset (font-spec :family "BabelStone Han" :size 28)))