Commit 729da9f4 authored by Yuanle Song's avatar Yuanle Song
Browse files

zero-input v2.8.0

- add ` -> · mapping in punctuation full map.
- allow user overwrite quote mapping in zero-input-punctuation-full-map
- 1.<space> should convert 。 to .
parent 3e6e4548
* COMMENT -*- mode: org -*-
#+Date: 2019-09-01
Time-stamp: <2020-02-16>
Time-stamp: <2020-04-05>
* zero-el
......@@ -8,7 +8,7 @@ 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.
This branch is created for one-file ELPA release. For more information, please
check [[https://gitlab.emacsos.com/sylecn/zero-el/blob/master/README][README in master branch]].
check [[https://gitlab.emacsos.com/sylecn/zero-el/blob/master/README][README in master branch]]. [[https://gitlab.emacsos.com/sylecn/zero-el/blob/master/ChangeLog][ChangeLog]] is also in master branch.
* introduce to zero-el
https://blog.emacsos.com/zero-el.html
......
......@@ -12,7 +12,7 @@
;; See the License for the specific language governing permissions and
;; limitations under the License.
;; Version: 2.6.0
;; Version: 2.8.0
;; URL: https://gitlab.emacsos.com/sylecn/zero-el
;; Package-Requires: ((emacs "24.3") (s "1.2.0"))
......@@ -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.6.0")
(setq zero-input-version "2.8.0")
;; FSM state
(defconst zero-input--state-im-off 'IM-OFF)
......@@ -310,6 +310,7 @@ independent from punctuation map. You can change this via
(?^ "……")
(?~ "~")
(?\; ";")
(?\` "·")
(?$ "¥"))
"Additional punctuation map used when `zero-input-punctuation-level' is 'FULL."
:group 'zero-input
......@@ -575,13 +576,13 @@ Return CH's Chinese punctuation if CH is converted. Return nil otherwise."
"Convert punctuation for `zero-input-punctuation-level-full'.
Return CH's Chinese punctuation if CH is converted. Return nil otherwise"
(cl-case ch
(?\" (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 (or (cadr (assq ch zero-input-punctuation-full-map))
(zero-input-convert-punctuation-basic ch)))))
(or (zero-input-convert-punctuation-basic ch)
(cadr (assq ch zero-input-punctuation-full-map))
(cl-case ch
(?\" (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 "‘" "’")))))
(defun zero-input-convert-punctuation (ch)
"Convert punctuation based on `zero-input-punctuation-level'.
......@@ -887,7 +888,7 @@ Argument CH the character that was inserted."
(if (and zero-input-mode zero-input-auto-fix-dot-between-numbers)
(let ((ch (or ch (elt (this-command-keys-vector) 0))))
(zero-input-add-recent-insert-char ch)
;; if user typed "[0-9A-Z]。[0-9]", auto convert “。” to “.”
;; if user typed "[0-9A-Z]。[0-9 ]", auto convert “。” to “.”
(cl-flet ((my-digit-char-p (ch) (and (>= ch ?0) (<= ch ?9)))
(my-capital-letter-p (ch) (and (>= ch ?A) (<= ch ?Z))))
;; ring-ref index 2 is least recent inserted char.
......@@ -895,7 +896,9 @@ Argument CH the character that was inserted."
(or (my-digit-char-p ch)
(my-capital-letter-p ch)))
(equal ? (ring-ref zero-input-recent-insert-chars 1))
(my-digit-char-p (ring-ref zero-input-recent-insert-chars 0)))
(let ((ch (ring-ref zero-input-recent-insert-chars 0)))
(or (my-digit-char-p ch)
(eq ch ?\s))))
(delete-char -2)
(insert "." (car (ring-elements zero-input-recent-insert-chars))))))))
......
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