X-Symbol Overview Related Details Manual News »Project »Download

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:

x-symbol-valid-charsym-function
When X-Symbol is turned off, a character is valid if it is an 8bit character according to the value of x-symbol-default-coding.

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:

Many input commands of package X-Symbol uses the same key prefix in its default binding:

x-symbol-compose-key
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)))

x-symbol-auto-key-autoload
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 not just font-lock which highlights the token to look like a character.

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:

x-symbol-token-input
A boolean which can also be changed via the X-Symbol menu.

Individual token language might slightly change the way input method Token works exactly; from the predefined language, it is just tex (see section 6.2 Token Language "TeX macro" (tex)).


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:

x-symbol-local-menu
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.

x-symbol-menu-max-items
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.

button2
RET
SPC
Insert highlighted character (or character under point, respectively) into the buffer of point if point is 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.)

button3
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:

button2
Scroll Grid or Key Completions buffer down in upper half of the window and scroll up in the lower half of the window.

button3
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
?
h
i
Display info for character under point in echo area.

M-x x-symbol-list-bury
q
Bury list buffer while trying to use the old window configuration.

You can control the grid by the following variables:

x-symbol-local-grid
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.

x-symbol-temp-grid
Inserting an X-Symbol character does not restore the window configuration current before the invocation of the Grid.

x-symbol-grid-reuse
Use old Grid when invoking command x-symbol-grid, if this is reasonably to do. If x-symbol-grid is called with a prefix argument, always create new Grid.

x-symbol-grid-ignore-charsyms
The Grid does not contain nobreakspace.

x-symbol-grid-tab-width
The tab width in the Grid buffer should correspond the font in x-symbol-heading-face which is also used as the default font in the Grid buffer.

x-symbol-heading-strut-glyph
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-= ~ > inserts 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 scroll-other-window-down, scroll-other-window, beginning-of-buffer-other-window or 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.

x-symbol-temp-help
Inserting an X-Symbol character restores the window configuration current before the invocation of the Grid.

x-symbol-map-default-keys-alist
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-,
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-.
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:

x-symbol-rotate-prefix-alist
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-suffix-char
Command x-symbol-rotate-key is also used to "Greekify" the previous character: typing a C-. is shorter than a # C-,.

x-symbol-context-ignore
Constrains whether a context/charsym can be replaced. No constraints by default.

x-symbol-context-init-ignore
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:

x-symbol-electric-input
A boolean which can also be changed via the X-Symbol menu.

To make input method Electric useful and not annoying, several conditions must be met for X-Symbol to do the auto-replacement:


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 x-symbol-map (i.e., starting with C-=). E.g., for alpha on A-a , use

 
(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:

x-symbol-header-groups-alist
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.

x-symbol-group-input-alist
x-symbol-user-table
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 epsilon1 over epsilon you might want to use:

 
(setq x-symbol-user-table
      '((epsilon1 t (greek1 "e" nil "epsilon") nil -3000)))

x-symbol-list-mode-hook
Additional functions to execute after setting up the Grid and Key Completions buffer.

x-symbol-after-init-input-hook
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