Skip to content
operational 43 KiB
Newer Older
* COMMENT -*- mode: org -*-
#+Date: 2019-10-08
Yuanle Song's avatar
Yuanle Song committed
Time-stamp: <2020-02-21>
#+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

* later                                                               :entry:
* current                                                             :entry:
** 
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-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
    sudo add-apt-repository ppa:kelleyk/emacs
    sudo apt update
    sudo apt install emacs26
    I will ignore emacs26 for now.

  - travis forces venv, doesn't allow install to user site-packages.

    https://docs.travis-ci.com/user/languages/python/
    to use --user you just need to not use "language: python".
    I will use language: python and fix the command.

  - DONE elisp tests need access to GetCandidatesV2 dbus method.
    zero-input-pinyin-service-get-candidates
    why?

    this is good. I can install the deb in travis container.

  - DONE emacs run ert test doesn't exit with non-zero code when there are errors.
    it needs a wrapper function.

    ert-run-tests-batch
    Returns the stats object.
    ert-run-tests-batch-and-exit
    nice.

  - travis: no access to session bus.
    how to start dbus session bus when x is not running?
    search: travis start dbus session bus

    Testing with PulseAudio server in Travis · Issue #20 · favonia/pulse
    https://github.com/favonia/pulse/issues/20

  - MOVED zero-pinyin-service and zero-panel should recommend or suggest dbus pkg.
Loading full blame...