From xemacs-m  Mon Jun  2 23:13:51 1997
Received: from netscape.com (h-205-217-237-46.netscape.com [205.217.237.46])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id XAA13899
	for <xemacs-beta@xemacs.org>; Mon, 2 Jun 1997 23:13:50 -0500 (CDT)
Received: from dredd.mcom.com (dredd.mcom.com [205.217.237.54])
	by netscape.com (8.8.5/8.8.5) with ESMTP id VAA17392
	for <xemacs-beta@xemacs.org>; Mon, 2 Jun 1997 21:13:21 -0700 (PDT)
Received: from gimp ([205.217.227.11]) by dredd.mcom.com
          (Netscape Mail Server v2.02) with SMTP id AAA15686;
          Mon, 2 Jun 1997 21:13:21 -0700
Sender: jwz@netscape.com (Jamie Zawinski)
Message-ID: <339399C7.8A531729@netscape.com>
Date: Mon, 02 Jun 1997 21:12:55 -0700
From: Jamie Zawinski <jwz@netscape.com>
Organization: Netscape Communications Corporation, Mozilla Division
X-Mailer: Mozilla 3.02 (X11; U; IRIX 6.2 IP22)
MIME-Version: 1.0
To: Hrvoje Niksic <hniksic@srce.hr>
CC: Martin Buchholz <mrb@Eng.Sun.COM>,
        XEmacs Developers <xemacs-beta@xemacs.org>, wing@666.com
Subject: Re: backspace-or-delete feedback
References: <199706030016.RAA03741@xemacs.eng.sun.com> 	<m267vwjzry.fsf@altair.xemacs.org> 	<kig4tbgsefm.fsf@jagor.srce.hr> <199706030122.SAA03777@xemacs.eng.sun.com> <kigwwocqwh3.fsf@jagor.srce.hr> <33937E67.26E11F89@netscape.com> <kign2p8qrg6.fsf@jagor.srce.hr>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hrvoje Niksic wrote:
> 
> > What do you mean by "hardcoded"?  All of this is a matter of what is in
> > function-key-map, right?
> 
> NO.  That's a part of the problem.  These two lines are from events.c:
> 
>   else if (c == 127)
>     k = QKdelete;

Ok, I think that's bogus.  (If it does the same thing for 8/backspace,
that's also bogus.)

> If one does `stty erase ^H' on a TTY, it's quite logical to map it to
> backspace, and show it to the user as such.

Not quite -- it's logical to make it so that when the user types C-h  
or backspace, that the previous character is erased.  Because the stty
settings talk only about *behavior*.

> On X, C-h is not backspace so we may output `C-h runs ...'.  Why do
> you think that doesn't work?
> 
> > There's no way to do the right thing on ttys.  The information is
> > gone.
> 
> Not if you read the termio structure.

The information that is gone is which key the user pressed.  Did they
press the backspace key?  Or did they hold Control and press H?  That's
what I meant.

In the message "xxx runs yyy", xxx is the key and yyy is the behavior. 
Termio talks about the behavior.  Which key  was actually used is no
longer known, so it's a matter of conjecture which one you should print.

>> However, telling the user "\e[3~ runs ..." is just going to confuse
>> people, so obviously that one should be avoided.
>
> Definitely.  The only difference is that I regard \e[3~ and C-h like
> the same.

They're different at least in that people type both C-h and backspace,
but no human ever types \e[3~.

> > I think this menas that "xxx runs the command ..." should use the xxx
> > that read-key-sequence saw -- that is, what function-key-map did.
> >
> > Then it's just a question of whether function-key-map remaps C-h to
> > backspace or not.  I don't think it ever should, but I don't feel
> > strongly about it.
> 
> Can you give some reasons pro or contra.

Well, I dunno, say I'm sitting in front of some random keyboard, and
Something is Going Wrong.  It might be useful information to me that
the-big-horizontal-key-in-the-upper-right is sending C-h, rather than
C-?.  If you print BS and DEL, I'm going to wonder whether it's *really*
sending ^H, or whether something is trying to be clever/pretty.  (Yeah,
I can find this out in other ways, so this isn't much of an argument.)

I guess I just think that it's more consistent, when converting ASCII
codes to keysyms, to leave them as their Ctrl equivalents -- if you
follow the line of reasoning that says that ^H should be turned into
backspace, should you then also turn ^L into ClearScreen?

I'd argue that the low level tty code should not do anything "smart"
with any of the ASCII codes.  If you want to prettify things by
referring to ^I as tab, then do that via the function-key-map, where you
can change the behavior later from lisp, if you decide that it turned
out not to be such a good idea.

> > I don't think this should require any C changes; I think that it can
> > probably all be done in Lisp, unless there is some hardcoded remapping
> > in the tty code right now (I don't know whether there is.)  Assuming
> > the tty C code isn't second-guessing us, function-key-map should provide
> > the only hook necessary to implement this.  Then it's just a matter of
> > putting a nice API on it.
> 
> You need the C code to look at termio, and to remove the C-? -> QKdelete
> dependency.  Once you do the latter, other code may also break.

For termio, can't you just spawn an "stty" process and parse its output?

The QKdelete thing has got to go eventually, but maybe for proof of
concept, that could be hacked around with function-key-map.

	== Jamie

