Skip to content
operational 44.2 KiB
Newer Older
* COMMENT -*- mode: org -*-
#+Date: 2019-10-08
Time-stamp: <2020-02-23>
#+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
  implemented in zero.el
  | 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
    zero-input-focus-out.

    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
Yuanle Song's avatar
Yuanle Song committed
- update ./ChangeLog, add user visible changes
- 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
Yuanle Song's avatar
Yuanle Song committed
- 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")
Yuanle Song's avatar
Yuanle Song committed

  now in some buffer,
  press F1 and start typing.

- make a git commit in master branch.
- copy zero-input.el over to pkg branch.
Yuanle Song's avatar
Yuanle Song committed
  cp zero-input.el ../zero-pkg/

Yuanle Song's avatar
Yuanle Song committed
  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
Yuanle Song's avatar
Yuanle Song committed
- 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
Yuanle Song's avatar
Yuanle Song committed
  Testing Your Project on Multiple Operating Systems - Travis CI
  https://docs.travis-ci.com/user/multi-os/

* later                                                               :entry:
* current                                                             :entry:
** 
** 2020-02-23 support typing ±, ≥, ≤ easier.
when user type +-, it is converted to ±.
use a flag to control conversion.
zero-input-auto-symbol-p default value is 'FULL, means only enable when
punctuation mode is 'FULL. if set to t, always convert char to symbol. if set
to nil, never convert char to symbol.

Non-nil means auto convert some consective character to related symbol.

#+BEGIN_SRC elisp
  (defcustom zero-input-auto-symbol-alist
    '(((?+ ?-) "±")
      ((?> ?=) "≥")
      ((?< ?=) "≤")
      ((?* ?x) "×")
      ((?< ?>) "≠")
      ((?! ?=) "≠"))
    "When user type chars in key, convert it to symbol in the value."
    :group 'zero-input
    :type 'TODO)
#+END_SRC
((?* ?x) "×") this one is different. x will be preedit str.
it's better if this is wrapped in a new mode.
like v mode used in some IM.
type v > = will show ≥ in candidate list.

- rethink about it later.

Yuanle Song's avatar
Yuanle Song committed
** 2020-02-21 zero-pinyin-service and zero-panel should recommend or suggest dbus pkg.
I don't know it should recommend or suggest.
** 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:
Yuanle Song's avatar
Yuanle Song committed
** 2020-02-21 org-mode, click badge should link to the pkg. not the image file.
need to drop ?branch=master
it works.
Yuanle Song's avatar
Yuanle Song committed
** 2020-02-20 integrate travis CI support.
just run "make dist-check".

- problems
  - how to run on both debian 9, 10 and ubuntu 18.04?

    The Ubuntu 18.04 Build Environment - Travis CI
    https://docs.travis-ci.com/user/reference/bionic/
    There is no debian image on Travis CI.

  - how to install s pkg when run on travis CI?
    if ~/.emacs.d/elpa/s-1.11.0/s.el doesn't exist, install s and load it first.

    how to use package-install with package-desc?

    (package-install "s")
    (package-install "s-1.12.0")

    search: (error "Package `s-' is unavailable")

    Package 's-' is unavailable · Issue #373 · cask/cask
    https://github.com/cask/cask/issues/373

    elisp - Emacs's package-install inserts an extra dash at the end of the package - Stack Overflow
    https://stackoverflow.com/questions/36338528/emacss-package-install-inserts-an-extra-dash-at-the-end-of-the-package
    wat?
    I don't think this is the problem. In my setup, melpa is not the first element.

    I will cheat. Just download the file from github when run on travis CI.
    https://github.com/magnars/s.el

  - how to run it on emacs24, emacs25, emacs26?
    emacs24-nox is on xenial 16.04
    emacs25-nox is on bionic 18.04
    emacs26 is not in ubuntu yet.

    How to Install GNU Emacs 26.1 in Ubuntu 18.04, 16.04, 18.10 | UbuntuHandbook
    http://ubuntuhandbook.org/index.php/2019/02/install-gnu-emacs-26-1-ubuntu-18-04-16-04-18-10/
    https://launchpad.net/~kelleyk/+archive/ubuntu/emacs
Loading full blame...