Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!mnetor!uunet!munnari!mundoe!glf From: glf@mundoe.mu.oz (Giuseppe Fiusco) Newsgroups: comp.emacs Subject: key bindings for MicroEMACS(3.8i) (1 of 3) Message-ID: <302@mundoe.mu.oz> Date: Wed, 9-Sep-87 03:02:08 EDT Article-I.D.: mundoe.302 Posted: Wed Sep 9 03:02:08 1987 Date-Received: Fri, 11-Sep-87 01:00:52 EDT Organization: Mathematics, Melbourne Uni, Australia Lines: 398 These are the files and diffs required to implement the programmable key bindings that I advertised a couple of weeks. They come in three files. The first (this one) contains various bits and pieces required ie. the Makefile, a binding description file and some general information. The second contains complete copies of the files bind.c and isearch.c that should replace the originals while the third contains standard diffs for the other files (use patch). To anyone prepared to risk implementing these changes - Good Luck :-) Giuseppe Fiusco ACSnet: glf@mundoe.mu UUCP: {uunet,mcvax,ukc,ubc-vision}!munnari!mundoe.mu.oz!glf ARPA: munnari!mundoe.mu.oz!glf@uunet.css.gov CSNET: glf%mundoe.mu.oz@csnet-relay : ---------------------------------------- cut here echo x - "Readme" 2>&1 sed "s/^X//" >"Readme" <<'!The!End!' XThis is a description of how to use the changes made to MicroEMACS(3.8i) Xto allow the key bindings for functions to be loaded in from a startup Xdescription file. It describes the various changes to some of the syntax Xin the functions that have been effected by the changes, this is mainly Xthose routines contained in the file bind.c. X XThe binding file. X XThe binding file contains a description of what series of key-strokes are Xbound to what functions within the editor. The binding file (whose name Xis defined in the file epath.h) contains various commands for the setting Xup the key bindings and for obtaining a preloaded binding format. X XThe binding file is treated as a macro-file so you must follow the rules for Xmacros when defining your file ie you may use all of the clauses and Xdefinitions that are allowed in macros. As the binding file is the first Xthing that is read in from a file there is no display window so the display Xcommand ($discmd) has been turned off. It is turned back on after the Xbinding file has been read in. X XThe commands that have been added to allow for the bindings to be used Xand installed are : X Xcore This command causes the preloaded emacs to dump core. X This core file can then be used to create a preloaded X editor where the standard key bindings are set. X Xdigit A dummy routine that is used to tell whether the user X wishes to type a number argument before the command. X ie To allow the old sequences M-0...M-9,M-- to be X replaced by any set of key-strokes. X Xdummy A dummy routine that can be used for adding bindings to X greater depths if the user is adding them directly from X the keyboard. X Xspecial-char Allows the definition of special character codes so that X terminals that emit a strange character in its function X keys can be bound (up to eight). X Xuniversal-argument Although this already existed it is now used to X define key-bindings that will invoke the universal X argument handling routines. X XSpecial characters (special-char) X XThere are eight special character code values that may be defined by using Xthis command. The command has the format X Xspecial-char code-number code-value X XNote that the code-number is modulo 8 (0 - 7) and that the code-value is Xmodulo 256 (0 - 255). Eg to define define the amiga special character you Xwould use X Xspecial-char 0 155 X XTo obtain access to these values in the key bindings you use the definition X\0 - \7 to describe the particular special key. X XThis command may be placed anywhere in the bindings file. X XDumping core (core) X XThis causes a core dump of a preloaded MicroEMACS file. This core file can Xthen be turned into an executable file. This allows the system administrator Xto set up a default preloaded version of the editor (perhaps with all of the Xstandard key definitions for MicroEMACS) and then for each individual user to Xhave a small definitions file that may add bindings particular to their Xtastes and terminal ie direction and function keys. X XAt the moment this can only be achieved on BSD systems as it requires the Xpreviously distributed undump program. X XBinding Keys (bind-to-key) X XThis command allows a function as described in the function binding table to Xbe mapped onto any particular series of key-strokes. The overall advantage of Xthis is that allows the editor to be totally customizable by the end user so Xlong as he is using an pure version of the editor ie not preloaded. If the Xeditor is a preloaded version then there are a few small restrictions. The Xcommand has the following format X Xbind-to-key function-name key-strokes X XThe function-name is that which is defined in the binding table while the Xkey-strokes consists of a description of the keys that are bound to the Xfunction. The following is allowed when describing a key. X X\e - escape X\n - linefeed X\r - carriage return X\0 - \7 - special characters X\\ - the character '\' X\^ - the character '^' X^? - control character (where ? is in the range [A - Z]) X XSome examples of valid keystroke definitions. X X\e[C escape [ C The key sequence generated by the right arrow key X on a VT100 keyboard. X\e^X escape control-X X^X1 control-X 1 Single window (EMACS command) X^Y control-Y Yank (EMACS command) X XThis allows the user to place all of his standard bindings in the binding Xfile and terminal specific keys in the startup file with perhaps a method Xof query for the different terminals. eg. X X set %term "Terminal : " X !if &sequal @%term "vt100" X bind-to-key forward-character \e[C X . . . X !endif X !if &sequal %term "vt52" X bind-to-key forward-character \eC X . . . X !endif X XBecause the method used in the key bindings is dual linked list structure it Xis far better to place all of the heavily used bindings at the front of the Xbindings file eg in standard MicroEMACS you would have at least one Meta X(escape) and one control-X at the beginning of the file. X XDon't forget that in the macro description language that the character '~' Xhas special significance and must be used with caution. This is not Ximportant when just using the command from the keyboard. X XSome important changes X XWith this new method MicroEMACS no longer understands things such as XSPEC & META as far as describing keys (although a meta key does still Xexist). X XThe command META-n where is a digit no longer forces emacs into Xargument mode. This is achieved by binding a particular set of keys to Xthe dummy routine "digit". Thus to get MicroEMACS to behave as it did Xbefore, you bind the keys to the appropriate digit. eg X Xbind-to-key digit \e0 Xbind-to-key digit \e1 X . . . Xbind-to-key digit \e9 Xbind-to-key digit \e- X Xbut this selection is up to the user and they are not forced into any Xparticular selection. Similarly with the universal argument which may be Xbound using the dummy function "universal". eg. X Xbind-to-key universal-argument ^U X XBUGS X==== X XProbably lots - mail when you find them please. X XThe syntax of certain commands, especially when defining key bindings has Xchanged to a large amount. X XAt the moment the binding increase the size of the file by a large amount X(much more than expected due to the stdio library mallocs for buffer space). XThis only increases the size of the binary (slow startup time) but means Xthat most of the internal buffers have already been allocated. If this Xcauses a problem then it should be pretty easy to rectify. X XSome of the patches sent out do not seem relevant but are in fact some small Xchanges I made to help with implementing some EDT like functions. I will Xprobably post these out once I feel they are working properly. They in no Xway effect the current usage of MicroEMACS. X X XGood luck to those of you prepared to risk using these hacks. Please let me Xknow of any improvements or other suggestions you have. X XWhat you get. X------------- X XYou recieve complete copies of the files bind.c and isearch.c that will Xreplace your current copies. You will also recieve diffs of all the other Xfiles that have been changed. These files are edef.d, efunc.d, estruct.d, Xeval.d, exec.d, input.d, main.d and random.d. You can remove the file Xebind.h as that is no longer necessary. You will also recieve copies of the Xadditional files that are now required and a new version of the Makefile. !The!End! echo x - "makefile" 2>&1 sed "s/^X//" >"makefile" <<'!The!End!' XCFLAGS= -O X XOFILES= ansi.o basic.o bind.o buffer.o crypt.o dg10.o \ X display.o edtem.o eval.o exec.o file.o fileio.o \ X hp110.o hp150.o ibmpc.o input.o isearch.o line.o \ X lock.o main.o random.o region.o search.o spawn.o \ X st520.o tcap.o termio.o tipc.o vmsvt.o vt52.o \ X window.o word.o z309.o X XCFILES= ansi.c basic.c bind.c buffer.c crypt.c dg10.c \ X display.c edtem.c eval.c exec.c file.c fileio.c \ X hp110.c hp150.c ibmpc.c input.c isearch.c line.c \ X lock.c main.c random.c region.c search.c spawn.c \ X st520.c tcap.c termio.c tipc.c vmsvt.c vt52.c \ X window.c word.c z309.c X XHFILES= estruct.h edef.h efunc.h epath.h evar.h X Xemacs: $(OFILES) X $(CC) $(CFLAGS) $(OFILES) -ltermcap -lc -o emacs X X$(OFILES): $(HFILES) !The!End! echo x - "emacs.bind" 2>&1 sed "s/^X//" >"emacs.bind" <<'!The!End!' Xbind-to-key abort-command ^G Xbind-to-key add-mode ^XM Xbind-to-key add-global-mode \eM Xbind-to-key apropos \eA Xbind-to-key backward-character ^B Xbind-to-key begin-macro ^X( Xbind-to-key beginning-of-file \e< Xbind-to-key beginning-of-line ^A Xbind-to-key bind-to-key \eK Xbind-to-key buffer-position \e= Xbind-to-key case-region-lower ^X^L Xbind-to-key case-region-upper ^X^U Xbind-to-key case-word-capitalize \eC Xbind-to-key case-word-lower \eL Xbind-to-key case-word-upper \eU Xbind-to-key change-file-name ^XN Xbind-to-key change-screen-size \e^S Xbind-to-key change-screen-width \e^T Xbind-to-key clear-and-redraw ^L X; bind-to-key clear-message-line Xbind-to-key copy-region \eW Xbind-to-key count-words \e^C Xbind-to-key delete-blank-lines ^X^O Xbind-to-key delete-buffer ^XK Xbind-to-key delete-mode ^X\r Xbind-to-key delete-global-mode \e\r Xbind-to-key delete-next-character ^D Xbind-to-key delete-next-word \eD Xbind-to-key delete-other-windows ^X1 Xbind-to-key delete-previous-character ^H Xbind-to-key delete-previous-word \e^H Xbind-to-key delete-window ^X0 X; bind-to-key describe-bindings Xbind-to-key describe-key ^X? Xbind-to-key detab-line ^X^D Xbind-to-key end-macro ^X) Xbind-to-key end-of-file \e> Xbind-to-key end-of-line ^E Xbind-to-key entab-line ^X^E Xbind-to-key exchange-point-and-mark ^X^X X; bind-to-key execute-buffer X; bind-to-key execute-command-line X; bind-to-key execute-file Xbind-to-key execute-macro ^XE X; bind-to-key execute-macro-1 X; bind-to-key execute-macro-2 X; bind-to-key execute-macro-3 X; bind-to-key execute-macro-4 X; bind-to-key execute-macro-5 X; bind-to-key execute-macro-6 X; bind-to-key execute-macro-7 X; bind-to-key execute-macro-8 X; bind-to-key execute-macro-9 X; bind-to-key execute-macro-10 X; bind-to-key execute-macro-11 X; bind-to-key execute-macro-12 X; bind-to-key execute-macro-13 X; bind-to-key execute-macro-14 X; bind-to-key execute-macro-15 X; bind-to-key execute-macro-16 X; bind-to-key execute-macro-17 X; bind-to-key execute-macro-18 X; bind-to-key execute-macro-19 X; bind-to-key execute-macro-20 X; bind-to-key execute-macro-21 X; bind-to-key execute-macro-22 X; bind-to-key execute-macro-23 X; bind-to-key execute-macro-24 X; bind-to-key execute-macro-25 X; bind-to-key execute-macro-26 X; bind-to-key execute-macro-27 X; bind-to-key execute-macro-28 X; bind-to-key execute-macro-29 X; bind-to-key execute-macro-30 X; bind-to-key execute-macro-31 X; bind-to-key execute-macro-32 X; bind-to-key execute-macro-33 X; bind-to-key execute-macro-34 X; bind-to-key execute-macro-35 X; bind-to-key execute-macro-36 X; bind-to-key execute-macro-37 X; bind-to-key execute-macro-38 X; bind-to-key execute-macro-39 X; bind-to-key execute-macro-40 Xbind-to-key execute-named-command \eX Xbind-to-key execute-procedure \e^E Xbind-to-key exit-emacs ^X^C Xbind-to-key fill-paragraph \eQ Xbind-to-key filter-buffer ^X# Xbind-to-key find-file ^X^F Xbind-to-key forward-character ^F Xbind-to-key goto-line \eG Xbind-to-key goto-matching-fence \e^F Xbind-to-key grow-window ^X\^ Xbind-to-key handle-tab ^I X; bind-to-key hunt-forward X; bind-to-key hunt-backward Xbind-to-key help \e? Xbind-to-key i-shell ^XC Xbind-to-key incremental-search ^XS Xbind-to-key insert-file ^X^I Xbind-to-key insert-space ^C X; bind-to-key insert-string Xbind-to-key kill-paragraph \e^W Xbind-to-key kill-region ^W Xbind-to-key kill-to-end-of-line ^K Xbind-to-key list-buffers ^X^B Xbind-to-key move-window-down ^X^N Xbind-to-key move-window-up ^X^P Xbind-to-key name-buffer \e^N Xbind-to-key newline \r Xbind-to-key newline-and-indent \n Xbind-to-key next-buffer ^XX Xbind-to-key next-line ^N Xbind-to-key next-page ^V Xbind-to-key next-paragraph \eN Xbind-to-key next-window ^XO Xbind-to-key next-word \eF Xbind-to-key open-line ^O Xbind-to-key pipe-command ^X@ Xbind-to-key previous-line ^P Xbind-to-key previous-page ^Z Xbind-to-key previous-paragraph \eP Xbind-to-key previous-window ^XP Xbind-to-key previous-word \eB Xbind-to-key query-replace-string \e^R Xbind-to-key quick-exit \eZ Xbind-to-key quote-character ^Q Xbind-to-key read-file ^X^R Xbind-to-key redraw-display \e^L Xbind-to-key resize-window ^XW X; bind-to-key restore-window Xbind-to-key replace-string \eR Xbind-to-key reverse-incremental-search ^XR Xbind-to-key run \e^E Xbind-to-key save-file ^X^S X; bind-to-key save-window Xbind-to-key scroll-next-up \e^Z Xbind-to-key scroll-next-down \e^V Xbind-to-key search-forward ^S Xbind-to-key search-reverse ^R Xbind-to-key select-buffer ^XB Xbind-to-key set ^XA Xbind-to-key set-encryption-key \eE Xbind-to-key set-fill-column ^XF X; bind-to-key set-mark Xbind-to-key shell-command ^X! Xbind-to-key shrink-window ^X^Z Xbind-to-key split-current-window ^X2 X; bind-to-key store-macro X; bind-to-key store-procedure Xbind-to-key transpose-characters ^T Xbind-to-key trim-line ^X^T Xbind-to-key unbind-key \e^K Xbind-to-key unmark-buffer \e~~ X; bind-to-key update-screen Xbind-to-key view-file ^X^V X; bind-to-key wrap-word Xbind-to-key write-file ^X^W X; bind-to-key write-message Xbind-to-key yank ^Y !The!End! exit