[net.emacs] Proposal for key bindings

dick@tjalk.UUCP (Dick Grune) (04/24/86)

1. INTRODUCTION

At this moment we, the authors, have at our disposal 7 emacses, all
slightly or more than slightly different in their key bindings, enough
to confuse novice and expert alike. Emacs's great strength, its
programmability, turns into a weakness and chaos rages. In an
attempt to bring some order into this chaos we have drawn up the
complete lists of initial key bindings of each emacs (i.e. the
bindings the unsuspecting user gets when he just calls the specific
emacs) and printed them side by side, on a virtual piece of paper,
210 columns wide.  Upon examination, patterns began to emerge, and
we have observed the following.

1.	Almost all elementary functions, functions "that every emacs
should have," are always bound to the same keys, ^H and ^Z being the
only problems. These key bindings are brought together in Class A in
the proposal.

2.	Most of the non-essential functions have a "home", a binding
about which a majority of the emacses agree. Those for which a home
could be identified are grouped in Class B.

3.	All emacses agree that ^X- or ESC- followed by a capital
letter is either bound to nothing or to the same function as ^X- or
ESC- followed by the corresponding small letter.

4.	None of the emacses recognizes the problems caused by the fact
that on some systems ^S and ^Q are preempted by the terminal
communication, as X-OFF and X-ON. Any emacs should supply reasonable
alternatives.

This has led us to submit the attached proposal, which is
accompanied by a rationale.  We are very interested to receive
reactions from any interested party.  We will summarize to the net,
or, if too many people think this is a bad idea, shut up.

				Dick Grune		dick@vu44.UUCP
				Sjoerd Mullender	sjoerd@vu44.UUCP
				Vrije Universiteit
				de Boelelaan 1081
				1081 HV  Amsterdam
				the Netherlands


2. PROPOSAL

	Proposal for recommended key bindings in emacs-like editors.

SCOPE
The recommendations in this proposal apply to the key bindings as
they appear initially --upon calling the editor-- to the user who has
given no customization or initialization information.

This proposal is NOT to be construed as a recommendation against
differing local or personal key bindings, and is intended solely to
reduce confusion in the unsuspecting user and as matter for
consideration to future emacs authors.

The editor functions are grouped into 3 classes, according to their
relative importance:

	Class A: functions the user can expect to be present.
	Class B: optional functions, which the user can nevertheless
		expect to be present in a wordprocessor/development
		environment.
	Class C: highly optional or specialized features, which are
		common enough for a recommendation to be in order.

In addition to these classes, two general recommendations are given.

Class A:

	Character commands:
	^B	backward character
	^D	delete next character
	^F	forward character
	^T	transpose characters
	^?	delete previous character

	Line commands:
	^A	beginning of line
	^E	end of line
	^K	kill to end of line

	Intra-line commands:
	^N	next line
	^P	previous line

	Word commands:
	ESC-b	backward word
	ESC-d	delete next word
	ESC-f	forward word
	ESC-^?	delete previous word

	Window commands:
	^V	next page
	^Z	scroll forward
	^X-1	delete other windows
	^X-2	split window
	^X-d	delete window
	^X-n	next window
	^X-o	other window
	^X-p	previous window
	ESC-^V	page next window
	ESC-,	beginning of window
	ESC-.	end of window
	ESC-<	beginning of file
	ESC->	end of file
	ESC-v	previous page
	ESC-z	scroll backward

	Buffer commands:
	^X-^B	list buffers
	^X-b	switch to buffer
	^X-k	kill buffer

	File commands:
	^X-^F	find file
	^X-^I	insert file
	^X-^M	write modified files
	^X-^R	read file
	^X-^S	save file
	^X-^W	write named file

	Region commands:
	^@	set mark
	^W	delete region to internal buffer
	^Y	yank from internal buffer
	^X-^X	exchange cursor and mark

	White space commands:
	^I	tab
	^J	insert newline and indent
	^M	insert newline
	^O	insert newline and backup

	Search commands:
	^R	search reverse
	^S	search forward
	ESC-q	query replace string
	ESC-r	replace string

	Miscellaneous commands:
	^C	exit
	^X-^C	exit
	^L	redraw screen
	^Q	quote next character
	^U	argument prefix
	^^	replacement for ^Q
	^\	replacement for ^S		(or vice versa?)
	^]	alternate prefix
	
	^G	abort
	^X-^G	abort
	ESC-^G	abort

