Newer
Older
* COMMENT -*- mode: org -*-
#+Date: 2019-10-08
#+STARTUP: content
* notes :entry:
** 2019-04-01 zero-el a Chinese IM framework in emacs; FSM :doc:
title was: how to write a modern im for emacs.
cd ~/lisp/elisp/zero/
- DONE can I implement it as a minor mode? yes.
- DONE can I use panel to show candidates? yes.
- zero minor mode FSM
| Imp | state | action | next state | trigger action |
|-----+------------------+-----------------------------------------------------+------------------+---------------------------------------------------------------------------------------------------------|
| Y | IM_OFF | M-x zero-input-on or zero-input-toggle | IM_WAITING_INPUT | turn on minor mode |
| Y | IM_WAITING_INPUT | type M-x zero-input-off or zero-input-toggle | IM_OFF | turn off minor mode |
| Y | IM_WAITING_INPUT | type character that can start a sequence | IM_PREEDITING | update preedit str, show candidate list |
| Y | IM_WAITING_INPUT | type character that can not start a sequence | IM_WAITING_INPUT | insert character (full-width aware) |
| Y | IM_WAITING_INPUT | type [,.?!\] | IM_WAITING_INPUT | insert Chinese punctuation character (full-width aware) |
| Y | IM_PREEDITING | type character (that is not SPC, digit keys) | IM_PREEDITING | update preedit str, update and show candidate list |
| Y | IM_PREEDITING | type RET | IM_WAITING_INPUT | commit preedit str (full-width aware), hide candidate list, reset preedit str |
| Y | IM_PREEDITING | type SPC | IM_WAITING_INPUT | commit first candidate or preedit str (full-width aware), reset preedit str |
| Y | IM_PREEDITING | type digit keys | IM_WAITING_INPUT | commit nth candidate if it exists, otherwise, append to preedit str |
| | IM_PREEDITING | type C-g | IM_WAITING_INPUT | reset IM (reset preedit str, hide candidate list) |
| Y | IM_PREEDITING | type M-x zero-input-off or zero-input-toggle | IM_OFF | reset IM, turn off minor mode |
| Y | IM_PREEDITING | type <backspace>, when preedit str is longer than 1 | IM_PREEDITING | update preedit str, update and show candidate list |
| Y | IM_PREEDITING | type <backspace>, when preedit str is length 1 | IM_WAITING_INPUT | reset IM |
| Y | IM_PREEDITING | focus in | IM_PREEDITING | show candidat list |
| Y | IM_PREEDITING | focus out | IM_PREEDITING | hide panel |
| Y | IM_PREEDITING | type [,.?!\] | IM_WAITING_INPUT | commit first candidate or preedit str (full-width aware), insert Chinese punctuation (full-width aware) |
| Y | IM_PREEDITING | type -/= | IM_PREEDITING | candiate page up/down |
| | | | | |
in IM_OFF state, zero should not do any preedit try nor do punctuation
translate.
- DONE make zero-input-quickdial IM work in emacs.
see ~/lisp/elisp/zero/zero-input-quickdial.el
- DONE make zero-input-table IM work in emacs. with zero-input-panel.
see ~/lisp/elisp/zero/zero-input-table.el
- during development, press F8 to byte-compile and load the current el file.
this will also look for errors in the file.
press F9 to run ert tests.
- TODOs
- whenever a command moves point, IM should probably reset()
I can't remap every possible key/function.
- I need hook for buffer/window focus in/out.
currently, when user switch to another buffer, the panel will still show.
user can click mouse in another emacs window.
whenever focus is moved outside current buffer, I need a hook to run
how to reproduce the problem
=============================
open emacs, split, top window show buffer with file t3, bottom window show
buffer with file t4.
in t3 buffer, press F1 to toggle zero on. type "a", candidate list will
show. now press C-x o to switch to t4 buffer. candidate list didn't go
away. because I can't find a hook for it.
the mouse case:
=================
open emacs, split, top window show buffer with file t3, bottom window show
buffer with file t4.
in t3 buffer, press F1 to toggle zero on. type "a", candidate list will
show. now click mouse on t4 buffer. candidate list didn't go away. because
I can't find a hook for it.
- how to check whether string contains character?
without converting char to string.
(zero-input-table-can-start-sequence) can use this.
** 2020-02-04 how to make a release? :doc:
- update version number in zero-input-framework.el
- run tests
make check
- build a release .el file
make dist
- check & fix styling issues
open zero-input.el file
M-x checkdoc
M-x package-lint-current-buffer
- test zero-input.el in a fresh emacs -Q window.
(load-file "~/.emacs.d/elpa/s-1.11.0/s.elc")
(byte-compile-file "~/lisp/elisp/zero/zero-input.el" t)
(global-set-key (kbd "<f1>") 'zero-input-mode)
(zero-input-set-default-im "pinyin")
now in some buffer,
press F1 and start typing.
- make a git commit in master branch.
- copy zero-input.el over to pkg branch.
make a git commit in pkg branch.
tag it if it is a stable release.
- push commits.
push tags if it is a stable release.
** 2019-10-10 documents
- Using of D-Bus
https://www.gnu.org/software/emacs/manual/html_mono/dbus.html
- Travis CI
The Ubuntu 18.04 Build Environment - Travis CI
https://docs.travis-ci.com/user/reference/bionic/
Installing Dependencies - Travis CI
https://docs.travis-ci.com/user/installing-dependencies
Customizing the Build - Travis CI
https://docs.travis-ci.com/user/customizing-the-build#build-matrix
Testing Your Project on Multiple Operating Systems - Travis CI
https://docs.travis-ci.com/user/multi-os/
** 2023-08-16 architecture :arch:doc:
see https://blog.emacsos.com/zero-el.html#org8e45833
#+BEGIN_SRC text
emacs zero-input-mode
|
|
zero-input-pinyin
/\
/ \
/ \
/ \
dbus / \ dbus
/ \
/ \
/ \
/ \
zero-pinyin-service zero-panel
#+END_SRC
* later :entry:
* current :entry:
**
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
** 2023-08-16 create a panel using emacs facility.
make it work in terminal emacs.
- yasnippet when select snippet can show a dropdown list.
- check the arch. how is dbus message sent to different component?
zero-input call zero-panel service directly from emacs lisp code.
so I only need to register a new service and select which service to publish
message to. this is not as flexible.
try this instead:
still use the same service name and spec.
in emacs lisp, allow user to stop (kill) existing service and choose which
panel service to start.
worry about this later. first make it work in terminal emacs.
- create a zero-panel service in raw emacs.
~/.emacs.d/site-lisp/yasnippet/dropdown-list.el
According to Jaeyoun Chung, "overlay code stolen from company-mode.el."
search: emacs lisp which overlay drop down menu to use?
which one does pyim use?
GitHub - tumashu/pyim: 一个 emacs 中文输入法,支持全拼,双拼,五笔,仓颉和Rime,pyim 是 GNU elpa 包。
https://github.com/tumashu/pyim
GNU ELPA - pyim
https://elpa.gnu.org/packages/pyim.html
让选词框跟随光标
https://github.com/tumashu/pyim#%E8%AE%A9%E9%80%89%E8%AF%8D%E6%A1%86%E8%B7%9F%E9%9A%8F%E5%85%89%E6%A0%87
overlay solutions to show candidates
- popup
(require 'popup)
GitHub - auto-complete/popup-el: Visual Popup Interface Library for Emacs
https://github.com/auto-complete/popup-el
popup is in melpa.
last release is 20221231.1634
- popon
(require 'popon)
akib/emacs-popon: "Pop" floating text "on" a window - emacs-popon - Codeberg.org
https://codeberg.org/akib/emacs-popon
It is not on GNU elpa or melpa. out.
- posframe
(require 'posframe)
Loading full blame...