Next: , Up: MS-DOS


D.1 Keyboard and Mouse on MS-DOS

The PC keyboard maps use the left <ALT> key as the <META> key. You have two choices for emulating the <SUPER> and <HYPER> keys: choose either the right <CTRL> key or the right <ALT> key by setting the variables dos-hyper-key and dos-super-key to 1 or 2 respectively. If neither dos-super-key nor dos-hyper-key is 1, then by default the right <ALT> key is also mapped to the <META> key. However, if the MS-DOS international keyboard support program KEYB.COM is installed, Emacs will not map the right <ALT> to <META>, since it is used for accessing characters like ~ and @ on non-US keyboard layouts; in this case, you may only use the left <ALT> as <META> key.

The variable dos-keypad-mode is a flag variable that controls what key codes are returned by keys in the numeric keypad. You can also define the keypad <ENTER> key to act like C-j, by putting the following line into your _emacs file:

     ;; Make the <ENTER> key from the numeric keypad act as C-j.
     (define-key function-key-map [kp-enter] [?\C-j])

The key that is called <DEL> in Emacs (because that's how it is designated on most workstations) is known as <BS> (backspace) on a PC. That is why the PC-specific terminal initialization remaps the <BS> key to act as <DEL>; the <DEL> key is remapped to act as C-d for the same reasons.

Emacs built for MS-DOS recognizes C-<BREAK> as a quit character, just like C-g. This is because Emacs cannot detect that you have typed C-g until it is ready for more input. As a consequence, you cannot use C-g to stop a running command (see Quitting). By contrast, C-<BREAK> is detected as soon as you type it (as C-g is on other systems), so it can be used to stop a running command and for emergency escape (see Emergency Escape).

Emacs on MS-DOS supports a mouse (on the default terminal only). The mouse commands work as documented, including those that use menus and the menu bar (see Menu Bar). Scroll bars don't work in MS-DOS Emacs. PC mice usually have only two buttons; these act as Mouse-1 and Mouse-2, but if you press both of them together, that has the effect of Mouse-3. If the mouse does have 3 buttons, Emacs detects that at startup, and all the 3 buttons function normally, as on X.

Help strings for menu-bar and pop-up menus are displayed in the echo area when the mouse pointer moves across the menu items. Highlighting of mouse-sensitive text (see Mouse References) is also supported.

Some versions of mouse drivers don't report the number of mouse buttons correctly. For example, mice with a wheel report that they have 3 buttons, but only 2 of them are passed to Emacs; the clicks on the wheel, which serves as the middle button, are not passed. In these cases, you can use the M-x msdos-set-mouse-buttons command to tell Emacs how many mouse buttons to expect. You could make such a setting permanent by adding this fragment to your _emacs init file:

     ;; Treat the mouse like a 2-button mouse.
     (msdos-set-mouse-buttons 2)

Emacs built for MS-DOS supports clipboard operations when it runs on Windows. Commands that put text on the kill ring, or yank text from the ring, check the Windows clipboard first, just as Emacs does on the X Window System (see Mouse Commands). Only the primary selection and the cut buffer are supported by MS-DOS Emacs on Windows; the secondary selection always appears as empty.

Due to the way clipboard access is implemented by Windows, the length of text you can put into the clipboard is limited by the amount of free DOS memory that is available to Emacs. Usually, up to 620KB of text can be put into the clipboard, but this limit depends on the system configuration and is lower if you run Emacs as a subprocess of another program. If the killed text does not fit, Emacs outputs a message saying so, and does not put the text into the clipboard.

Null characters also cannot be put into the Windows clipboard. If the killed text includes null characters, Emacs does not put such text into the clipboard, and displays in the echo area a message to that effect.

The variable dos-display-scancodes, when non-nil, directs Emacs to display the ASCII value and the keyboard scan code of each keystroke; this feature serves as a complement to the view-lossage command, for debugging.