Skip to content

Commit e230877

Browse files
committed
Fix customization types
1 parent 80f09ed commit e230877

File tree

1 file changed

+42
-26
lines changed

1 file changed

+42
-26
lines changed

rime.el

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@
173173
(defcustom rime-popup-properties
174174
(list :margin 1)
175175
"Properties for popup."
176-
:type 'list
176+
:type '(plist)
177177
:group 'rime)
178178

179179
(defcustom rime-popup-style 'horizontal
@@ -182,16 +182,17 @@
182182
`simple', preedit and candidate list in a single line.
183183
`horizontal', list candidates in a single line.'
184184
`vertical', display candidates in multiple lines."
185-
:type 'symbol
186-
:options '(simple horizontal vertical)
185+
:type '(choice (const simple)
186+
(const horizontal)
187+
(const vertical))
187188
:group 'rime)
188189

189190
(defcustom rime-posframe-properties
190191
(list :internal-border-width 10)
191192
"Properties for posframe.
192193
193194
Background and default foreground can be set in face `rime-default-face'."
194-
:type 'list
195+
:type '(plist)
195196
:group 'rime)
196197

197198
(defcustom rime-posframe-style 'horizontal
@@ -200,8 +201,9 @@ Background and default foreground can be set in face `rime-default-face'."
200201
`simple', preedit and candidate list in a single line.
201202
`horizontal', list candidates in a single line.'
202203
`vertical', display candidates in multiple lines."
203-
:type 'symbol
204-
:options '(simple horizontal vertical)
204+
:type '(choice (const simple)
205+
(const horizontal)
206+
(const vertical))
205207
:group 'rime)
206208

207209
(defcustom rime-sidewindow-keep-window nil
@@ -213,8 +215,10 @@ Background and default foreground can be set in face `rime-default-face'."
213215
"Side for sidewindow.
214216
215217
One of `top', `bottom', `left', `right'."
216-
:type 'symbol
217-
:options '(top bottom left right)
218+
:type '(choice (const top)
219+
(const bottom)
220+
(const left)
221+
(const right))
218222
:group 'rime)
219223

220224
(defcustom rime-sidewindow-style 'horizontal
@@ -223,8 +227,9 @@ One of `top', `bottom', `left', `right'."
223227
`simple', preedit and candidate list in a single line.
224228
`horizontal', list candidates in a single line.'
225229
`vertical', display candidates in multiple lines."
226-
:type 'symbol
227-
:options '(simple horizontal vertical)
230+
:type '(choice (const simple)
231+
(const horizontal)
232+
(const vertical))
228233
:group 'rime)
229234

230235
(defface rime-default-face
@@ -272,8 +277,9 @@ Options:
272277
t, display in candidate menu, default behavior.
273278
inline, display in inline text, replacing commit text preview.
274279
nil, don't display."
275-
:type 'symbol
276-
:options '(t inline nil)
280+
:type '(const (const :tag "Display in candidate menu" t)
281+
(const :tag "Display in inline text" inline)
282+
(const :tag "Don't display" nil))
277283
:group 'rime)
278284

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

286292
(defcustom rime-posframe-fixed-position nil
287293
"Use a fixed position for posframe candidate."
288-
:type :boolean
294+
:type 'boolean
289295
:group 'rime)
290296

291297
(defcustom rime-librime-root nil
292298
"The path to the directory of librime.
293299
294300
Leave it nil if you have librime's lib and header files in the standard path.
295301
Otherwise you should set this to where you put librime."
296-
:type 'string
302+
:type 'directory
297303
:group 'rime)
298304

299305
(defun rime--guess-emacs-module-header-root ()
@@ -311,8 +317,8 @@ Otherwise you should set this to where you put librime."
311317
"The path to the directory of Emacs module header file.
312318
313319
Leave it nil if you using Emacs shipped with your system.
314-
Otherwise you should set this to the directory contains 'emacs-module.h'."
315-
:type 'string
320+
Otherwise you should set this to the directory contains `emacs-module.h'."
321+
:type 'directory
316322
:group 'rime)
317323

318324
;;; We need these variables to be buffer local.
@@ -339,14 +345,14 @@ Will be reset to nil when symbol `rime-active-mode' is disabled.")
339345
340346
When one of functions in `rime-disable-predicates' return t, and
341347
one of these functions return t, the input-method will toggle to inline mode."
342-
:type 'list
348+
:type 'hook
343349
:group 'rime)
344350

345351
(defcustom rime-disable-predicates nil
346352
"A list of predicate functions, each receive no argument.
347353
348354
If one of these functions return t, the input-method will fallback to ascii mode."
349-
:type 'list
355+
:type 'hook
350356
:group 'rime)
351357

352358
(defcustom rime-show-candidate 'minibuffer
@@ -359,15 +365,18 @@ nil means don't display candidate at all.
359365
replacement for `minibuffer' if you use minibuffer as the mode-line.
360366
`posframe', display candidate in posframe, will fallback to popup in TUI.
361367
`sidewindow', display in sidewindow."
362-
:type 'symbol
363-
:options '(minibuffer message popup posframe sidewindow)
368+
:type '(choice (const minibuffer)
369+
(const popup)
370+
(const message)
371+
(const posframe)
372+
(const sidewindow))
364373
:group 'rime)
365374

366375
(defcustom rime-user-data-dir (locate-user-emacs-file "rime/")
367376
"Rime user data directory.
368377
369378
Defaults to `user-emacs-directory'/rime/"
370-
:type 'string
379+
:type 'directory
371380
:group 'rime)
372381

373382
(defcustom rime-share-data-dir
@@ -388,7 +397,7 @@ Defaults to `user-emacs-directory'/rime/"
388397
(if (getenv "LIBRIME_ROOT")
389398
(expand-file-name (concat (getenv "LIBRIME_ROOT") "/share/rime-data"))))))
390399
"Rime share data directory."
391-
:type 'string
400+
:type 'directory
392401
:group 'rime)
393402

394403
(defvar rime--root (file-name-directory (or load-file-name buffer-file-name))
@@ -402,13 +411,17 @@ Defaults to `user-emacs-directory'/rime/"
402411
"A character that used to hold the inline ascii mode.
403412
404413
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."
405-
:type 'char
414+
:type 'character
406415
:group 'rime)
407416

408417
(defcustom rime-inline-ascii-trigger 'shift-l
409418
"How to trigger into inline ascii mode."
410-
:type 'symbol
411-
:options '(shift-l shift-r control-l control-r alt-l alt-r)
419+
:type '(choice (const shift-l)
420+
(const shift-r)
421+
(const control-l)
422+
(const control-r)
423+
(const alt-l)
424+
(const alt-r))
412425
:group 'rime)
413426

414427
(defcustom rime-cursor "|"
@@ -954,7 +967,10 @@ By default the input-method will not handle DEL, so we need this command."
954967
(insert commit)
955968
(rime--clear-state))))
956969

957-
(defcustom rime-commit1-forall nil "Non-nil to auto commit the 1st item before any command unrelated to rime.")
970+
(defcustom rime-commit1-forall nil
971+
"Non-nil to auto commit the 1st item before any command unrelated to
972+
rime."
973+
:type 'boolean)
958974

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

0 commit comments

Comments
 (0)