Skip to content
Commits on Source (2)
  • Yuanle Song's avatar
    v2.6.0 allow customize punctuation mapping; · b146e072
    Yuanle Song authored
    - add bug report link in README
    - update intro doc for melpa
    - add melpa badge in README
    - add punctuation doc in README
    - other minor doc updates
    b146e072
  • Yuanle Song's avatar
    add support for Travis CI. · 39342748
    Yuanle Song authored
    - add .travis.yml
    - update Makefile to make it work with travis CI.
    - add requirements.txt file
    - bugfix: "make dist-check" should use ert-run-tests-batch-and-exit
    39342748
language: python
jobs:
include:
- os: linux
dist: xenial
env: EMACS=emacs24
- os: linux
dist: bionic
env: EMACS=emacs25
before_install:
- curl https://deb.emacsos.com/apt-pub.key | sudo apt-key add -
- echo 'deb http://deb.emacsos.com/ debian main' | sudo tee -a /etc/apt/sources.list
- sudo apt-get -q update
- sudo apt-get install -y $EMACS-nox make python3-pip dbus-x11 zero-pinyin-service
- mkdir -p ~/.emacs.d/elpa/s-1.11.0/
- wget -O ~/.emacs.d/elpa/s-1.11.0/s.el https://raw.githubusercontent.com/magnars/s.el/1.12.0/s.el
script: dbus-launch make dist-check EMACS=$EMACS
2020-02-20 Yuanle Song <root@emacsos.com>
zero-pinyin-service v1.10.0
- enable ue -> ve fuzzy by default. now lue -> lve -> 略。
zero-input v2.6.0
- allow customize Chinese punctuation mapping via M-x customize-variable
- add bug report link in README
- update intro doc for melpa
- add melpa badge in README
- add punctuation doc in README
2020-02-16 Yuanle Song <root@emacsos.com>
......@@ -11,6 +15,9 @@
- some variables declared using defcustom
- bugfix: use 'zero-input instead of 'zero as customize group name
zero-pinyin-service v1.10.0
- enable ue -> ve fuzzy by default. now lue -> lve -> 略。
2020-02-04 Yuanle Song <root@emacsos.com>
zero-input v2.2.1
......
VERSION := $(shell grep 'setq zero-input-version' zero-input-framework.el | cut -d'"' -f2)
EMACS := emacs
default: dist
#===============
# multiple file
#===============
check:
emacs -Q --batch -l zero-input-reload-all.el -f zero-input-rebuild -l zero-input-table.el -l zero-input-table-test.el -f ert-run-tests-batch
$(EMACS) -Q --batch -l zero-input-reload-all.el -f zero-input-rebuild -l zero-input-table.el -l zero-input-table-test.el -f ert-run-tests-batch
zip:
git archive -o zero-input-el-$(VERSION).zip --prefix=zero-input/ HEAD
#==========================
......@@ -13,15 +14,15 @@ zip:
#==========================
dist: dist-check
build:
if [ ! -x ~/.local/bin/pytest ]; then python3 -m pip install --user pytest; fi
if [ ! python3 -m pytest --version ]; then python3 -m pip install --user pytest; fi
python3 -m pytest build.py
./build.py
sed -i "s/PKG_VERSION/$(VERSION)/g" zero-input.el
dist-check: build
@echo "testing byte-compile is clean..."
emacs -Q --batch -l ~/.emacs.d/elpa/s-1.11.0/s.el --eval='(byte-compile-file "zero-input.el")'
$(EMACS) -Q --batch -l ~/.emacs.d/elpa/s-1.11.0/s.el --eval='(byte-compile-file "zero-input.el")'
@echo "running unit tests..."
emacs -Q --batch -l ~/.emacs.d/elpa/s-1.11.0/s.el -l zero-input.el -l zero-input-panel-test.el -l zero-input-pinyin-service-test.el -l zero-input-framework-test.el -l zero-input-pinyin-test.el -l zero-input-table.el -l zero-input-table-test.el -f ert-run-tests-batch
$(EMACS) -Q --batch -l ~/.emacs.d/elpa/s-1.11.0/s.el -l zero-input.el -l zero-input-panel-test.el -l zero-input-pinyin-service-test.el -l zero-input-framework-test.el -l zero-input-pinyin-test.el -l zero-input-table.el -l zero-input-table-test.el -f ert-run-tests-batch-and-exit
#====================
# other make targets
#====================
......
zero-el
Copyright (C) 2019 Yuanle Song <sylecn@gmail.com>
Copyright (C) 2019, 2020 Yuanle Song <sylecn@gmail.com>
zero-input--ibus-compute-pixel-position function in zero-input.el is copied
from ibus.el. This function is under GPLv3 license. Copyright (C) 2010-2012
......
......@@ -34,6 +34,32 @@ M-x customize-group zero-input-pinyin
- Use ' to separate pinyin substring like xi'an 西安
* Zero Framework features
- Chinese punctuation mapping. Type the char will insert the corresponding
Chinese punctuation when zero-input-punctuation-level is basic or full.
| char | punctuation |
|---------+-------------|
| =basic= | |
| , | , |
| . | 。 |
| ? | ? |
| \! | ! |
| \ | 、 |
| : | : |
| =full= | |
| \_ | —— |
| < > | 《 》 |
| ( ) | ( ) |
| [ ] | 【 】 |
| \^ | …… |
| " " | “ ” |
| ' ' | ‘ ’ |
| ~ | ~ |
| ; | ; |
| \$ | ¥ |
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
......@@ -65,8 +91,8 @@ reporting issue easier.
- zero-input-framework.el
zero framework source code. This provides the framework and user interface
for zero-el.
zero input framework source code. This provides the framework and user
interface for zero-el.
- zero-input-panel.el
......@@ -78,7 +104,7 @@ reporting issue easier.
- zero-input-pinyin.el
Pinyin input method implemented using zero.el
Pinyin input method implemented using zero-input-framework.el
- zero-input-quickdial.el
......
* COMMENT -*- mode: org -*-
#+Date: 2019-10-08
Time-stamp: <2020-02-20>
Time-stamp: <2020-02-21>
#+STARTUP: content
* notes :entry:
** 2019-04-01 zero-el a Chinese IM framework in emacs; FSM :doc:
......@@ -92,7 +92,7 @@ cd ~/lisp/elisp/zero/
(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)
(zero-input-set-default-im "pinyin")
now in some buffer,
press F1 and start typing.
......@@ -110,20 +110,111 @@ cd ~/lisp/elisp/zero/
** 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
* later :entry:
* current :entry:
**
** 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:
** 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.
I don't know it should recommend or suggest.
- travis CI test works. great. integrate to master branch.
** 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
- update README, add bug report doc.
-
** 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:
** 2019-11-03 add completion support for zero-input-set-im
complete registered im symbols.
......@@ -868,6 +959,18 @@ https://github.com/melpa/melpa/blob/master/CONTRIBUTING.org#preparing-a-pull-req
fixed.
* wontfix :entry:
** 2020-02-20 gitlab doesn't render README as org-mode file.
github does render it.
should I name it README.org?
- does gitlab newer version support parsing mode line?
search: gitlab parse mode line from README file
search: gitlab render README file without suffix
gitlab only support markdown, ascii doc and rst. org-mode is not supported.
add .org suffix won't help gitlab.
Either keep it or rewrite it as markdown or rst.
I will keep it.
** 2020-02-04 zero-input-pinyin-pending-preedit-str="erduo" not correct?
- zero-input-pinyin-pending-preedit-str="erduo"
......
......@@ -133,7 +133,7 @@ If item is not in lst, return nil."
;; zero-input-el version
(defvar zero-input-version nil "Zero package version.")
(setq zero-input-version "2.5.0")
(setq zero-input-version "2.6.0")
;; FSM state
(defconst zero-input--state-im-off 'IM-OFF)
......@@ -168,6 +168,35 @@ independent from punctuation map. You can change this via
:safe t
:type 'boolean)
(make-variable-buffer-local 'zero-input-full-width-p)
(defcustom zero-input-punctuation-basic-map
'((?, ",")
(?, ",")
(?. "。") ; 0x3002
(?? "?")
(?! "!")
(?\\ "、") ; 0x3001
(?: ":"))
"Punctuation map used when `zero-input-punctuation-level' is not 'NONE."
:group 'zero-input
:type '(alist :key-type character :value-type (group string)))
(defcustom zero-input-punctuation-full-map
'((?_ "——")
(?< "《") ;0x300A
(?> "》") ;0x300B
(?\( "(")
(?\) ")")
(?\[ "【") ;0x3010
(?\] "】") ;0x3011
(?^ "……")
(?~ "~")
(?\; ";")
(?$ "¥"))
"Additional punctuation map used when `zero-input-punctuation-level' is 'FULL."
:group 'zero-input
:type '(alist :key-type character :value-type (group string)))
(defcustom zero-input-punctuation-level zero-input-punctuation-level-basic
"Default punctuation level.
......@@ -422,36 +451,19 @@ If there is no full-width char for CH, return it unchanged."
"Convert punctuation for `zero-input-punctuation-level-basic'.
Return CH's Chinese punctuation if CH is converted. Return nil otherwise."
(cl-case ch
(?, ",")
(?. "。") ; 0x3002
(?? "?")
(?! "!")
(?\\ "、") ; 0x3001
(?: ":")
(otherwise nil)))
(cadr (assq ch zero-input-punctuation-basic-map)))
(defun zero-input-convert-punctuation-full (ch)
"Convert punctuation for `zero-input-punctuation-level-full'.
Return CH's Chinese punctuation if CH is converted. Return nil otherwise"
(cl-case ch
(?_ "——")
(?< "《") ;0x300A
(?> "》") ;0x300B
(?\( "(")
(?\) ")")
(?\[ "【") ;0x3010
(?\] "】") ;0x3011
(?^ "……")
(?\" (setq zero-input-double-quote-flag (not zero-input-double-quote-flag))
(if zero-input-double-quote-flag "“" "”"))
(?\' (setq zero-input-single-quote-flag (not zero-input-single-quote-flag))
(if zero-input-single-quote-flag "‘" "’"))
(?~ "~")
(?\; ";")
(?$ "¥")
(t (zero-input-convert-punctuation-basic ch))))
(t (or (cadr (assq ch zero-input-punctuation-full-map))
(zero-input-convert-punctuation-basic ch)))))
(defun zero-input-convert-punctuation (ch)
"Convert punctuation based on `zero-input-punctuation-level'.
......@@ -867,7 +879,7 @@ IM-NAME (a string) should be a registered input method in zero-input."
(error "Input method name is required")
(zero-input-set-im im-name-str))))
((symbolp im-name)
;; for backward compatibility
;; symbol is allowed for backward compatibility.
(zero-input-set-im (symbol-name im-name)))
(t (let* ((im-slot (assoc im-name zero-input-ims))
(im-functions (cdr im-slot)))
......@@ -914,9 +926,13 @@ IM-NAME (a string) should be a registered input method in zero-input."
;;;###autoload
(defun zero-input-set-default-im (im-name)
"Set given IM-NAME as default zero input method."
(unless (symbolp im-name)
(signal 'wrong-type-argument (list 'symbolp im-name)))
(setq-default zero-input-im im-name))
;; symbol is allowed for backward compatibility.
(unless (or (stringp im-name) (symbolp im-name))
(signal 'wrong-type-argument (list 'string-or-symbolp im-name)))
(let ((im-name-str (if (symbolp im-name) (symbol-name im-name) im-name)))
(setq-default zero-input-im im-name-str)
(unless (assoc im-name-str zero-input-ims)
(warn "Input method %s is not registered with zero-input" im-name-str))))
;;;###autoload
(defun zero-input-on ()
......
......@@ -12,7 +12,7 @@
;; See the License for the specific language governing permissions and
;; limitations under the License.
;; Version: 2.5.0
;; Version: 2.6.0
;; URL: https://gitlab.emacsos.com/sylecn/zero-el
;; Package-Requires: ((emacs "24.3") (s "1.2.0"))
......@@ -30,7 +30,7 @@
;; ;; switch on/off the input method.
;; (global-set-key (kbd "<f5>") 'zero-input-mode)
;;
;; Now in any emacs buffer, you may press F5 and start typing pinyin string.
;; Now in any Emacs buffer, you may press F5 and start typing pinyin string.
;;
;; zero-input supports Chinese punctuation mapping. There are three modes,
;; none, basic, and full. The default is basic mode, which only map most
......@@ -48,9 +48,9 @@
;; For other features, you may check README file at
;; https://gitlab.emacsos.com/sylecn/zero-el/
;;
;; zero-input.el is auto-generated from multiple other files. see
;; zero-input.el is auto-generated from multiple other files. See
;; zero-input.el.in and build.py for details. It's created because
;; package-lint doesn't support multi-file package yet. See issue #111 at
;; package-lint doesn't support multi-file package yet. See issue #111 at
;; https://github.com/purcell/package-lint/issues/111
;;; Code:
......@@ -251,7 +251,7 @@ If item is not in lst, return nil."
;; zero-input-el version
(defvar zero-input-version nil "Zero package version.")
(setq zero-input-version "2.5.0")
(setq zero-input-version "2.6.0")
;; FSM state
(defconst zero-input--state-im-off 'IM-OFF)
......@@ -286,6 +286,35 @@ independent from punctuation map. You can change this via
:safe t
:type 'boolean)
(make-variable-buffer-local 'zero-input-full-width-p)
(defcustom zero-input-punctuation-basic-map
'((?, ",")
(?, ",")
(?. "。") ; 0x3002
(?? "?")
(?! "!")
(?\\ "、") ; 0x3001
(?: ":"))
"Punctuation map used when `zero-input-punctuation-level' is not 'NONE."
:group 'zero-input
:type '(alist :key-type character :value-type (group string)))
(defcustom zero-input-punctuation-full-map
'((?_ "——")
(?< "《") ;0x300A
(?> "》") ;0x300B
(?\( "(")
(?\) ")")
(?\[ "【") ;0x3010
(?\] "】") ;0x3011
(?^ "……")
(?~ "~")
(?\; ";")
(?$ "¥"))
"Additional punctuation map used when `zero-input-punctuation-level' is 'FULL."
:group 'zero-input
:type '(alist :key-type character :value-type (group string)))
(defcustom zero-input-punctuation-level zero-input-punctuation-level-basic
"Default punctuation level.
......@@ -540,36 +569,19 @@ If there is no full-width char for CH, return it unchanged."
"Convert punctuation for `zero-input-punctuation-level-basic'.
Return CH's Chinese punctuation if CH is converted. Return nil otherwise."
(cl-case ch
(?, ",")
(?. "。") ; 0x3002
(?? "?")
(?! "!")
(?\\ "、") ; 0x3001
(?: ":")
(otherwise nil)))
(cadr (assq ch zero-input-punctuation-basic-map)))
(defun zero-input-convert-punctuation-full (ch)
"Convert punctuation for `zero-input-punctuation-level-full'.
Return CH's Chinese punctuation if CH is converted. Return nil otherwise"
(cl-case ch
(?_ "——")
(?< "《") ;0x300A
(?> "》") ;0x300B
(?\( "(")
(?\) ")")
(?\[ "【") ;0x3010
(?\] "】") ;0x3011
(?^ "……")
(?\" (setq zero-input-double-quote-flag (not zero-input-double-quote-flag))
(if zero-input-double-quote-flag "“" "”"))
(?\' (setq zero-input-single-quote-flag (not zero-input-single-quote-flag))
(if zero-input-single-quote-flag "‘" "’"))
(?~ "~")
(?\; ";")
(?$ "¥")
(t (zero-input-convert-punctuation-basic ch))))
(t (or (cadr (assq ch zero-input-punctuation-full-map))
(zero-input-convert-punctuation-basic ch)))))
(defun zero-input-convert-punctuation (ch)
"Convert punctuation based on `zero-input-punctuation-level'.
......@@ -985,7 +997,7 @@ IM-NAME (a string) should be a registered input method in zero-input."
(error "Input method name is required")
(zero-input-set-im im-name-str))))
((symbolp im-name)
;; for backward compatibility
;; symbol is allowed for backward compatibility.
(zero-input-set-im (symbol-name im-name)))
(t (let* ((im-slot (assoc im-name zero-input-ims))
(im-functions (cdr im-slot)))
......@@ -1032,9 +1044,13 @@ IM-NAME (a string) should be a registered input method in zero-input."
;;;###autoload
(defun zero-input-set-default-im (im-name)
"Set given IM-NAME as default zero input method."
(unless (symbolp im-name)
(signal 'wrong-type-argument (list 'symbolp im-name)))
(setq-default zero-input-im im-name))
;; symbol is allowed for backward compatibility.
(unless (or (stringp im-name) (symbolp im-name))
(signal 'wrong-type-argument (list 'string-or-symbolp im-name)))
(let ((im-name-str (if (symbolp im-name) (symbol-name im-name) im-name)))
(setq-default zero-input-im im-name-str)
(unless (assoc im-name-str zero-input-ims)
(warn "Input method %s is not registered with zero-input" im-name-str))))
;;;###autoload
(defun zero-input-on ()
......
......@@ -30,7 +30,7 @@
;; ;; switch on/off the input method.
;; (global-set-key (kbd "<f5>") 'zero-input-mode)
;;
;; Now in any emacs buffer, you may press F5 and start typing pinyin string.
;; Now in any Emacs buffer, you may press F5 and start typing pinyin string.
;;
;; zero-input supports Chinese punctuation mapping. There are three modes,
;; none, basic, and full. The default is basic mode, which only map most
......@@ -48,9 +48,9 @@
;; For other features, you may check README file at
;; https://gitlab.emacsos.com/sylecn/zero-el/
;;
;; zero-input.el is auto-generated from multiple other files. see
;; zero-input.el is auto-generated from multiple other files. See
;; zero-input.el.in and build.py for details. It's created because
;; package-lint doesn't support multi-file package yet. See issue #111 at
;; package-lint doesn't support multi-file package yet. See issue #111 at
;; https://github.com/purcell/package-lint/issues/111
;;; Code:
......