Commit ac77a883 authored by Yuanle Song's avatar Yuanle Song
Browse files

v1.2.3 added zero-pkg.el; more style fixes.

- merge lexical-binding line with file intro line
- allow capitalize zero in some docstring/error msg
- add "make pkg" this will create tar for package.el
parent a36514d8
......@@ -4,4 +4,8 @@ compile:
emacs -Q --batch -l zero-reload-all.el -f zero-rebuild -l zero-table.el -f ert-run-tests-batch
zip:
git archive -o zero-el-$(VERSION).zip --prefix=zero/ HEAD
.PHONY: zip compile
pkg:
echo "Creating tar for package.el distribution..."
git archive -o zero-$(VERSION).tar --prefix=zero/$(VERSION) HEAD
echo "Done"
.PHONY: compile zip pkg
* COMMENT -*- mode: org -*-
#+Date: 2019-10-08
Time-stamp: <2019-10-08>
Time-stamp: <2019-10-10>
#+STARTUP: content
* notes :entry:
** 2019-04-01 zero-framework.el a Chinese IM framework in emacs; FSM :doc:
......@@ -80,6 +80,59 @@ cd ~/lisp/elisp/zero/
* later :entry:
* current :entry:
**
** 2019-10-09 release zero-el on melpa
melpa/CONTRIBUTING.org at master · melpa/melpa · GitHub
https://github.com/melpa/melpa/blob/master/CONTRIBUTING.org
Making your package ready for inclusion
https://github.com/melpa/melpa/blob/master/CONTRIBUTING.org#making-your-package-ready-for-inclusion
Packaging Basics - GNU Emacs Lisp Reference Manual
https://www.gnu.org/software/emacs/manual/html_node/elisp/Packaging-Basics.html#Packaging-Basics
name: zero
version: 1.2.2
brief: a Chinese input method framework
long: zero is a Chinese input method framework for Emacs, implemented
as an Emacs minor mode. A zero-pinyin input method is included with zero
distribution.
dependencies: s
progress:
Preparing a pull request to MELPA
https://github.com/melpa/melpa/blob/master/CONTRIBUTING.org#preparing-a-pull-request-to-melpa
- problems
- should I create two pkg, one for zero-framework and one for zero-pinyin?
does melpa require two repo for this?
- minimum s version?
I only use s-contains-p s-join.
checked github
tag 1.2.0 already include these functions.
https://github.com/magnars/s.el/blob/1.2.0/s.el
- TODO Note that there is no way to control the order in which files are
byte-compiled.
- how to add autoload magic comments?
https://www.gnu.org/software/emacs/manual/html_node/elisp/Autoload.html
A magic autoload comment (often called an autoload cookie) consists of
‘;;;###autoload’, on a line by itself, just before the real definition of
the function in its autoloadable source file.
add this for some user commands.
zero-set-im
zero-set-default-im
zero-on
zero-toggle
- run package-lint
- Prefix function names with #’ (i.e., the special form function) instead of
just ’ (i.e., the special form quote) to tell the compiler this is a
function reference. E.g., (seq-filter #'evenp list).
I don't think this is necessary in my code.
-
* done :entry:
** 2019-10-08 support full-width characters and symbols.
全角 半角
......
;;; -*- lexical-binding: t -*-
;;; zero-framework.el --- zero Chinese input method framework
;;; zero-framework.el --- Zero Chinese input method framework -*- lexical-binding: t -*-
;; Licensed under the Apache License, Version 2.0 (the "License");
;; you may not use this file except in compliance with the License.
......@@ -139,8 +138,8 @@ If item is not in lst, return nil."
;;=====================
;; zero-el version
(defvar zero-version nil "zero-el package version.")
(setq zero-version "1.2.2")
(defvar zero-version nil "Zero-el package version.")
(setq zero-version "1.2.3")
;; FSM state
(defconst *zero-state-im-off* 'IM-OFF)
......@@ -774,6 +773,7 @@ LEVEL the level to set to."
(zero-cycle-list zero-punctuation-levels zero-punctuation-level))
(message "punctuation level set to %s" zero-punctuation-level))
;;;###autoload
(defun zero-set-im (im-name)
"Select zero input method for current buffer.
......@@ -835,12 +835,14 @@ if IM-NAME is nil, use default empty input method"
(setq zero-preedit-start-func nil)
(setq zero-preedit-end-func nil)))
;;;###autoload
(defun zero-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-im im-name))
;;;###autoload
(defun zero-on ()
"Turn on `zero-mode'."
(interactive)
......@@ -857,6 +859,7 @@ if IM-NAME is nil, use default empty input method"
(zero-reset)
(zero-set-state *zero-state-im-off*))
;;;###autoload
(defun zero-toggle ()
"Toggle `zero-mode'."
(interactive)
......
;;; -*- lexical-binding: t -*-
;;; zero-panel --- provide emacs interface for zero-panel dbus service.
;;; zero-panel --- Provide emacs interface for zero-panel dbus service. -*- lexical-binding: t -*-
;; Licensed under the Apache License, Version 2.0 (the "License");
;; you may not use this file except in compliance with the License.
......@@ -31,7 +30,7 @@ EVENT and ERROR are error-handler arguments."
(when (or (string-equal "com.emacsos.zero.Panel"
(dbus-event-interface-name event))
(s-contains-p "com.emacsos.zero.Panel" (cadr error)))
(error "zero-panel dbus failed: %S" (cadr error))))
(error "Zero-panel dbus failed: %S" (cadr error))))
(add-hook 'dbus-event-error-functions 'zero-panel-error-handler)
......
;;; -*- lexical-binding: t -*-
;;; zero-pinyin-service.el --- provide emacs interface for zero-pinyin-service dbus service.
;;; zero-pinyin-service.el --- Provide emacs interface for zero-pinyin-service dbus service. -*- lexical-binding: t -*-
;; Licensed under the Apache License, Version 2.0 (the "License");
;; you may not use this file except in compliance with the License.
......@@ -22,13 +21,14 @@
;;================
(require 'dbus)
(require 's)
(defun zero-pinyin-service-error-handler (event error)
"Handle dbus errors."
(when (or (string-equal "com.emacsos.zero.ZeroPinyinService1"
(dbus-event-interface-name event))
(s-contains-p "com.emacsos.zero.ZeroPinyinService1" (cadr error)))
(error "zero-pinyin-service dbus failed: %S" (cadr error))))
(error "`zero-pinyin-service' dbus failed: %S" (cadr error))))
(add-hook 'dbus-event-error-functions 'zero-pinyin-service-error-handler)
......@@ -92,7 +92,7 @@ GET-CANDIDATES-COMPLETE the async handler function."
(:struct :int32 7 :int32 55)))))
(defun zero-pinyin-service-commit-candidate-async (candidate candidate_pinyin_indices)
"Commit CANDIDATE asynchronously."
"Commit candidate asynchronously."
;; don't care about the result, so no callback.
(zero-pinyin-service-async-call
"CommitCandidate" nil
......
;;; -*- lexical-binding: t -*-
;;; zero-pinyin.el --- a pinyin input method for zero-framework
;;; zero-pinyin.el --- A pinyin input method for zero-framework -*- lexical-binding: t -*-
;; Licensed under the Apache License, Version 2.0 (the "License");
;; you may not use this file except in compliance with the License.
......@@ -27,7 +26,6 @@
;; dependencies
;;==============
(require 's)
(require 'zero-framework)
(require 'zero-pinyin-service)
......@@ -35,7 +33,7 @@
;; basic data and emacs facility
;;===============================
(defvar zero-pinyin-state nil "zero-pinyin internal state. could be nil or `*zero-pinyin-state-im-partial-commit*'.")
(defvar zero-pinyin-state nil "Zero-pinyin internal state. could be nil or `*zero-pinyin-state-im-partial-commit*'.")
(defconst *zero-pinyin-state-im-partial-commit* 'IM-PARTIAL-COMMIT)
(defvar zero-pinyin-used-preedit-str-lengths nil
......@@ -283,7 +281,7 @@ DIGIT 0 means delete 10th candidate."
"Allow C-<digit> to DeleteCandidate in `*zero-state-im-preediting*' state."
(interactive)
(unless (eq zero-state *zero-state-im-preediting*)
(error "zero-digit-argument called in non preediting state"))
(error "`zero-digit-argument' called in non preediting state"))
(if (memq 'control (event-modifiers last-command-event))
(let* ((char (if (integerp last-command-event)
last-command-event
......
;;; zero-pkg.el --- Zero package file -*- lexical-binding: t -*-
;; Licensed under the Apache License, Version 2.0 (the "License");
;; you may not use this file except in compliance with the License.
;; You may obtain a copy of the License at
;;
;; http://www.apache.org/licenses/LICENSE-2.0
;;
;; Unless required by applicable law or agreed to in writing, software
;; distributed under the License is distributed on an "AS IS" BASIS,
;; WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
;; See the License for the specific language governing permissions and
;; limitations under the License.
;; Version: 1.2.3
;; Package-Version: 1.2.3
;; URL: https://gitlab.emacsos.com/sylecn/zero-el
;;; Commentary:
;; defines zero package.
;;; Code:
(define-package "zero" "1.2.3"
"a Chinese input method framework"
'((s "1.2.0")))
(provide 'zero-pkg)
;;; zero-pkg.el ends here
;;; -*- lexical-binding: t -*-
;;; zero-quickdial --- quickdial input method written as an emacs minor mode.
;;; zero-quickdial --- quickdial input method written as an emacs minor mode. -*- lexical-binding: t -*-
;; Licensed under the Apache License, Version 2.0 (the "License");
;; you may not use this file except in compliance with the License.
......
;;; -*- no-byte-compile: t; -*-
;;; zero-reload-all.el --- reload zero-el in correct order
;;; zero-reload-all.el --- reload zero-el in correct order -*- no-byte-compile: t; -*-
;; Licensed under the Apache License, Version 2.0 (the "License");
;; you may not use this file except in compliance with the License.
......
;;; -*- no-byte-compile: t; -*-
;;; zero-table.el --- a demo table based input method based on zero-framework.el
;;; zero-table.el --- a demo table based input method based on zero-framework.el -*- no-byte-compile: t; lexical-binding: t -*-
;; Licensed under the Apache License, Version 2.0 (the "License");
;; you may not use this file except in compliance with the License.
......@@ -30,7 +29,6 @@
;; dependencies
;;==============
(require 's)
(require 'zero-framework)
;;===============================
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment