From xemacs-m  Sat Jun  7 15:25:56 1997
Received: from mail.cis.ohio-state.edu (mail.cis.ohio-state.edu [164.107.8.55])
	by xemacs.org (8.8.5/8.8.5) with SMTP id PAA05060
	for <xemacs-beta@xemacs.org>; Sat, 7 Jun 1997 15:25:56 -0500 (CDT)
Received: from straycat.cis.ohio-state.edu (straycat.cis.ohio-state.edu [164.107.142.7]) by mail.cis.ohio-state.edu (8.6.7/8.6.4) with ESMTP id QAA08841; Sat, 7 Jun 1997 16:25:25 -0400
Received: (ware@localhost) by straycat.cis.ohio-state.edu (8.8.0/8.6.4) id QAA09018; Sat, 7 Jun 1997 16:25:25 -0400 (EDT)
To: Hrvoje Niksic <hniksic@srce.hr>
Cc: Glynn Clements <glynn@sensei.co.uk>,
        XEmacs Developers <xemacs-beta@xemacs.org>
Subject: Re: delete vs. backspace
References: <m2u3jc762w.fsf@altair.xemacs.org> 	<kigd8pzgwip.fsf@jagor.srce.hr> <199706070246.DAA00568@cerise.sensei.co.uk> <kigenafruh6.fsf@jagor.srce.hr>
From: Pete Ware <ware@cis.ohio-state.edu>
Date: 07 Jun 1997 16:25:23 -0400
In-Reply-To: Hrvoje Niksic's message of 07 Jun 1997 04:56:53 +0200
Message-ID: <vwmbu5iqhxo.fsf_-_@straycat.cis.ohio-state.edu>
Lines: 76
X-Mailer: Gnus v5.4.55/XEmacs 20.3(beta3)

[I use the key labelled "delete" to delete backward.  I remember years
ago having to train my fingers to do this (thanks to Emacs using
control-h as help).  Damn it, I'm not going to relearn that again.]

Let me explain what I see of as the problem and why I like Gary's
implementation.

Terminology

keysym		the label printed on the key
character	An ASCII value (octal: 08 == ^H, 0177 == ^?)

The problem is we have three keysyms:

	backspace
	delete
	help

and two characters:

	07	aka ASCII backspace (^H)
	0177	aka ASCII delete

but we only have three things in Emacs we'd like to invoke:

	help
	delete-backward
	delete-forward

Given five different symbols, you wouldn't think there'd be a problem
mapping them to 3 different actions, would you?  The problem is, of
course, that some people (e.g. myself) like the keysym delete to
delete-backward and other people want it to delete-forward.  We are
stuck in Emacs with providing a binding for the keysym delete before
the user has a chance to indicate which they'd prefer (possibly even
change it on the fly).  This is why I like Gary's solution: it binds a
single function (conceptually) to the keysym delete and then lets a
user option specify which of two behaviours it uses.

At the C code level, I think it is a very bad thing to map one keysym
into another.  It just leads to exactly the sort of confusion we've
been dealing with -- suddenly a new keyboard type (X11) is able to
generate a bunch of new, useful symbols.  We try and map the new
keysyms to old keysyms and once they are useful, start trying to map
the old keysyms to the new ones on devices that don't support it.
This is exactly what function-key-map should accomplish on a
per-console basis and function-key-map should be modified based on the
actual terminal type of the console.

I think the idea of looking at the tty settings to ``_guess_'' at
whether the user means for the delete keysym to delete-forward
(i.e. if the erase character is anything but 0177) or delete-backward
(if the erase character is 0177) is fine as long as it doesn't
override what the user explitely set.  In other words, code such as:

	(if (and (eq delete-erases-forward 'unknown)
		 (eq tty-erase-char ?0177))
		(setq delete-erases-forward nil))

is fine since if I (setq delete-erases-forward t) in my .emacs it will 
hold for every console I'm on.

To deal with the keysym backspace vs. keysym help vs. character 07,
again I think it is up to function-key-map to deal with that.  Keysym
help should always invoke help, keysym backspace should always invoke
delete-backward and let the per console function-key-map deal with
whether character 07 generates keysym help or keysym backspace or just
07 (which probaby isn't bound to anything!).  Yes, someone is going to
have to fix the lisp code that hardcodes the character 07 to test for
help.

[I think I made a mistake in bringing up the issue of the character 07
 and the keysym help.   I like Gary's solution and ignoring what I
 said about help, it should support what he is doing.]

--pete

