4. X-Symbol's Input Methods
An X-Symbol input method is a way, provided by package X-Symbol, to insert a X-Symbol character (not in the sense of Mule's "input methods"). For a short overview with screenshots, see the web pages of X-Symbol.
Input methods Token and Electric change the normal way to insert characters a bit. Therefore, they require X-Symbol mode to be turned on and can be turned off explicitly. The other input methods are provided with additional commands and key prefixes, they can also be used in buffers where X-Symbol mode is turned off.
With AucTeX, Version 9.8a or higher, its math mode commands also inserts X-Symbol characters (see section `Mathematics' in AUCTeX).
4.1 Common Behavior of All Input Methods Common behavior of all input methods. 4.2 Input Method Token: Replace Token by Character Replace token by character. 4.3 Input Method Read Token: Minibuffer Completion Minibuffer input with completion. 4.4 Input Method Menu: Select a Menu Item Select a menu item. 4.5 Input Method Grid: Choose Highlighted Character Choose highlighted character. 4.6 Input Method Keyboard: Compose Key Sequence Compose a key sequence. 4.7 Input Method Context: Replace Char Sequence Replace character sequence. 4.8 Input Method Electric: Automatic Context Automatically replace character sequence. 4.9 Input Method Quail: a Mule Input Method A Mule input method "x-symbol". 4.10 Customizing Input Methods How to customize the input methods.
4.1 Common Behavior of All Input Methods
Input methods normally just inserts valid characters which are those characters which have a useful representation in the file:
When X-Symbol is turned off, a character is valid if it is an 8bit
character according to the value of
When X-Symbol is turned on, a character is valid if the characters could be encoded to a token in language
x-symbol-language(see section 3.1 Token Language).
If a buffer is read-only (see section `Misc Buffer' in XEmacs User's Manual), most input methods push the character to insert onto the kill ring instead. Typing C-y lets you then insert the character (see section `Yanking' in XEmacs User's Manual).
The input methods Keyboard, Menu and Grid (the character selection with button2) have the same interpretation of the prefix argument:
With prefix argument `0', do not insert anything, just barf, if the
character is not valid.
With a positive prefix argument, insert a character that many times.
Barf, if the character is not valid.
With a negative prefix argument, insert a character as many times as
specified by the absolute value of the prefix argument. A character is
also inserted if it is not valid.
- With one or more C-us with no digits, insert the token of a language to choose, including "x-symbol charsym" (see section 6.1 Pseudo Token Language "x-symbol charsym").
Many input commands of package X-Symbol uses the same key prefix in its default binding:
By default, C-= is used as the key prefix. Under XEmacs/no-Mule,
you might want to use multi-key instead:
(unless (featurep 'mule) (setq x-symbol-compose-key '(multi-key)))
Set this to
nil, if you do not want that pressing C-= automatically initializes the input methods.
4.2 Input Method Token: Replace Token by Character
If X-Symbol mode is on, input method Token automatically replaces the token by the corresponding character when inserting the next character following the token (in some token languages you need the next character to decide whether the token is completed) if it is valid.
The token will be replaced only if the next character has been inserted without prefix argument or with prefix argument 0 (C-u 0), the latter will therefore just induce the replacement.
Please note that the token is really replaced by the characters, it is
font-lock which highlights the token to look like a
You might want to press C-/ or C-x u to undo the replacement. Input method Token requires X-Symbol mode to be enabled, it can be disabled (and re-enabled) by setting the following variable:
Individual token language might slightly change the way input method
Token works exactly; from the predefined language, it is just
(see section 6.2 Token Language "TeX macro" (
4.3 Input Method Read Token: Minibuffer Completion
You can insert a character by reading the corresponding token in the minibuffer. You are offered completion over the known tokens (see section `Completion' in XEmacs User's Manual).
- M-x x-symbol-read-token-direct
- C-= TAB
Insert character by selecting a token in the current token language
(even if X-Symbol mode is turned off) or an "x-symbol charsym"
(see section 6.1 Pseudo Token Language "x-symbol charsym").
- M-x x-symbol-read-token
- C-= RET
- Insert character by first selecting the token language and then a token in that language.
Input method Read Token also works if X-Symbol mode is not enabled. It uses the common interpretation of prefix arguments for X-Symbol insert commands, see 4.1 Common Behavior of All Input Methods.
4.4 Input Method Menu: Select a Menu Item
If X-Symbol mode is turned on, a Menu
X-Symbol appears in
the menubar (see section 3.3 Minor Mode). It also appears over non-highlighted
parts in the Grid and the Key Completions buffer (see section 4.5 Input Method Grid: Choose Highlighted Character). The menu allows to change buffer-local and global variables
(some directly, some via package
custom). It has a submenu with
the most interesting commands of package X-Symbol.
The menu has submenus with commands to insert X-Symbol characters. The submenu headers are the same as the headers in the Grid, see 3.6 Character Group and Token Classes. The appearance of the menu can be customized:
- With a valid token language, the X-Symbol menu only contains insertion commands for valid characters. The entries are mentioned and sorted according to the token. Otherwise, the X-Symbol menu contains all characters, the entries are mentioned according to their charsym name.
- The submenus do not contain more than 30 insertion commands for X-Symbol characters. A submenu is split if necessarily.
Input method Menu also works if X-Symbol mode is not enabled. It uses the common interpretation of prefix arguments for X-Symbol insert commands, see 4.1 Common Behavior of All Input Methods.
4.5 Input Method Grid: Choose Highlighted Character
Probably the easiest way to insert a character is by using a Grid of characters:
- M-x x-symbol-grid
- C-= C-=
- Pops up a buffer displaying X-Symbol characters in a grid like fashion. You can select a character with the mouse or RET, see below.
In the Grid buffer and the buffer with the possible completions for an X-Symbol key sequence (see section 4.6 Input Method Keyboard: Compose Key Sequence), the following commands are used if the mouse pointer is over an highlighted character.
Insert highlighted character (or character under point, respectively)
into the buffer of
pointis not in the same buffer as the highlighted character. Otherwise, insert the character into the reference buffer, i.e., the buffer where you have invoked the grid or the key completions from. (The reference to the buffer is erased when an X-Symbol character is inserted into any buffer.)
- Pops up a highlight menu where you can select to insert the token of various token languages instead the character itself. In order not to load and initialize all additional token language you have not yet used, the menu offers to do so explicitly for supported (registered) token languages (see section 3.1 Token Language).
Over all non-highlighted parts, the following commands are used:
Scroll Grid or Key Completions buffer down in upper half of the window
and scroll up in the lower half of the window.
- Pops up the X-Symbol menu, see 4.4 Input Method Menu: Select a Menu Item).
When using the keyboard to select a character, the following command could be useful:
- M-x x-symbol-list-info
Display info for character under point in echo area.
- M-x x-symbol-list-bury
- Bury list buffer while trying to use the old window configuration.
You can control the grid by the following variables:
- With a valid token language, the Grid only contains insertion commands for valid characters and might use a coloring scheme. Otherwise, it contains all characters.
- Inserting an X-Symbol character does not restore the window configuration current before the invocation of the Grid.
Use old Grid when invoking command
x-symbol-grid, if this is reasonably to do. If
x-symbol-gridis called with a prefix argument, always create new Grid.
The Grid does not contain
The tab width in the Grid buffer should correspond the font in
x-symbol-heading-facewhich is also used as the default font in the Grid buffer.
- Use larger interline spacing if a line in the Grid starts with a header.
The headers in the Grid are the same as the submenu headers, see 3.6 Character Group and Token Classes. Similar looking characters for one headers are grouped together. See section 4.7 Input Method Context: Replace Char Sequence.
Input method Grid also works if X-Symbol mode is not enabled. It uses the common interpretation of prefix arguments for X-Symbol insert commands, see 4.1 Common Behavior of All Input Methods.
4.6 Input Method Keyboard: Compose Key Sequence
Key sequences starting with C-= (see section 4.1 Common Behavior of All Input Methods) are used to insert X-Symbol characters, e.g., C-= ~ >
leadsto. The Ascii sequence of the keys after C-=
look similar to the character which you are going to insert. It is the
same as the sequence which is replaced by input method Context, see
4.7 Input Method Context: Replace Char Sequence.
If many characters are represented by the same Ascii sequence, the binding is extended by `1', `2' and so on. If you do not know how to continue your key sequence, the following commands might be useful:
- M-x x-symbol-help
- C-= zero-or-more-keys help
- C-= zero-or-more-keys C-h
Pops up a buffer displaying possible completions for the key sequence
C-= zero-or-more-keys. You do not have to type the key
sequence again, i.e., C-= zero-or-more-keys is also used for
the next input.
- C-= zero-or-more-keys button1
- C-= zero-or-more-keys button2
- C-= zero-or-more-keys button3
Use the normal bindings of button1, button2 or
button3, respectively (see section 4.5 Input Method Grid: Choose Highlighted Character). The key sequence
is not used for the next input.
- C-= zero-or-more-keys M-prior
- C-= zero-or-more-keys M-next
- C-= zero-or-more-keys M-home
- C-= zero-or-more-keys M-end
Execute the commands
end-of-buffer-other-window, respectively. You do not have to type the key sequence again, i.e., C-= zero-or-more-keys is also used for the next input.
- Inserting an X-Symbol character restores the window configuration current before the invocation of the Grid.
- Defines the bindings mentioned above.
Input method Keyboard also works if X-Symbol mode is not enabled. It uses the common interpretation of prefix arguments for X-Symbol insert commands, see 4.1 Common Behavior of All Input Methods.
4.7 Input Method Context: Replace Char Sequence
The idea of the input method Context is to replace a sequence of characters by a character which looks similar to the whole sequence. If the sequence consists only of Ascii characters, it is also used for the key bindings, see 4.6 Input Method Keyboard: Compose Key Sequence.
There will be some info in the echo area that the character sequence before point can be replace via input method Context. The following commands are provided:
- M-x x-symbol-modify-key
- C-= left
- C-= right
If character before point is an X-Symbol character, "modify" it to an
alternative character (if you do it often enough, you are back at your
first character). Otherwise replace sequence of characters by a
character which looks similar to the whole sequence.
- M-x x-symbol-rotate-key
- C-= up
- C-= down
- If character before point is an X-Symbol character, "rotate" its "direction" (or change uppercase/lowercase).
Both commands can also be used to resolve a character alias before point, see 3.2.7 Character Aliases. If the region is active, restrict replacement to use that region since the input method Context only considers the longest sequence of characters with a replacement.
Input method Context can be customized by changing the following variables:
If you provide a prefix argument to command
x-symbol-rotate-key, you can specify the direction you want to have: it is according to numerical keypads, e.g., with prefix argument `7' you specify the direction "north-west".
x-symbol-rotate-keyis also used to "Greekify" the previous character: typing a C-. is shorter than a # C-,.
- Constrains whether a context/charsym can be replaced. No constraints by default.
- Contexts starting with a space cannot be replaced. This variable must be set before X-Symbol has been initialized.
4.8 Input Method Electric: Automatic Context
The idea of input method Electric is to have the input method Context (see section 4.7 Input Method Context: Replace Char Sequence) do its replacement automatically. X-Symbol automatically replaces some character sequences of input method Context by the X-Symbol character as soon as the last character in the sequence of the sequence has been pressed.
Input method Electric has nothing to do with the display of super-/subscripts (see section 5.1 Super- and Subscripts).
You might want to press C-/ or C-x u to undo the replacement. Input method Electric requires X-Symbol mode to be enabled, it can be disabled (and re-enabled) by setting the following variable:
To make input method Electric useful and not annoying, several conditions must be met for X-Symbol to do the auto-replacement:
Not all contexts will be replaced automatically. E.g., while input
method Context allows both pre- and postfixes for accented characters,
: and ' only act as prefixes, and ` and ~ only
as postfixes for input method Electric, since these are the combinations
where those characters are quite likely not used literally.
The character must be valid in the current token language, see
4.1 Common Behavior of All Input Methods.
All characters of the context have been typed without any other command
in between, e.g., - > inserts
arrowright, "- left right > simply inserts `->'.
No prefix argument has been used for any character in the context.
The electric context must not be a suffix of a longer valid context for
another character. E.g., ' ' o does not insert
oacute' because `"o' is the context for
ohungarumlaut(which cannot be inserted by input method Electric).
It should be "allowed" to change the context to the character via
input method Context.
Individual contexts/charsyms can be disabled by setting the following
The context should neither be `'s' (this would be annoying when
writing English), nor include a space. If you want to disable input
method Electric for all accented characters, use
(setq x-symbol-electric-ignore "[ \t]\\|[A-Za-z][~`]\\|[:'][A-Za-z]")
- Individual contexts/charsyms can be disabled for each token language lang.
4.9 Input Method Quail: a Mule Input Method
Another way to insert a characters is by using the Emacs/Mule multilingual text input method "x-symbol" (see section `Input Methods' in XEmacs User's Manual)..
Again, the Ascii sequence used there is the same as the sequence which is replaced by input method Context, see 4.7 Input Method Context: Replace Char Sequence. A one-letter key sequence is extended by ;.
If input method Quail is selected for a buffer, input method Electric (see section 4.8 Input Method Electric: Automatic Context) is disabled in that buffer.
4.10 Customizing Input Methods
You may safely define key bindings not using the
(i.e., starting with C-=). E.g., for
alpha on A-a ,
(global-set-key [(alt a)] 'x-symbol-INSERT-alpha)
Please note that the command
x-symbol-INSERT-alpha is not defined
before the main file (`x-symbol') in the package has been loaded
(if you really need it, function
autoload is your friend).
Other possibilities to customize the input methods are by setting the following variables:
- Defines the groups whose characters appear after that header in the Grid and in submenus with that header. See section 3.6 Character Group and Token Classes. Extra variables exists for the language dependent Grid and Menu.
These are variables which are used to compute the input definitions.
While this kind of indirection might seem complicated to you (it is), it
actually ensures consistency across all input methods. See section 7.3 Defining Input Methods.
For example, if you prefer charsym
epsilonyou might want to use:
(setq x-symbol-user-table '((epsilon1 t (greek1 "e" nil "epsilon") nil -3000)))
- Additional functions to execute after setting up the Grid and Key Completions buffer.
- You can change the input methods directly by functions in these hooks.
This document was generated by Christoph Wedler on December, 8 2003 using texi2html