From xemacs-m  Mon Jun  2 22:46:34 1997
Received: from jagor.srce.hr (hniksic@jagor.srce.hr [161.53.2.130])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id WAA13200
	for <xemacs-beta@xemacs.org>; Mon, 2 Jun 1997 22:46:33 -0500 (CDT)
Received: (from hniksic@localhost)
          by jagor.srce.hr (8.8.5/8.8.4)
	  id FAA17429; Tue, 3 Jun 1997 05:46:18 +0200 (MET DST)
To: Jamie Zawinski <jwz@netscape.com>
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>
X-Attribution: Hrv
X-Face: Mie8:rOV<\c/~z{s.X4A{!?vY7{drJ([U]0O=W/<W*SMo/Mv:58:*_y~ki>xDi&N7XG
        KV^$k0m3Oe/)'e%3=$PCR&3ITUXH,cK>]bci&<qQ>Ff%x_>1`T(+M2Gg/fgndU%k*ft
        [(7._6e0n-V%|%'[c|q:;}td$#INd+;?!-V=c8Pqf}3J
X-Tom-Swifty: "Turn that fan off," Tom said coldly.
From: Hrvoje Niksic <hniksic@srce.hr>
Date: 03 Jun 1997 05:46:17 +0200
In-Reply-To: Jamie Zawinski's message of Mon, 02 Jun 1997 19:16:07 -0700
Message-ID: <kign2p8qrg6.fsf@jagor.srce.hr>
Lines: 97
X-Mailer: Gnus v5.4.52/XEmacs 20.2

Jamie Zawinski <jwz@netscape.com> writes:

> >       ### 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?)

I don't, but it's not what's currently being done.  See below.

> >    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.

As to the return of `read-key-sequence', yes.

> >       ### 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?

NO.  That's a part of the problem.  These two lines are from events.c:

  else if (c == 127)
    k = QKdelete;

So, if you press `C-?', it's delete, end of story.

> >    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 ..."

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.

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.

> 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.

Definitely.  The only difference is that I regard \e[3~ and C-h like
the same.

> 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.

> 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.

Also, putting a nice API and making Lisp conform to it may prove tough.

-- 
Hrvoje Niksic <hniksic@srce.hr> | Student at FER Zagreb, Croatia
--------------------------------+--------------------------------
Contrary to popular belief, Unix is user friendly.  
It just happens to be selective about who it makes friends with.