Class B:

	Word commands:
	ESC-t	transpose words

	Sentence commands:
	^X-^?	kill to beginning of sentence
	ESC-a	backward sentence
	ESC-e	forward sentence
	ESC-k	kill sentence

	Paragraph commands:
	ESC-[	backward paragraph
	ESC-]	forward paragraph
	ESC-j	justify paragraph

	Window commands:
	^X-^	enlarge window

	Region commands:
	ESC-w	copy region to internal buffer
	ESC-^W	delete region to end of internal buffer

	Case commands:
	^X-^L	lower case region
	^X-^U	upper case region
	ESC-c	capitalize word
	ESC-l	lower case word
	ESC-u	upper case word

	White space commands:
	^X-^O	delete blank lines
	ESC-\	delete horizontal space

	Macro commands:
	^X-(	start keyboard macro
	^X-)	stop keyboard macro
	^X-e	execute keyboard macro

	Internal editor commands:
	ESC-ESC	evaluate internal expression
	ESC-x	execute internal command

	Information commands:
	^X-=	display cursor position
	ESC-?	help

	System commands:
	^X-^E	compile
	^X-^N	next error
	^X-!	give command to command interpreter
	^_	call command interpreter

Class C:

	Line commands:
	^X-^T	transpose lines
	ESC-m	go to first non-blank

	Buffer commands:
	ESC-~	buffer not modified

	Information commands:
	^X-*	print version number

	Abbreviations:
	^X-^A	add local abbreviation
	^X-^H	inverse add local abbreviation
	^X-+	add global abbreviation
	^X--	inverse add global abbreviation

	Layout control:
	^X-.	set indent column
	^X-;	set comment column
	^X-f	set fill column
	ESC-;	indent to comment column

	Scroll sideways:
	^X-<	scroll left
	^X->	scroll right

	Parentheses:
	ESC-^B	backward parenthesis
	ESC-^F	forward parenthesis



CAPITAL LETTERS IN A PREFIXED COMMAND
Key strokes consisting of a prefix (^X or ESC) followed by a capital
letter should not be bound.  If this is found very inconvenient,
they should be bound to the same command as the prefix followed by
the corresponding small letter.

^S AND ^Q
All key bindings that include a ^S or ^Q should have a corresponding
binding with ^\ substituted for ^S and ^^ for ^Q.  If possible, this
substitution should be hard-wired (to be switched off on request);
if not, appropriate explicit bindings should be supplied.

END OF PROPOSAL


3. RATIONALE

3.1 The concept
The reason for this proposal at all is the same as that for any
standard: some design decisions are to a large extend arbitrary, and
to reduce the ensuing complexity, additional artificial order has to
be imposed.  We feel that the subject has at present reached a
certain maturity and has not yet petrified.

3.2 The approach
We have considered the initial key bindings of
	emacs2.10 (Unipress/Gosling),
	jove (Jonathan Payne/Unison World),
	PerfectWriter (Perfect Software),
	MicroEmacs (Curt Jutzi, jutz@pogo),
	GNU (Richard M. Stallman),
	scame (Leif Samuelsson, leif@erisun),
	MicroEMACS (conroy@dec-rex).
For Class A and B we only considered those key bindings that were
defined in at least four of the above. The key bindings for which no
rationale is given below were either unanimous or defined by some
and not contradicted by any of the others.

We have not concerned ourselves with small semantic differences:
"next-paragraph" will go to the beginning of the next paragraph on
some editors and to the end of this paragraph on others;
"transpose-characters" may transpose cursor[-2..-1] or
cursor[-1..0], etc. These are considered the same, since the user
has direct optical feedback.

3.3 Specific key bindings
^H is left unbound. It is usually bound to backwards-character or to
delete-previous-character, without clear preference for either.  Both
of these are available under other keys (^B and ^?).  Users working
on low-grade telephone lines may need to avoid ^? since it is often
generated by noise; in this case they may bind
delete-previous-character to ^H and unbind ^?.

^Z
Some systems have the possibility to suspend a running process; this
action is traditionally coupled to the ^Z key. It is, however, not
at all universal and requires considerable OS support. We feel
therefore that we can still use ^Z (and its compagnion ESC-z) for
scrolling  --with suspending, calling command interpreters, etc.,
bound to ^_ .

^]
Most editors do not use a third prefix besides ^X and ESC; among
those that do, there is no consensus, with ^H, ^Z, ^\, ^^ and ^X-4
being used.  ^] is not used by any editor for anything.

^X-^F, ^X-^R
Generally there exist two commands, "read file into new buffer" and
"read file into existing buffer", called "find file" and "read file"
respectively here.  They are bound to various permutations of ^X-^F,
^X-^R and ^X-^V, the latter being called "visit file", but being
identical to "find file". The proposed assignment seems more
mnemonic and seems to have a slight majority.


3.4 Capital letters in a prefixed command
The beginning user would have difficulty in telling apart ^X-^S,
^X-s, ^X-S, ESC-^S, ESC-s and ESC-S, with assorted meanings like
save-file, forward-search, call-spelling-checker, center-line or
scratch-buffer.  Some tutorials print ^X-S when they mean ^X-s.
Some terminals with function keys send ESC-@ to ESC-O for them,
which should remain free for special applications.

3.5 ^S and ^Q
^S and ^Q are used by some communication protocols and will then
cause a great deal of confusion, both to the user and to the
computer.  It seems preferable to lift this problem out of the user
realm and into the editor.

