2015-11-08
The great Delete versus Backspace split
In the history of Unix, one of the great quiet divisions has been the split of what your erase character should be, with the choice being DEL (Ctrl-?) or Ctrl-H. In turn, this goes back to the physical serial terminals that for years were how you logged on to most Unix systems. In the days of real terminals, you wanted your Unix erase character to be set as whatever your terminal generated when you hit the big, prominent 'backspace' key (which was, of course, not at all programmable). Setting DEL when your key generated Ctrl-H or vice versa was a recipe for frustration and extra work.
If life was great, everyone would have agreed that the terminal backspace key generated one thing and we'd be done. Of course that didn't happen. As I remember it, most of the world's serial terminal makers decided that the backspace key would generate Ctrl-H, but Digital (aka DEC) decided to be special and have their backspace keys generate DEL. The Digital VT-52, VT-100, and later VT-series serial terminals were very popular, so Digital's decision had an outsized effect on Unix users. Adding to the fun for Unix users was the GNU Emacs decision to bind Ctrl-H to 'get help' and officially bless DEL as the (sole) delete character.
(It didn't hurt the (Unix) popularity of the VT series that for years you bought Digital computers to run Unix, first PDP-11s and later Vaxes.)
Although my history of this is somewhat complicated, I wound up in
the Digital 'erase is DEL' camp, partly because it's what at least
some of the hardware I used wanted to do and partly because it made
life easier in GNU Emacs. Given this, you can probably guess the
original cause of my swapping Backspace and Delete in X until
recently; I started doing this when my office
workstation changed from a DECStation to an SGI Indy. The DECStation's backspace key generated DEL
(and all of my environment was set up to deal with that), while the
SGI Indy's backspace key wanted to generate Ctrl-H. At the time I
made the rational decision that it was simpler to use xmodmap to
switch Backspace and Delete than to change my entire environment
around.
(I don't know and can't remember what GNU Emacs's state was at the time as far as distinguishing the Backspace key from a typed Ctrl-H. These days they're definitely different under X.)
PS: I don't remember how the original vi behaved with Ctrl-H and
DEL, but I think it was friendlier than GNU Emacs as far as dealing
with a backspace key that sent Ctrl-H (at least if you had your
stty erase character set properly, which you probably did).
2015-11-06
Revisiting a bit of my X keymapping history
I started using X what is now a very long time ago, and unlike some people I've never had a complete break with my original X environment, one where I restarted my setup from scratch and threw away all of my old customizations. The natural result of this is that I have been carrying forward some historical decisions without actually ever really looking at them in a modern environment.
At some point in my life with X, one of my customizations became
to swap the Backspace and Delete keys via xmodmap. My reason for
doing this at the time was straightforward; Backspace was more
convenient but generated ^H in various things, while I had set my
Unix delete character to ^? (aka DEL) a very long time ago for
reasons that seemed to make sense at the time. So things rumbled
forwards, and when X programs gave me the choice I set them so that
both the Backspace and the Delete keys would generate a DEL or
otherwise act the same.
(It's possible that I was actually mistaken about this and my swapping Backspace and Delete was due to a misunderstanding. At any rate, I did it and this is what I can vaguely remember as my reasoning.)
Of course, not all things treat the two keys the same. Many editing fields in X programs use Backspace for 'delete-left' and Delete for 'delete-right', so I got thoroughly acclimatized to reaching off to the far key in order to actually backspace over things in those programs. And there were always a few other anomalies here and there that I just reflexively dealt with.
Recently, for reasons beyond the scope of this entry, I wound
up in a situation without my usual Backspace/Delete swap. Much to
my surprise, I didn't notice this in xterm, where everything
continued just as before (most of how I noticed was realizing that
I was deleting characters in a few X programs with the much more
convenient Backspace key). While I wasn't paying attention, xterm
had quietly decided to start turning both the Backspace and Delete
keys into DEL (or at least into whatever your stty erase character
is set to; I haven't investigated). Since I have urxvt and Gnome
Terminal set up the same way, my xmodmap key swapping turns out
to now be both unnecessary and actually a little bit inconvenient.
(Konsole isn't set up to do this, but then I never use it anyways. Sorry, KDE.)
So now I've removed that little bit of xmodmap work from my X
dotfiles, and I'm taking a bit of a look at the other keymapping
things I'm doing. I can tell you that making CapsLock into an
additional Control key is definitely staying, though.
The whole exercise has been interesting and a little bit spooky.
I haven't thought about my xmodmap stuff for quite a while
now; after all, it worked, right? Yet either it quietly became
unnecessary at some point or was never necessary in the first
place. I'm sure there's other parts of my X environment that are
the same way and I just haven't stumbled over them yet.
(My collection of X resources settings is a good candidate for this. I'm sure there's settings in there for programs that don't even exist any more.)
PS: The widespread use of GNU readline and similar line editing things in programs can make it a little bit hard to see just what characters your Backspace and Delete keys are generating, since by default I believe that readline et al do the same thing with ^H and DEL.