;ELC ;;; Compiled ;;; in Emacs version 28.0.50 ;;; with all optimizations. (require 'cl-lib) (defvar ta-overlay nil nil) (make-variable-buffer-local 'ta-overlay) (defvar ta-current-position nil nil) (make-variable-buffer-local 'ta-current-position) (defvar ta-current-homophony-list nil nil) (make-variable-buffer-local 'ta-current-homophony-list) (defvar ta-flattened-homophony-list nil) (defvar ta--timer-object nil) #@78 The homophonic characters' list. Feel free to customized this if you need. (defvar ta-homophony-list '(("他" "她" "它" "牠" "祂") ("你" "妳") ("的" "得") ("訂" "定") ("作" "做" "坐") ("在" "再") ("板" "版")) (#$ . 431)) #@42 Max search range for possible homophony. (defvar ta-max-search-range 300 (#$ . 677)) #@32 The number of seconds to wait. (defvar ta-delay 0.1 (#$ . 768)) #@88 Update `ta-flattened-homophony-list', which is a flatten list, like '(20182 22905 ...) (defalias 'ta-reload-homophony-list #[0 "\302\303\304\305\"\"\211\207" [ta-homophony-list ta-flattened-homophony-list mapcar #[257 "\300!\207" [string-to-char] 3 "\n\n(fn C)"] apply append] 5 (#$ . 838) nil]) #@51 Get the homophony list of CHAR-STR (fn CHAR-STR) (defalias 'ta-get-homophony-list #[257 "\301\302\303$@\207" [ta-homophony-list cl-member :test #[514 "\235\207" [] 4 "\n\n(fn CHAR LIST)"]] 6 (#$ . 1143)]) #@17 (fn POSITION) (defalias 'ta-on-possible-candidate-character #[257 "\300\301`f!!\207" [ta-get-homophony-list char-to-string] 4 (#$ . 1359)]) (custom-declare-face 'ta-highlight '((((class color) (background light)) (:foreground "#ff8700")) (((class color) (background dark)) (:foreground "#ffa722"))) "Face for all candidates" :group 'ta-faces) (defalias 'ta-post-command-hook #[0 "\204\302 \207 ?\205\303\304\305#\211\207" [ta-delay ta--timer-object ta-find-previous-candidate run-with-idle-timer nil #[0 "\301 \210\302\211\207" [ta--timer-object ta-auto-update-candidate nil] 2]] 4]) (defalias 'ta-pre-command-hook #[0 "\300\207" [nil] 1]) #@83 Non-nil if ta mode is enabled. Use the command `ta-mode' to change this variable. (defvar ta-mode nil (#$ . 2015)) (make-variable-buffer-local 'ta-mode) #@571 Deal with homophonic characters This is a minor mode. If called interactively, toggle the `ta mode' mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode. If called from Lisp, toggle the mode if ARG is `toggle'. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number. To check whether the minor mode is enabled in the current buffer, evaluate `ta-mode'. The mode's hook is called both when the mode is enabled and when it is disabled. (fn &optional ARG) (defalias 'ta-mode #[256 "\302 \303=\203 ?\202\247\203\304W\203\305\202\306\307\301!\2031\310\300 \"\2031\300 B\203I\311 \210\312\313\314\305\306$\210\312\315\316\305\306$\210\202X\317 \210\320\313\314\306#\210\320\315\316\306#\210\321\322\203b\323\202c\324\"\210\325\326!\203\205\302 \203w\211\302 \232\203\205\327\330\203\201\331\202\202\332\333#\210\210\334 \210\207" [ta-mode local-minor-modes current-message toggle 1 nil t boundp delq ta-reload-homophony-list add-hook pre-command-hook ta-pre-command-hook post-command-hook ta-post-command-hook ta-delete-all-overlays remove-hook run-hooks ta-mode-hook ta-mode-on-hook ta-mode-off-hook called-interactively-p any message "ta mode %sabled%s" "en" "dis" " in current buffer" force-mode-line-update] 7 (#$ . 2175) (byte-code "\203\n\301!\202 \302C\207" [current-prefix-arg prefix-numeric-value toggle] 2)]) (defvar ta-mode-hook nil) (byte-code "\300\301N\204\f\302\300\301\303#\210\302\300\304\305#\210\302\300\306\307C#\207" [ta-mode-hook variable-documentation put "Hook run after entering or leaving `ta-mode'.\nNo problems result if this variable is not bound.\n`add-hook' automatically binds it. (This is true for all hook variables.)" custom-type hook standard-value nil] 4) #@23 Keymap for `ta-mode'. (defvar ta-mode-map (byte-code "\300 \211\262\301!\203\f\207\211<\203\302!\207\303\304\"\207" [make-sparse-keymap keymapp easy-mmode-define-keymap error "Invalid keymap %S"] 4) (#$ . 4023)) (byte-code "\301\302\303\304\211%\207" [ta-mode-map add-minor-mode ta-mode " ta" nil] 6) #@86 Allocate an overlay to highlight a possible candidate character. (fn POSITION FACE) (defalias 'ta-make-overlay #[514 "\300\211T\301\302\301%\303\304#\210\303\305\302#\207" [make-overlay nil t overlay-put face ta-overlay] 8 (#$ . 4338)]) #@18 (fn BEGIN END) (defalias 'ta-delete-region-overlay #[514 "\300\301\302$\207" [remove-overlays ta-overlay t] 7 (#$ . 4586)]) (defalias 'ta-delete-all-overlays #[0 "\300ed\"\207" [ta-delete-region-overlay] 3]) #@60 Return true if o is an overlay used by flyspell. (fn OBJ) (defalias 'ta-overlay-p #[257 "\300!\205\n\301\302\"\207" [overlayp overlay-get ta-overlay] 4 (#$ . 4804)]) #@71 Replace the char in position, then add face. (fn POSITION CHARACTER) (defalias 'ta-replace-char #[514 "\211T|\210\212b\210\211c\210)\300\301\"\207" [ta-make-overlay ta-highlight] 5 (#$ . 4980)]) #@119 Update `ta-current-position' and `ta-current-homophony-list' within `ta-max-search-range' steps. Used in idle timer. (defalias 'ta-auto-update-candidate #[0 "\212\211\304U\204`eU\204`f >\204\305 \210\211S\262\202\306 \210`f >\2058\307`\310\"\210`\311\312\nf!!`\262)\207" [ta-max-search-range ta-flattened-homophony-list ta-current-position ta-current-homophony-list 0 left-char ta-delete-all-overlays ta-make-overlay ta-highlight ta-get-homophony-list char-to-string] 4 (#$ . 5186) nil]) #@209 Update `ta-current-position' and `ta-current-homophony-list', without any range limit. When REVERSE is non-nil, find nextcandidate. Should be called interactively, not by idle timer. (fn &optional REVERSE) (defalias 'ta-find-previous-candidate #[256 "\212\303\203\f`dU\204-`eU\204-`f>\204-\203#\304 \210\202&\305 \210\211T\262\202`f>\203I\306 \210\307`\310\"\210`\311\312 f!!`\202T\313\203R\314\202S\315!\262)\207" [ta-flattened-homophony-list ta-current-position ta-current-homophony-list 0 right-char left-char ta-delete-all-overlays ta-make-overlay ta-highlight ta-get-homophony-list char-to-string message "The last candidate" "The first candidate"] 5 (#$ . 5696) nil]) #@18 (fn ELEM LIST) (defalias 'ta--get-next-elem #[514 "\235\211A\204 @\207\211A@\207" [] 4 (#$ . 6399)]) #@26 (fn &optional REVERSE) (defalias 'ta-next-homophony #[256 "\303 \210`S=\205\304`!?\205\305f >\203D\306!\205GTdX\205G\307f!\310\311\2039\312\n!\202:\n\"\"\210\205C\313 \207\314\315!\207" [ta-current-position ta-flattened-homophony-list ta-current-homophony-list ta-find-previous-candidate ta-on-possible-candidate-character t number-or-marker-p char-to-string ta-replace-char ta--get-next-elem reverse right-char message "No candidate found."] 9 (#$ . 6512) nil]) (defalias 'ta-previous-homophony #[0 "\300\301!\207" [ta-next-homophony reverse] 2 nil nil]) (defalias 'ta-left #[0 "\301!\203\302 \210\303 \210b\207\304\305!\207" [ta-current-position number-or-marker-p left-char ta-find-previous-candidate message "Cannot find any candidate"] 2 nil nil]) (defalias 'ta-right #[0 "\301!\203\302 \210\303\304!\210b\207\305\306!\207" [ta-current-position number-or-marker-p right-char ta-find-previous-candidate reverse message "Cannot find any candidate"] 2 nil nil]) (provide 'ta)