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
* later :entry:
* current :entry:
**
** 2020-02-20 integrate travis CI support.
just run "make dist-check".
** 2019-10-23 checkdoc and package-lint can't ignore some non-issues.
I can't run them in git pre-commit hook.
* done :entry:
** 2020-02-20 add github issue system support.
- create issue templates online. then merge into master.
git remote add github git@github.com:sylecn/zero-el.git
git fetch github sylecn-patch-1
gco github/sylecn-patch-1 .github/
drop the feature branch on github
git push github :sylecn-patch-1
git push github :pkg
git push github :multi-file-pkg
135
136
137
138
139
140
141
142
143
144
145
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
** 2019-11-03 add completion support for zero-input-set-im
complete registered im symbols.
- 2020-02-16
Function: completing-read prompt collection &optional predicate
make sure non-interactively usage still works.
(zero-input-set-im 'pinyin)
- DONE allow input method name to be string.
to add backward compatibility, symbol is also supported.
symbol is auto converted to lower case string.
string is a better fit for names. it can include unicode strings easier.
- problems
- how to call completing-read when call interactively?
search: use completing-read with interactive function
just call the function when &optional arg is nil.
- (zero-input-set-im 'pinyin)
this doesn't allow input pinyin after switching to table and back。
if then else issue.
fixed.
- DONE when im name is string, alist eq comparison won't work.
change to string-equal based compare.
search: assq-delete-all but with string-equal
emacs - Elisp: How to delete an element from an association list with string key - Stack Overflow
https://stackoverflow.com/questions/9812393/elisp-how-to-delete-an-element-from-an-association-list-with-string-key
- (zero-input-set-im 'pinyin)
method not registered.
(assq im-name zero-input-ims)
(assoc im-name zero-input-ims)
- try switch to empty and back.
(zero-input-set-im 'pinyin)
(zero-input-set-im 'empty)
it works.
** 2020-02-16 declare zero-input-punctuation-level, zero-input-full-width-p using defcustom
use set-default to set the value.
set-default is the default setter. no problem.
- also for
zero-input-pinyin-fuzzy-flag
INVALID zero-input-auto-fix-dot-between-numbers, already via defcustom.
- problems
- search: defvar-local vs defcustom
just add
(make-variable-buffer-local 'zero-input-punctuation-level)
- DONE zero-input-pinyin-fuzzy-flag, why links in doctstring doesn't work?
use raw string there.
Loading full blame...