Version 0.99-19 | JED FAQ List | |||||||||||||
|
QuestionsQ1. How can I fix my backspace key? Q2. How do I make the TAB key work? Q3. How do I set the tab-width to 4? AnswersA1. How can I fix my backspace key? If you are having a problem with the backspace key on a Unix system, then you probably have a misconfigured terminal.
Jed queries the terminal driver to obtain the backspace key setting,
You can check terminal driver's settings by using the $ stty -a speed 38400 baud; rows 36; columns 80; line = 0; intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; [...]Here, the backspace key is given by the erase setting. If, as shown in the above example, the erase character is ^? (DELETE) and not ^H (BACKSPACE), then jed will assume that the backspace key generates ^? and not ^H. Hence, as part of its emacs emulation, it will bind ^H to the help functions. However, if pressing the backspace key from within jed causes a help window to pop up, then the character sent by your terminal is most likely a ^H, and not ^? as indicated by the terminal driver. In other words, you have a configuration problem: Your terminal driver thinks ^? is backspace, but your terminal, e.g. xterm, is using ^H.
One way of fixing this is to put the appropriate xterm entries into
your XTerm*ttyModes: erase ^? XTerm*VT100.Translations: #override \ <Key>BackSpace: string(0x7f)The other way is to use the stty program to change the erase
character to ^H.
If all else fails, you can put map_input (8, 127);in your .jedrc file to cause jed to map ^H to ^?.
A2. How do I make the TAB key work?
Many modes will set the TAB key to run an
If you really want the TAB key to insert
TABs, then put the following in your public define global_mode_hook (hook_name) { local_setkey ("self_insert_cmd", "\t"); } setkey ("self_insert_cmd", "\t");
One can also define the behavior of the TAB key on a mode-by-mode
basis. Consider define text_mode_hook () { local_setkey ("indent_line", "\t"); }Of course if you want the TAB key to insert a TAB in text_mode , then bind it to self_insert_cmd as
in the global_mode_hook above.
If you want to use the TAB to insert so-called simulated TABs
through the use of space characters, then instead of binding the
TAB key to self_insert_cmd , bind it to the
insert_simulated_tab function instead, e.g.,
public define global_mode_hook (hook_name) { local_setkey ("insert_simulated_tab", "\t"); }Not all versions of jed support the insert_simulated_tab
function, which was not introduced until version 0.99-17. If you
are using such version, then you will need to define it in your
.jedrc file:
public define insert_simulated_tab () { insert_spaces (TAB - (what_column () - 1) mod TAB); } A3. How do I set the tab-width to 4? Before answering this, do you really understand what you are asking? A TAB in a file is nothing more than a character whose ASCII value is 9. Unlike most other ASCII characters, the displayable representation of the TAB character is device dependent. So, one answer to this question would be to look at your terminal's manual to find out how it handles TAB characters. For this reason, many people feel that it is best to stick to the standard value of 8 for the tab-width, or avoid TABs altogether.
Let's assume that you are aware of this issue but are forced to edit
a file written by someone else, or are mandated by some policy
requiring the tab-width to be 4. Jed has several variables
controlling the use of TABs:
The
The
The
With the above in mind, what should you put in your TAB_DEFAULT = 4;in your .jedrc file. If you want to "simulate" such tabs with
spaces (a good idea if using a non-standard value), then also add
USE_TABS = 0;If you want to use standard 8-column tabs for all modes except C mode, then you will need to create a c_mode_hook for that
purpose:
TAB_DEFAULT = 8; public define c_mode_hook () { TAB = 4; } The use of these variables has no effect upon the action of the TAB key. See the previous FAQ for information about that. |
This page was last updated Nov 26, 2017 by John E. Davis. To comment on it or the material presented here, send email to jed at jedsoft org. |