Hello,
Several people requested a summary of my responses on this question.
To summarize the question, I had difficulty getting all programs
to behave consistently with respect to DELETE and BACKSPACE.
I got many many responses - thanks to you all! The following
response summarized almost everything though, so I will include
only it:
----------------------------------------
>From emma@Kanpai.Stanford.EDU Fri Jun 19 20:36:45 1992
Date: Fri, 19 Jun 92 09:20:28 PDT
To: templon@paramount.nikhefk.nikhef.nl
Subject: Re: How to Solve Delete/Backspace Confusion on Sun?
Newsgroups: alt.sys.sun,comp.emacs
In comp.sys.sun.misc you write:
>Problem: some of these programs like to use the delete
>key to get rid of the previous character (e.g. emacs).
>Some of the programs (e.g. the 'mail' program) want
>you to use the Back Space key to do this. Some of the
>programs (e.g. zsh) don't mind which one you use.
>I find it very frustrating. I have to retrain my fingers
>depending on which program I am in (I've already made four
>mistakes typing this in.) It seems that thru termcap,
>stty, tset, or something, I should be able to get consistent
>behaviour (this is on a Sun4 keyboard if it matters).
>If anyone knows a simple mechanism to do this (installable
>by a subguru-level unix user) can you please post
>or mail the info (preferably mail?) Oh one more note,
>when I use the workstations I run X-windows ('openwin').
I've encountered similar problems. The first thing to do is decide
which key (backspace or delete) you wish to act as the key removing
the previous character and then get the nonconforming programs to act
correctly. I generally choose the delete key.
stty erase ^?
at the shell level (or in your .login file) will set the delete key to
erase the previous character (stty erase ^H does the same for
backspace). This should set the shell and many programs such as mail
to use the delete key; not sure about openwin mail though. Emacs is
an exception but emacs uses the delete key anyway. If a program
doesn't accept the stty erase definition, you'll have to read the man
pages to find out what to do.
If you go the other way and want to use backspace, then you have to
tell emacs to switch. The following does that trick
;;; HP terminals usually encourage using ^H as the rubout character
(let ((the-table (make-string 128 0)))
(let ((i 0))
(while (< i 128)
(aset the-table i i)
(setq i (1+ i))))
;; Swap ^H and DEL
(aset the-table ?\177 ?\^h)
(aset the-table ?\^h ?\177)
(setq keyboard-translate-table the-table))
grabbed from the emacs/lisp/term directory. This makes the delete key
act as ctrl-h and the backspace act as delete. In general this will
go in your .emacs file (or if system wide you do some work in
emacs/lisp/term).
Another trick when using X is to switch the actual keys using xmodmap.
I use X11R4 and do the following on a particular hp display (where the
delete key happens to be shift escape)
Created a file called .xmodmap.hp containing
keycode 101 = Delete
keycode 39 = Escape BackSpace
then in my .xinitrc file executed the command
xmodmap .xmodmap.hp
This makes the delete key send ctrl-h and the backspace key send
ctrl-? the opposite of their normal actions. Note that the keycodes
may vary (see man pages on xev and xmodmap). I'm not sure how this
will work within the openwin environment.
Good luck,
Emma Pease
emma@csli.stanford.edu
ps. Things can get tricky but not impossible if you want to use
backspace from one terminal or display and delete from another.
----------------------------------------
Thanks again to all, and I hope this helps.
JT
This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:06:44 CDT