From xemacs-m  Mon Jun  2 21:17:05 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 VAA12272
	for <xemacs-beta@xemacs.org>; Mon, 2 Jun 1997 21:17:04 -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 TAA14720
	for <xemacs-beta@xemacs.org>; Mon, 2 Jun 1997 19:16:34 -0700 (PDT)
Received: from gimp ([205.217.227.11]) by dredd.mcom.com
          (Netscape Mail Server v2.02) with SMTP id AAA23071;
          Mon, 2 Jun 1997 19:16:31 -0700
Sender: jwz@netscape.com (Jamie Zawinski)
Message-ID: <33937E67.26E11F89@netscape.com>
Date: Mon, 02 Jun 1997 19:16:07 -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>
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Hrvoje Niksic wrote:
> 
> Since my name is mentioned, I'll now try to define once and for all
> exactly what I mean under "properly implemented".
> 
> 1) Running under X
> 
>    a) If the keyboard has distinct Backspace and Delete keysyms, backspace
>       will delete backwards, whereas Delete will delete forward;
> 
>    b) Else, the available key (whichever it is) will delete backwards;
> 
>    c) In either case, Backspace will generate a correct backspace
>       XEmacs event, and Delete will generate a correct delete XEmacs
>       event.

I agree.

> 2) Running under TTY-s
> 
>    a) If TTY settings say that ^H should mean erase, then C-h will
>       erase backwards.  Help will be on M-?, and C-? and delete
>       (usually \e[3~) will delete forward.

Ok...

>       ### The actual implementation of this is unclear to me; should
>       C-h actually be backspace?  Should one be able to differentiate
>       between C-? and `\e[3~'?  Yes and yes, probably.

Yes and yes.  Someone calling (next-event) should see multiple events,
for '\e', then for '[', etc.

However, (read-key-sequence) would return `delete', due to the contents
of `function-key-map'.

(I don't think this part is complicated or controversial, do you?)

>    b) Else, XEmacs will disregard the TTY settings (no, I don't like
>       `#' meaning delete-backward on SYSV), and retain the normal C-h
>       binding.  `C-?' will then delete backwards.  What `\e[3~' will
>       do is open to discussion.

\e[3~ should get mapped to ^? as always, and do whatever ^? does.

>       ### C-? should probably not be hardcoded to Delete.  C-? and
>       `\e[3~' should probably be distinguishable.

By read-event yes, by read-key-sequence no.

What do you mean by "hardcoded"?  All of this is a matter of what is in
function-key-map, right?

> 3) Usage and Implementation
> 
>    a) XEmacs should know the proper names of its keys.  For example,
>       pressing backspace on a TTY and on X should generate a message
>       like: `backspace runs the command delete-backward-char', even if
>       the user pressed C-h.  When the user presses C-? or \e[3~, it
>       should not be masqueraded as C-d.

No, that doesn't work; for example, switch the sense so that the
sentence reads, "for example, pressing C-h on a TTY and on X should
generate a message like 'C-h runs ..."

There's no way to do the right thing on ttys.  The information is gone.

I don't think it's a big deal whether the tty code refers to (both) 
C-h and Backspace as (either) C-h or Backspace; but it's a judgement
call, one is no more right than the other.

However, telling the user "\e[3~ runs ..." is just going to confuse
people, so obviously that one should be avoided.

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.


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.

-- 
Jamie Zawinski    jwz@netscape.com   http://www.netscape.com/people/jwz/
What the world needs now is killfiles that actually kill. -Craig Dickson