It is disturbing that we have seen editors that have the mapping
	^S -> ^\		^Q -> ^^
and those that have
	^S -> ^^		^Q -> ^\
We specifically request more advice and information from the emacs
community.

END OF RATIONALE

ron@brl-sem.ARPA (Ron Natalie <ron>) (04/29/86)

I would recommend ^Q -> ^^ and ^S -> ^\ as this seems to be done for
GNU, UNIPRESS, and Jove (which seem to be a large portion of the market).

I would also like to endorse that ^@  (NULL) be grouped into the same
category.  There are terminals/systems that can not use NULL as an
input character.  We have gotten the JOVE and UNIPRESS people to add
ESC-SPACE as an alternate binding to set mark.  I would like to see this
added to your proposal.

oz@yetti.UUCP (Ozan Yigit) (04/29/86)

Dick Grune & company posted a proposal for a "minimal" compatibility
bindings, which, I think, is an excellent idea. (Oh brother.. now
watch for the flooood in net.emacs !!! :-) Considering the
number of functions Emacs & like editors have, plus all the exotic
bindings that can be created, a minimal set of common bindings is
the only way to ensure swithover from one brand of emacs to another
without loss of productivity.

I have, however, few reservations about how this set of bindings are
determined:
	- various emacs & like editors considered, but it seems all
	  had equal weight in the final set. If this is the case,
	  very popular emacs bindings are effected by those that may
	  not be as popular. My impression is that the bindings
	  available in GNUemacs, GoslingEmacs & Jove should have more
	  *bias* in the final set of common bindings than, say
	  scame & microemacs. [Btw. I consider the Conroy version as
	  the only true-microemacs.]

	- Other emacses *must* be considered. There are several other
	  emacs-like editors in the market, along with others floating
	  in the circuit: Elle and Montgomery's. Perhaps people on this
	  newsgroup would provide the necessary binding information.


I have not had the time to consider the proposed bindings, so nothing
to say there. I hope a minimally complete set of bindings could be
found. (Will it be called common-emacs ?? Perhaps anything that does
not include the eventually-found-common-bindings should come with a
warning from surgeon-general :-))

oZ
-- 
The best way to have a 		Usenet: [decvax|ihnp4]!utzoo!yetti!oz
good idea is to have a 		Bitnet: oz@[yusol|yuyetti].BITNET
lot of ideas.			Phonet: [416] 667-3976

leif@erisun.UUCP (Leif Samuelsson) (05/09/86)

In brief: Make a "Common Emacs Standard" independent of operating
	  system. Ban C-S and C-Q. Keep one key for "Prefix Control".
	  Keep M-[ (and maybe M-O) open for function keys.
	  Let C-Z be a prefix.

Being the author of one of the editors mentioned, I must say that I
would like very much to see a common standard for key bindings.
When I wrote Scame back in 1980, I had only RMS' original Twenex
EMACS and the TOPS-10 look-alike called AMIS to compare with. These
had the same key bindings, and since we used both these operating
systems as well as Unix at the time, I chose to make as little
deviations from this standard as possible.

I think it is essential that the basic standard does not include
anything that is operating system specific. There must be a common
set of operators which work on any Emacs a user may choose to use
on any operating system.

Therefore, the use of C-S and C-Q must be banned from the basic set
right from the beginning. I sort of like the idea of having C-_ be
"I-Search Forward" and C-\ be "I-Search Backward" since C-_ is
placed on "control-slash" on many keyboards and C-\ is placed on
"control backslash" in many countries (not mine).

I would also like a key reserved for "Prefix Control", since many
keyboards can't send all control characters. As I am writing this
article on my screwed-up Tele-Tec keyboard, I constantly use the
sequence C-^ @ to set the mark. (Which works fine, but I can never
get over the feeling of not having a C-D key).

Scame does not have the function "Suspend" bound to any key as
default. This is because Scame is restartable anyway, and many
machines do not have job control. I personally use C-C for exit,
C-X C-Z for suspend and M-+ for push to shell.

In order to be able to map ANSI function keys, the standard should
provide for the use of M-[ as a prefix. Since the popular VT100
terminal also uses M-O to start escape sequences, then maybe this
should also be kept open.

So what do we do with C-Z ?  I say keep it as a prefix character.
Allow the user to make up his own set of two-stroke commands from
the vast set of unbound functions and macros available.


-----
Leif Samuelsson		enea!erix!erisun!leif
			(From July 1986: sun!lsamuelsson)

styborsk@hpspkla.UUCP (05/13/86)

If you are going to ban ^S/^Q due to their use in XON/XOFF flow control,
you should also ban ^F due to its use in ENQ/ACK.  ^F (ACK) gets eaten
while ^E (ENQ) passes thru ok.  This may be antiquated or of limited 
importance, but it exists.  If you bind something to ^F, at least provide
an alternative.

Randy Styborski
hpspkla!styborsk

P.S.- How about banning character protocols in general? ;-)