Skip to content
README 6.06 KiB
Newer Older
* COMMENT -*- mode: org -*-
#+Date: 2019-09-01
Time-stamp: <2024-05-26>

* zero-el

Yuanle Song's avatar
Yuanle Song committed
[[http://www.melpa.org/#/zero-input][file:http://www.melpa.org/packages/zero-input-badge.svg]]
[[https://stable.melpa.org/#/zero-input][file:https://stable.melpa.org/packages/zero-input-badge.svg]]
Yuanle Song's avatar
Yuanle Song committed
[[https://travis-ci.org/sylecn/zero-el][file:https://travis-ci.org/sylecn/zero-el.svg]]
zero-el provides zero-input-pinyin, an Emacs pinyin input method for Chinese
and zero-input-framework, which is an emacs Chinese input method framework.
* An introduction to zero-el, including how to install and config zero-el.
https://blog.emacsos.com/zero-el.html

Yuanle Song's avatar
Yuanle Song committed
For user configurable variables, see
M-x customize-group zero-input
M-x customize-group zero-input-pinyin

* Zero Pinyin Usage
- Enable zero-input minor mode in emacs buffer.
  M-x zero-input-mode

  You should bind a global hotkey for this function for easier switch, e.g.
  (global-set-key (kbd "<f1>") 'zero-input-mode)

- Type pinyin string, for example, "zhongwen", zero will show candidates
  matches this pinyin string. You may choose first candidate by space. You may
  choose other candidates by digit keys. You may page down, page up by =/-
  key.

  Some notes on pinyin string,
Yuanle Song's avatar
Yuanle Song committed
  - There is no ü on US keyboard, type v instead. For example lv 绿.
  - Use ' to separate pinyin substring like xi'an 西安

- Which panel should I use?

  There are three panels for zero-input right now. zero-input panel are based
  on dbus service, so it is easy to implement and easy to plug-and-play.

  zero-panel is a gtk3 app implemented in C to show candidates. It has good
  performance and theme support. You can customize it using gtk ui files and
  css files. You can include images in the panel. But it didn't work in
  wayland at the moment, because positioning window on wayland is non-trivial.

  minibuffer panel, started by (zero-input-panel-minibuffer-init), is a native
  elisp program that use Emacs minibuffer to show candidates. It works
  everywhere Emacs runs, including ttys, X and Wayland.

  posframe panel, started by (zero-input-panel-posframe-init), is a native
  elisp program that uses [[https://github.com/tumashu/posframe][posframe]] to show candidates. It works in X and
  Wayland.

  You can choose whatever works for you. My recommendation would be

  - use zero-panel if mostly running Emacs in X.
  - use posframe panel if you ever run Emacs in Wayland.
  - use minibuffer panel if you are stuck on tty.

  Note that all three can be installed at the same time, but only one may be
  actively running. You can switch panel on the fly while Emacs is running.

  To switch to zero-panel (when zero-panel is installed),
  #+begin_src elisp
    (zero-input-panel-quit)
  #+end_src

  To switch to posframe panel,
  #+begin_src elisp
    (zero-input-panel-quit)
    (zero-input-panel-posframe-init)
  #+end_src

  To switch to minibuffer panel,
  #+begin_src elisp
    (zero-input-panel-quit)
    (zero-input-panel-minibuffer-init)
  #+end_src

* Zero Framework features
- Chinese punctuation mapping. Type the char will insert the corresponding
  Chinese punctuation when zero-input-punctuation-level is basic or full.

Yuanle Song's avatar
Yuanle Song committed
  | char    | punctuation    |
  |---------+----------------|
  | =basic= |                |
  | ,       | ,             |
  | .       | 。             |
  | ?       | ?             |
  | !       | !             |
  | \       | 、             |
  | :       | :             |
  | =full=  |                |
  | _       | ——             |
  | < >     | 《 》          |
  | ( )     | ( )          |
  | [ ]     | 【 】          |
  | ^       | ……             |
  | " "     | “ ”            |
  | ' '     | ‘ ’            |
  | ~       | ~             |
  | ;       | ;             |
  | $       | ¥             |
  | `       | · (middle dot) |

  You may customize punctuation mapping via
  zero-input-convert-punctuation-basic and zero-input-punctuation-full-map.
- Auto save user phrases. When you type a new phrase, it will be remembered in
  user phrase db.
- To delete system phrase or user phrase, type C-<digit> when candidate is
  shown in zero-panel.
- Auto convert Chinese period to dot for digits and English letter and digit
  mixed words. For example, to type "3.6" when zero-input-mode is on, type
  "3." will insert "3。", just continue type 6, it will be converted to
  "3.6". Same thing for "H。265" -> "H.265".
Yuanle Song's avatar
Yuanle Song committed
* Bug Report and Feature Request
Please report bugs at [[https://github.com/sylecn/zero-el/issues][github issues]]. Note that development (and melpa pkg)
still happens on gitlab repo. The github repo is an official mirror to make
reporting issue easier.

Yuanle Song's avatar
Yuanle Song committed
* Changelog
- see ./ChangeLog
- The change log include change log from all sub projects.
  - zero-input is the emacs lisp package that provide user interface for zero
    input method.
  - zero-pinyin-service offers pinyin service such as find candidates and
    saving user phrases. used by zero-pinyin.
  - zero-panel offers gtk panel to show candidates.

* File list
- zero-input.el
Yuanle Song's avatar
Yuanle Song committed

  It's a generated file for one-file package distribution. Not used for
  development.

- zero-input-framework.el
  zero input framework source code. This provides the framework and user
  interface for zero-el.
- zero-input-panel.el

  dbus client to zero-panel service.

- zero-input-pinyin-service.el

  dbus client to zero-pinyin-service.

- zero-input-pinyin.el
  Pinyin input method implemented using zero-input-framework.el
- zero-input-quickdial.el

  proof of concept of how to create an input method in emacs using minor mode.

- zero-input-reload-all.el

  zero-el development utility.

- zero-input-table.el
  serves as an example of how to use zero framework to create new input
- zero-input-panel-minibuffer.el

  a zero-panel dbus service implemented using Emacs minibuffer.

- zero-input-panel-posframe.el

  a zero-panel dbus service implemented using [[https://github.com/tumashu/posframe][posframe]] package.

* License
zero-el is under Apache License 2.0

zero-input--ibus-compute-pixel-position function in zero-input-framework.el is
under GPLv3. see NOTICE file.