Mercurial > hg > xemacs-beta
comparison lisp/mule/mule-cmds.el @ 2970:adda8fccb13d
[xemacs-hg @ 2005-10-04 16:43:29 by stephent]
Improve style and documentation of `register-input-method
author | stephent |
---|---|
date | Tue, 04 Oct 2005 16:43:38 +0000 |
parents | ecf1ebac70d8 |
children | 77f5a5135b3a |
comparison
equal
deleted
inserted
replaced
2969:67a25e57557e | 2970:adda8fccb13d |
---|---|
345 This function is called with no argument.") | 345 This function is called with no argument.") |
346 (make-variable-buffer-local 'describe-current-input-method-function) | 346 (make-variable-buffer-local 'describe-current-input-method-function) |
347 (put 'describe-current-input-method-function 'permanent-local t) | 347 (put 'describe-current-input-method-function 'permanent-local t) |
348 | 348 |
349 (defvar input-method-alist nil | 349 (defvar input-method-alist nil |
350 "Alist of input method names vs how to use them. | 350 "Alist mapping input method names to information used by the LEIM API. |
351 Each element has the form: | 351 Elements have the form (METHOD LANGUAGE ACTIVATOR TITLE DESCRIPTION ARGS...). |
352 (INPUT-METHOD LANGUAGE-ENV ACTIVATE-FUNC TITLE DESCRIPTION ARGS...) | 352 Use `register-input-method' to add input methods to the database. See its |
353 See the function `register-input-method' for the meanings of the elements.") | 353 documentation for the meanings of the elements.") |
354 | 354 |
355 (defun register-input-method (input-method lang-env &rest args) | 355 (defun register-input-method (method language |
356 "Register INPUT-METHOD as an input method for language environment ENV. | 356 ;; #### shouldn't be optional, but need to |
357 INPUT-METHOD and LANG-ENV are symbols or strings. | 357 ;; audit callers |
358 | 358 &optional activator title description |
359 The remaining arguments are: | 359 &rest args) |
360 ACTIVATE-FUNC, TITLE, DESCRIPTION, and ARGS... | 360 "Register METHOD as an input method for language environment LANGUAGE. |
361 ACTIVATE-FUNC is a function to call to activate this method. | 361 |
362 METHOD and LANGUAGE may be symbols or strings. | |
363 ACTIVATOR is the function called to activate this method. METHOD (the | |
364 invocation name) and ARGS are passed to the function on activation. | |
362 TITLE is a string to show in the mode line when this method is active. | 365 TITLE is a string to show in the mode line when this method is active. |
363 DESCRIPTION is a string describing this method and what it is good for. | 366 DESCRIPTION is a string describing this method and what it is good for. |
364 The ARGS, if any, are passed as arguments to ACTIVATE-FUNC. | 367 Optional ARGS, if any, are stored and passed as arguments to ACTIVATOR. |
365 All told, the arguments to ACTIVATE-FUNC are INPUT-METHOD and the ARGS. | 368 |
366 | 369 When registering a new Quail input method, the input method title should be |
367 This function is mainly used in the file \"leim-list.el\" which is | 370 the one given in the third parameter of `quail-define-package' (if the values |
368 created at building time of emacs, registering all quail input methods | 371 are different, the string specified in this function takes precedence). |
369 contained in the emacs distribution. | 372 |
370 | 373 The information provided is registered in `input-method-alist'. The commands |
371 In case you want to register a new quail input method by yourself, be | 374 `describe-input-method' and `list-input-methods' use this database to show |
372 careful to use the same input method title as given in the third | 375 information about input methods without loading them." |
373 parameter of `quail-define-package' (if the values are different, the | 376 (if (symbolp language) |
374 string specified in this function takes precedence). | 377 (setq language (symbol-name language))) |
375 | 378 (if (symbolp method) |
376 The commands `describe-input-method' and `list-input-methods' need | 379 (setq method (symbol-name method))) |
377 this duplicated values to show some information about input methods | 380 (let ((info (append (list language activator title description) args)) |
378 without loading the affected quail packages." | 381 (slot (assoc method input-method-alist))) |
379 (if (symbolp lang-env) | |
380 (setq lang-env (symbol-name lang-env))) | |
381 (if (symbolp input-method) | |
382 (setq input-method (symbol-name input-method))) | |
383 (let ((info (cons lang-env args)) | |
384 (slot (assoc input-method input-method-alist))) | |
385 (if slot | 382 (if slot |
386 (setcdr slot info) | 383 (setcdr slot info) |
387 (setq slot (cons input-method info)) | 384 (setq slot (cons method info)) |
388 (setq input-method-alist (cons slot input-method-alist))))) | 385 (setq input-method-alist (cons slot input-method-alist))))) |
389 | 386 |
390 (defun read-input-method-name (prompt &optional default inhibit-null) | 387 (defun read-input-method-name (prompt &optional default inhibit-null) |
391 "Read a name of input method from a minibuffer prompting with PROMPT. | 388 "Read a name of input method from a minibuffer prompting with PROMPT. |
392 If DEFAULT is non-nil, use that as the default, | 389 If DEFAULT is non-nil, use that as the default, |