Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix customization types #242

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 46 additions & 27 deletions rime.el
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@
(defcustom rime-popup-properties
(list :margin 1)
"Properties for popup."
:type 'list
:type '(plist)
:group 'rime)

(defcustom rime-popup-style 'horizontal
Expand All @@ -182,16 +182,17 @@
`simple', preedit and candidate list in a single line.
`horizontal', list candidates in a single line.'
`vertical', display candidates in multiple lines."
:type 'symbol
:options '(simple horizontal vertical)
:type '(choice (const simple)
(const horizontal)
(const vertical))
:group 'rime)

(defcustom rime-posframe-properties
(list :internal-border-width 10)
"Properties for posframe.

Background and default foreground can be set in face `rime-default-face'."
:type 'list
:type '(plist)
:group 'rime)

(defcustom rime-posframe-style 'horizontal
Expand All @@ -200,8 +201,9 @@ Background and default foreground can be set in face `rime-default-face'."
`simple', preedit and candidate list in a single line.
`horizontal', list candidates in a single line.'
`vertical', display candidates in multiple lines."
:type 'symbol
:options '(simple horizontal vertical)
:type '(choice (const simple)
(const horizontal)
(const vertical))
:group 'rime)

(defcustom rime-sidewindow-keep-window nil
Expand All @@ -213,8 +215,10 @@ Background and default foreground can be set in face `rime-default-face'."
"Side for sidewindow.

One of `top', `bottom', `left', `right'."
:type 'symbol
:options '(top bottom left right)
:type '(choice (const top)
(const bottom)
(const left)
(const right))
:group 'rime)

(defcustom rime-sidewindow-style 'horizontal
Expand All @@ -223,8 +227,9 @@ One of `top', `bottom', `left', `right'."
`simple', preedit and candidate list in a single line.
`horizontal', list candidates in a single line.'
`vertical', display candidates in multiple lines."
:type 'symbol
:options '(simple horizontal vertical)
:type '(choice (const simple)
(const horizontal)
(const vertical))
:group 'rime)

(defface rime-default-face
Expand Down Expand Up @@ -272,8 +277,9 @@ Options:
t, display in candidate menu, default behavior.
inline, display in inline text, replacing commit text preview.
nil, don't display."
:type 'symbol
:options '(t inline nil)
:type '(const (const :tag "Display in candidate menu" t)
(const :tag "Display in inline text" inline)
(const :tag "Don't display" nil))
:group 'rime)

(defcustom rime-return-insert-raw t
Expand All @@ -285,15 +291,15 @@ If nil, hitting return commits the selected candicate instead."

(defcustom rime-posframe-fixed-position nil
"Use a fixed position for posframe candidate."
:type :boolean
:type 'boolean
:group 'rime)

(defcustom rime-librime-root nil
"The path to the directory of librime.

Leave it nil if you have librime's lib and header files in the standard path.
Otherwise you should set this to where you put librime."
:type 'string
:type 'directory
:group 'rime)

(defun rime--guess-emacs-module-header-root ()
Expand All @@ -311,8 +317,8 @@ Otherwise you should set this to where you put librime."
"The path to the directory of Emacs module header file.

Leave it nil if you using Emacs shipped with your system.
Otherwise you should set this to the directory contains 'emacs-module.h'."
:type 'string
Otherwise you should set this to the directory contains `emacs-module.h'."
:type 'directory
:group 'rime)

;;; We need these variables to be buffer local.
Expand All @@ -339,14 +345,14 @@ Will be reset to nil when symbol `rime-active-mode' is disabled.")

When one of functions in `rime-disable-predicates' return t, and
one of these functions return t, the input-method will toggle to inline mode."
:type 'list
:type 'hook
:group 'rime)

(defcustom rime-disable-predicates nil
"A list of predicate functions, each receive no argument.

If one of these functions return t, the input-method will fallback to ascii mode."
:type 'list
:type 'hook
:group 'rime)

(defcustom rime-show-candidate 'minibuffer
Expand All @@ -359,15 +365,18 @@ nil means don't display candidate at all.
replacement for `minibuffer' if you use minibuffer as the mode-line.
`posframe', display candidate in posframe, will fallback to popup in TUI.
`sidewindow', display in sidewindow."
:type 'symbol
:options '(minibuffer message popup posframe sidewindow)
:type '(choice (const minibuffer)
(const popup)
(const message)
(const posframe)
(const sidewindow))
:group 'rime)

(defcustom rime-user-data-dir (locate-user-emacs-file "rime/")
"Rime user data directory.

Defaults to `user-emacs-directory'/rime/"
:type 'string
:type 'directory
:group 'rime)

(defcustom rime-share-data-dir
Expand All @@ -388,7 +397,7 @@ Defaults to `user-emacs-directory'/rime/"
(if (getenv "LIBRIME_ROOT")
(expand-file-name (concat (getenv "LIBRIME_ROOT") "/share/rime-data"))))))
"Rime share data directory."
:type 'string
:type 'directory
:group 'rime)

(defvar rime--root (file-name-directory (or load-file-name buffer-file-name))
Expand All @@ -401,14 +410,21 @@ Defaults to `user-emacs-directory'/rime/"
(defcustom rime-inline-ascii-holder nil
"A character that used to hold the inline ascii mode.

When inline ascii is triggered, this characeter will be inserted as the beginning of composition, the origin character follows. Then this character will be deleted."
:type 'char
When inline ascii is triggered, this characeter will be inserted as the
beginning of composition, the origin character follows. Then this
character will be deleted."
:type '(choice (const nil)
character)
:group 'rime)

(defcustom rime-inline-ascii-trigger 'shift-l
"How to trigger into inline ascii mode."
:type 'symbol
:options '(shift-l shift-r control-l control-r alt-l alt-r)
:type '(choice (const shift-l)
(const shift-r)
(const control-l)
(const control-r)
(const alt-l)
(const alt-r))
:group 'rime)

(defcustom rime-cursor "|"
Expand Down Expand Up @@ -954,7 +970,10 @@ By default the input-method will not handle DEL, so we need this command."
(insert commit)
(rime--clear-state))))

(defcustom rime-commit1-forall nil "Non-nil to auto commit the 1st item before any command unrelated to rime.")
(defcustom rime-commit1-forall nil
"Non-nil to auto commit the 1st item before any command unrelated to
rime."
:type 'boolean)

(defun rime--commit1-before-unrelated-command ()
"Commit the 1st item if this command is unrelated to rime."
Expand Down