;ELC ;;; Compiled ;;; in Emacs version 26.3 ;;; with all optimizations. ;;; This file contains utf-8 non-ASCII characters, ;;; and so cannot be loaded into Emacs 22 or earlier. (and (boundp 'emacs-version) (< (aref emacs-version (1- (length emacs-version))) ?A) (string-lessp emacs-version "23") (error "`%s' was compiled for Emacs 23 or later" #$)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (byte-code "\300\301!\210\300\302!\210\300\303!\210\300\304!\210\300\305!\210\300\306!\210\300\307!\210\300\310!\210\300\311!\210\300\312!\210\300\313!\210\300\314!\210\300\315!\210\300\316!\210\300\317!\210\300\320!\210\321\322\323\324\325DD\326\327\330%\210\321\331\323\324\332DD\333\327\334%\207" [require cl-lib pyim-common pyim-scheme pyim-dcache pyim-entered pyim-imobjs pyim-codes pyim-page pyim-candidates pyim-preview pyim-indicator pyim-outcome pyim-punctuation pyim-autoselector pyim-cstring pyim-magic custom-declare-variable pyim-english-input-switch-functions funcall function #[0 "\300\207" [nil] 1] "让 pyim 开启英文输入功能.\n\n这个变量的取值为一个函数列表,这个函数列表中的任意一个函数的\n运行结果为 t 时,pyim 开启英文输入功能。" :type symbol pyim-exhibit-delay-ms #[0 "\300\207" [0] 1] "输入或者删除拼音字符后等待多少毫秒后才显示可选词\n当用户快速输入连续的拼音时可提升用户体验.\n如果为 0 或者 nil, 则不等待立刻显示可选词." integer] 6) #@39 是否开启 pyim 英文输入模式. (defvar pyim-process-input-ascii nil (#$ . 1479)) #@126 是否强制开启中文输入模式. 这个变量只用于 `pyim-convert-string-at-point', 不要 在其它地方使用。 (defvar pyim-process-force-input-chinese nil (#$ . 1574)) #@30 记录是否在转换状态. (defvar pyim-process-translating nil (#$ . 1763)) #@98 记录最近一次创建的词条, 用于实现快捷删词功能: `pyim-delete-last-word' . (defvar pyim-process-last-created-word nil (#$ . 1848)) #@45 异步处理 entered 时,使用的 timer. (defvar pyim-process-run-async-timer nil (#$ . 2007)) #@38 保存所有的 self insert command. (defvar pyim-process-self-insert-commands nil (#$ . 2111)) (defvar pyim-process-run-exhibit-timer nil) (pyim-register-local-variables '(pyim-process-input-ascii pyim-process-translating pyim-process-last-created-word)) #@83 PYIM 流程,词库相关的初始化工作。 (fn &optional FORCE SAVE-CACHES) (defalias 'pyim-process-init-dcaches #[512 "\300 \210\301 \210\302!\207" [pyim-recreate-local-variables pyim-pymap-cache-create pyim-dcache-update] 4 (#$ . 2373)]) #@52 PYIM 流程,保存 dcache. (fn &optional FORCE) (defalias 'pyim-process-save-dcaches #[256 "\211\205\300 \207" [pyim-dcache-save-caches] 2 (#$ . 2626)]) (defalias 'pyim-process-update-personal-words #[0 "\300\301\302\"\207" [pyim-dcache-call-api update-personal-words t] 3]) #@55 PYIM 流程,用户界面相关的初始化工作。 (defalias 'pyim-process-init-ui #[0 "\300 \207" [pyim-preview-setup-overlay] 1 (#$ . 2912)]) #@43 启动 pyim 流程需要的相关 daemon. (defalias 'pyim-process-start-daemon #[0 "\300\301!\207" [pyim-indicator-start-daemon pyim-process-indicator-function] 2 (#$ . 3065)]) #@43 关闭 pyim 流程已经启动的 daemon. (defalias 'pyim-process-stop-daemon #[0 "\300\301\302p\303 \"\"?\205\304 \207" [cl-find-if #[257 "\300\301\"\207" [buffer-local-value current-input-method] 4 "\n\n(fn BUF)"] remove buffer-list pyim-indicator-stop-daemon] 5 (#$ . 3248) nil]) #@117 PYIM 流程的输入保存在一个 buffer 中,使用 FORMS 处理这个 buffer 中的信息。 (fn &rest FORMS) (defalias 'pyim-process-with-entered-buffer '(macro . #[128 "\300B\207" [pyim-entered-with-entered-buffer] 3 (#$ . 3541)])) (byte-code "\300\301\302\303#\304\301\305\306#\207" [function-put pyim-process-with-entered-buffer lisp-indent-function 0 put edebug-form-spec t] 5) #@23 (fn &optional TYPE) (defalias 'pyim-process-get-entered #[256 "\300!\207" [pyim-entered-get] 3 (#$ . 3937)]) #@215 从 `pyim-entered-buffer' 的当前位置,找到下一个或者下 NUM 个 imelem 对应的位置 如果 SEARCH-FORWARD 为 t, 则向前搜索,反之,向后搜索。 (fn NUM &optional SEARCH-FORWARD START) (defalias 'pyim-process-next-imelem-position #[769 "r\301!q\210\302 \206 `\211\303e\"\304\"@G\305\211\203Ud\262\211V\203\227U\203\227\303e\"\262\304\"@\262\n\\GY\203N\211\262\202\"\211S\262\202\"\nX\203be\262\202\227\262\211eY\203\227U\203\227\303e\"\262\304\"@\262\nZGU\203\220\211\262\202e\211S\262\202e\266\207)\207" [pyim-entered-buffer get-buffer-create pyim-scheme-name buffer-substring-no-properties pyim-imobjs-create nil] 13 (#$ . 4056)]) #@131 判断是否 *根据环境自动切换* 为英文输入模式,这个函数处理变量: `pyim-english-input-switch-functions' (defalias 'pyim-process-auto-switch-english-input-p #[0 "\301\302\303!\203C\202<\203\202\304\"\207" [pyim-english-input-switch-functions cl-some #[257 "\300!\205\211 \207" [functionp] 3 "\n\n(fn X)"] functionp nil] 5 (#$ . 4783)]) #@51 确定 pyim 是否需要启动中文输入模式. (defalias 'pyim-process-input-chinese-p #[0 "\303 \304\305\"\304\306\"\204 ?\2050\307 ?\2050\310\311\312!\231\204*\n\313\314\"\235\2020\n\313\314\"\235\207" [pyim-process-force-input-chinese pyim-process-input-ascii last-command-event pyim-scheme-name pyim-scheme-get-option :first-chars :rest-chars pyim-process-auto-switch-english-input-p "" pyim-entered-get point-before mapcar identity] 7 (#$ . 5166)]) #@21 Indicator function. (defalias 'pyim-process-indicator-function #[0 "\206\f ?\205\f\302 ?\207" [pyim-process-force-input-chinese pyim-process-input-ascii pyim-process-auto-switch-english-input-p] 1 (#$ . 5640)]) #@94 延迟 `pyim-exhibit-delay-ms' 显示备选词等待用户选择。 (fn &optional NO-DELAY) (defalias 'pyim-process-run #[256 "\302\303!G\304U\203\f\305 \207\203\306!\210\211\204\" \203\" \304=\203%\307 \207\310 \311\245\312\307#\211\207" [pyim-process-run-exhibit-timer pyim-exhibit-delay-ms pyim-entered-get point-before 0 pyim-process-terminate cancel-timer pyim-process-run-1 run-with-timer 1000.0 nil] 5 (#$ . 5860)]) #@141 查询 `pyim-entered-buffer' 光标前的拼音字符串(如果光标在行首则为光标后的), 显示备选词等待用户选择。 (defalias 'pyim-process-run-1 #[0 "\306 \307\310\311!\262\312\"\313\314\"!\206\211C\315 \210\316\317\307\320#\321\322\323 \324\325#\"\307C\326\f!\203p\327\330\331\332\333\334!\335\"\336\337%\"\203p\340\242\341\"\211\203X\211;\203X\211C\202Y \342\343!\210)\210\344\310\345!!\210\344*!\210\346 \202\267\326\f!\203\257\327\330\331\332\333\334!\347\"\336\337%\"\203\257\340\242\341\"\211\203\234\211;\203\234\211C\202\235 \342\343!\210)\210\344\310\345!!\210\346 \202\267\317+\350 \210\351 \266\202\207" [pyim-imobjs pyim-candidates pyim-process-run-async-timer pyim-autoselector this-command pyim-candidates-last pyim-scheme-name nil pyim-entered-get point-before pyim-imobjs-create delete-dups pyim-candidates-create pyim-process-run-async-timer-reset run-with-timer 1 #[0 "\300\301!\203 \301\302\303\"\207\302 \207" [functionp make-thread pyim-process-run-with-thread "pyim-process-run-with-thread"] 3] mapcar #[257 "\300!\205\3011\211 0\207\210\302\207" [functionp (error) nil] 3 "\n\n(fn X)"] cl-remove-duplicates :from-end t pyim-process-self-insert-command-p cl-find-if make-byte-code 257 "\300\240\210\301\302\"\303\232\207" vconcat vector [plist-get :select last] 4 "\n\n(fn X)" plist-get :replace-with pyim-process-outcome-handle candidate pyim-add-unread-command-events point-after pyim-process-terminate [plist-get :select current] pyim-preview-refresh pyim-page-refresh last-command-event pyim-candidate-position] 11 (#$ . 6300)]) #@64 测试 CMD 是否是一个 pyim self insert command. (fn CMD) (defalias 'pyim-process-self-insert-command-p #[257 "\211\235\207" [pyim-process-self-insert-commands] 3 (#$ . 7928)]) #@49 Function used by `pyim-process-run-async-timer' (defalias 'pyim-process-run-with-thread #[0 "\303 \304\305\306#!\211\205#\211\307 \210\n\310\235\205#\311 \312 =?\205#\313 \207" [pyim-imobjs pyim-candidates pyim-page-tooltip pyim-scheme-name delete-dups pyim-candidates-create t pyim-preview-refresh (posframe minibuffer) selected-window minibuffer-window pyim-page-refresh] 6 (#$ . 8117)]) #@39 Reset `pyim-process-run-async-timer'. (defalias 'pyim-process-run-async-timer-reset #[0 "\205 \301!\210\302\211\207" [pyim-process-run-async-timer cancel-timer nil] 2 (#$ . 8519)]) (defalias 'pyim-process-get-candidates #[0 "\207" [pyim-candidates] 1]) #@10 (fn N) (defalias 'pyim-process-set-candidate-position #[257 "\211\211\207" [pyim-candidate-position] 3 (#$ . 8783)]) (defalias 'pyim-process-get-imobjs #[0 "\207" [pyim-imobjs] 1]) #@54 PYIM 流程的输出 (fn &optional N MAGIC-CONVERT) (defalias 'pyim-process-get-outcome #[512 "\211\203\n\300\301!!\207\301!\207" [pyim-magic-convert pyim-outcome-get] 5 (#$ . 8974)]) #@91 依照 TYPE, 获取 pyim 的 outcome,并将其加入 `pyim-outcome-history'. (fn TYPE) (defalias 'pyim-process-outcome-handle #[257 "\204 \305 \210\306\307\310!\207\211\311\232\203\306\211\207\211\312=\203(\313 \314\n!P B\211\207\211\315=\203=\316 S\f8!\313 P B\211\207\211\317=\203U\316 S\f8!\313 \314\n!Q B\211\207\211\320=\203c\321\322! B\211\207\307\323!\207" [enable-multibyte-characters pyim-outcome-history last-command-event pyim-candidate-position pyim-candidates pyim-entered-erase-buffer nil error "Can't input characters in current unibyte buffer" "" last-char pyim-outcome-get pyim-process-outcome-handle-char candidate pyim-candidate-parse candidate-and-last-char pyim-entered pyim-entered-get point-before "Pyim: invalid outcome"] 6 (#$ . 9168)]) #@339 Pyim 字符转换函数,主要用于处理标点符号. pyim 在运行过程中调用这个函数来进行标点符号格式的转换。 常用的标点符号数量不多,所以 pyim 没有使用文件而是使用一个变量 `pyim-punctuation-dict' 来设置标点符号对应表,这个变量是一个 alist 列表。 (fn CHAR) (defalias 'pyim-process-outcome-handle-char #[257 "\304!\305\306!\305\307!\305\310!\311\"\312\313\314\315\316\317 !\320\"\321\322%\"\323\324\325$\326 \327W\2033\330\202`Sf\331=\203a\332\333\"\203a\332\334\"\203a\232\203a\335\336!\210\337\340!!\210\330\202`Sf\341\342\343\"\235\203\212\332\334\"\203\212\232\203\212\335\344!\210\345\340!!\210\330\202\247\204\253\332\334\"\203\253\232\203\253\346 !\203\253 \210\330\202\347 \204\265\202`Sf\n\235\203\302\202\312\313\314\350\316\317!\351\"\321\322% \"\203\332\202\247\203\364\306U\203\364\232\203\364\352\353!\210\330\202\247\203\306V\203\232\203\352\354!\210\330\202\203\355!\202\207" [pyim-punctuation-dict pyim-outcome-trigger-function pyim-punctuation-escape-list pyim-punctuation-half-width-functions char-to-string pyim-char-before-to-string 0 1 2 assoc cl-some make-byte-code 257 "\300\235\205\211\207" vconcat vector [] 3 "\n\n(fn X)" cl-position :test equal pyim-outcome-get-trigger 32 "" 45 pyim-string-match-p "[0-9]" "\\cc" delete-char -2 pyim-delete-word-at-point string-to-number number-sequence 50 57 -1 pyim-create-word-at-point functionp pyim-process-punctuation-full-width-p "\301!\205 \211\300!\207" [functionp] pyim-punctuation-translate full-width half-width pyim-punctuation-return-proper-punct] 16 (#$ . 9956)]) #@632 判断是否需要切换到全角标点输入模式 输入标点的样式的改变(全角或者半角)受三个方面影响: 1. 用户是否手动切换了标点样式? 2 用户是否手动切换到英文输入模式? 3. pyim 是否根据环境自动切换到英文输入模式? 三方面的综合结果为: 只要当前的输入模式是英文输入模式,那么输入的 标点符号 *必定* 是半角标点,如果当前输入模式是中文输入模式,那么, 输入标点的样式用户可以使用 `pyim-punctuation-toggle'手动控制,具 体请参考 `pyim-process-punctuation-full-width-p'。 (defalias 'pyim-process-punctuation-full-width-p #[0 "@\302\303\"\203 \304\202'\302\305\"\203\306\202'\302\307\"\205' ?\205'\310 ?\207" [pyim-punctuation-translate-p pyim-process-input-ascii eql yes t no nil auto pyim-process-auto-switch-english-input-p] 4 (#$ . 11689)]) #@41 创建 `pyim-cstring-to-code-criteria'. (defalias 'pyim-process-create-code-criteria #[0 "\301\302\303\304 @\305 \"\306#GGV\203\202\211\262\211\207" [pyim-cstring-to-code-criteria mapconcat identity pyim-codes-create pyim-process-get-imobjs pyim-scheme-name ""] 5 (#$ . 12609)]) #@760 将中文词条 WORD 添加编码后,保存到用户选择过的词生成的缓存中。 词条 WORD 默认会追加到已有词条的后面,如果 PREPEND 设置为 t, 词条就会放到已有词条的最前面。 这是函数会调用 `pyim-cstring-to-codes' 来获取中文词条对应的编码。 WORDCOUNT-HANDLER 可以是一个数字,代表将此数字设置为 WORD 的新词频, WORDCOUNT-HANDLER 也可以是一个函数,其返回值将设置为 WORD 的新词频, 而这个函数的参数则表示 WORD 当前词频,这个功能用于:`pyim-dcache-import', 如果 WORDCOUNT-HANDLER 设置为其他, 则表示让 WORD 当前词频加1. BUG:拼音无法有效地处理多音字。 (fn WORD &optional PREPEND WORDCOUNT-HANDLER) (defalias 'pyim-process-create-word #[769 "G\302V\205lG\303W\205l\304\305\"?\205l\306 \307\310\"\311 #G\302V\2033\312#\210\211\211\203V\211@\304\313\"\204O\314\206I\315P #\210A\266\202\2024\210\316\317\320\321\322\323 \"\324\"\325\326%\327#\266\203\207" [pyim-process-last-created-word pyim-cstring-to-code-criteria 0 11 pyim-string-match-p "\\CC" pyim-scheme-name pyim-scheme-get-option :code-prefix pyim-cstring-to-codes pyim-dcache-update-iword2count "[^ a-z-]" pyim-dcache-insert-icode2word #1="" mapconcat make-byte-code 257 "\302\303\301\206\304P\300#\207" vconcat vector [format "%s -> %s" #1#] 5 "\n\n(fn CODE)" "; "] 14 (#$ . 12904)]) #@13 (fn WORD) (defalias 'pyim-process-delete-word #[257 "\300!\207" [pyim-dcache-delete-word] 3 (#$ . 14350)]) (defalias 'pyim-process-cleanup-input-output #[0 "\300 \210\301\302!\207" [pyim-entered-erase-buffer pyim-process-outcome-handle ""] 2]) (defalias 'pyim-terminate-translation 'pyim-process-terminate) #@47 Terminate the translation of the current key. (defalias 'pyim-process-terminate #[0 "\305\306 \210\305\211\305\307 \210\310 \210\305\311 \210\312\313 \314\"\315\316\317\"!\315\316\320\"!\2036\321!\2036 \202F\203E\321!\203E \202F\305\207" [pyim-process-translating pyim-process-force-input-chinese pyim-candidates pyim-candidates-last pyim-cstring-to-code-criteria nil pyim-entered-erase-buffer pyim-preview-delete-string pyim-page-hide pyim-process-run-async-timer-reset pyim-scheme-get-option pyim-scheme-name :class intern format "pyim-process-terminate:%S" "pyim-terminate-translation:%S" functionp] 7 (#$ . 14666)]) (provide 'pyim-process)