1Article 22465 of comp.emacs:
2Path: mozo.cc.purdue.edu!purdue!haven.umd.edu!news.umbc.edu!europa.eng.gtefsd.com!emory!swrinde!pipex!demon!sni.co.uk!jlk
3Newsgroups: comp.emacs
4From: jlk@sni.co.uk (Jim Kissel)
5Subject: Brief Emulation for MicroEAMCS (long)
6X-Mailer: ELM [version 2.4 PL11]
7Content-Type: text
8Content-Length: 26049
9Date: Fri, 22 Jul 1994 11:34:49 +0000
10Message-ID: <9407221242.AA21806@dolphin.sni.co.uk>
11Sender: usenet@demon.co.uk
12Lines: 1126
13
14Subject: Brief Emulation for MicroEMACS (long)
15Newsgroups: comp.emacs comp.editors
16Summary:
17Keywords:
18
19This is the first release of an emulation of Brief for MicroEMACS.  The
20emulation comes in three parts.
21
22   1)  Description of the emulation
23   2)  Table of functions and keybinds supported
24   3)  emacsrc file which provides the emulation
25
26questions/gripes/comments/suggestions/bugs to Jim Kissel  jlk@sni.co.uk
27whinges/flames to /dev/null
28
29enjoy
30
31----------------Description of Brief Emulation----------------------------
32
33
34The idea behind a Brief emulation for MicroEMACS was to provide as near
35as identical an editing environment for Unix as is available using
36Brief on MS-DOS without recource to modifications to the existing source
37code.  All of the emulation is based on macros and procedures implemented
38in the emacsrc startup file.  During the development of this emulation, it
39became apparent that a number of useful features of Brief, could not be
40emulated using the 3.12 release.  Most noteable were
41
42	Brief startup/shutdown saving of which files were being edited
43			and
44	an Undo facility.
45
46These features and other minor improvements will be provided in a furture
47release of this emulation. The UNDO command is being BETA tested and if
48Dan Lawerence agrees the other minor changes to make MicroEMACS behave in
49a manner similar to Brief a future version of MicroEMACS will support Brief
50startup/shutdown processing as well as some other Brief features.
51
52The main compromise was the handle of the Alt key. All of the Alt key sequences
53could have been mapped to ctrl sequences and the ctrl sequences mapped in some
54other manner, or the ctrl sequences could be left as is and the Alt sequences
55simulated by using the META key (Alt-A is mapped to Esc-A, Escape followed
56the A key).  The later was choosen as the author felt that this provided the
57natural mapping.  If this isn't to your liking, just edit the emacsrc file
58and create your own alternatives for the Alt key.
59
60
61-----------Functions supported and their key binding------------------------
62
63
64Keystroke   Command                Keystroke   Command
65------------------------------------------------------------------
66Alt-a       Non-inclusive Mark    | F1          Change Window
67Alt-b       Buffer List           | F2          Resize Window
68Ctrl-b      Line to Bottom        | F3          Create Window
69Alt-c       Column Mark t.b.a.    | F4          Delete Window
70Ctrl-c      Center Line in Window | Alt-F1      Toggle Borders
71Alt-d       Delete Line           | Alt-F2      Zoom Windows
72Ctrl-d      n/a                   | F5          Search Forward
73Alt-e       Edit File             | F6          Translate Forward
74Alt-f       n/a                   | Shift-F5    Search Again
75Alt-g       Go to Line            | Shift-F6    Translate Again
76Alt-h       Help                  | Ctrl-F5     Case Sens. Toggle t.b.a
77Alt-i       Insert Mode Toggle    | Ctrl-F6     Regular Expr. Toggle
78Alt-j       Jump To Bookmark      | Alt-F5      Search Backward t.b.a
79Alt-k       Delete to End of Line | Alt-F6      Translate Backward t.b.a
80Alt-l       n/a                   | F7          Remember
81Alt-m       Mark                  | Alt-F7      n/a
82Alt-n       Next Buffer           | Shift-F7    n/a
83Ctrl-n      Next Error t.b.a      | F8          Playback
84Alt-o       Change Output File    | Alt-F8      Save Keystroke Macro t.b.a
85Alt-p       n/a                   | F9          n/a
86Ctrl-p      Pop Up Error Window   | Shift-F9    n/a
87Alt-q       Quote                 | F10         Execute Command
88Alt-r       Read File             | Alt-F1      Toggle Window Borders
89Ctrl-r      Repeat                | Alt-F10     n/a
90Alt-s       Search Forward        | Home        Beginning of Line
91Alt-t       Translate Forward     | Home Home         Top of Window
92Ctrl-t      Line to Top           | Home Home Home    Top of Buffer
93Alt-u       Undo t.b.a.           | End               End of Line
94Ctrl-u      Scroll Buffer Up      | End End           End of Window
95Alt-v       Display Version ID    | End End End       End of Buffer
96Alt-w       Write                 | Shift-End   n/a
97Ctrl-w      Backup File Toggle    | Ctrl-Home   n/a
98Alt-x       Exit                  | Ctrl-End    n/a
99Ctrl-x      n/a                   | PgDn        Page Down
100Alt-z       Suspend BRIEF         | PgUp        Page Up
101Ctrl-z      Zoom Window t.b.a     | Ctrl-PgDn   n/a
102Alt-minus   n/a                   | Ctrl-PgUp   n/a
103Ctrl-minus  Delete Curr. Buffer   | Down arrow  Down
104Backspace   Backspace             | Left arrow  Left
105Ctrl-Bksp.  n/a                   | Right arrow Right
106Enter       Enter                 | Up arrow    Up
107Ctrl-Enter  Open Line             | Ctrl-Right  Next Word
108Esc         n/a                   | Ctrl-Left   Previous Word
109Tab         Tab                   | Ctrl-Break  n/a
110Shift-Tab   n/a                   |
111Alt-1       Drop Bookmark 1 t.b.a | Del         Delete
112Alt-2       Drop Bookmark 2 t.b.a | Ins         Paste from Scrap
113Alt-3       Drop Bookmark 3 t.b.a | Keypad -    Cut to Scrap
114  .             .                 | Keypad +    Copy to Scrap
115  .             .                 | Keypad *    Undo t.b.a
116Alt-0       Drop Bookmark 10 t.b.a|
117
118---------------------emacsrc the emulation---------------------------------
119
120;
121;   Brief Emulation using MicroEMACS 3.12 or higher
122;
123;   (C)opyright 1994 by Jim Kissel
124;
125;	Comments, suggestions and bugs to jlk@sni.co.uk
126;
127;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
128;
129;   Section 1  User Variables for Brief Emulation
130;
131;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
132;
133;	Brief Variables for Key Bindings
134;
135set $discmd FALSE
136
137set %bf_end     4	 ; the end key   (see end of emacsrc for info on how to)
138set %bf_home 2108	 ; the home key  (determine these values)
139set %bf_bcnt    1	 ; number of strings used by bf_ckbkup
140set %bf_bklst1  " "	 ; insure that the first backup list string exists
141set %bf_btoggle TRUE ; if TRUE backup files else don't
142
143set $sscroll TRUE
144set $hardtab 4
145set $timeflag TRUE      ; time on status line Not Brief style ;-(
146set $posflag TRUE       ; nor is the position   ;-( but it will do for now
147set %bf_macro FALSE
148
149;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
150;
151;   Section 2  General Procedure for Brief Emulation
152;
153;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
154
155;
156;    Remember the last key for HOME:HOME:HOME & END:END:END processing
157;
158store-procedure bf_home_end
159	!if &equ $lastkey %bf_end
160		set %brief_end &add %brief_end 1
161	!else
162		set %brief_end 1
163	!endif
164	!if &equ $lastkey %bf_home
165		set %brief_home &add %brief_home 1
166	!else
167		set %brief_home 1
168	!endif
169!endm
170set $cmdhook bf_home_end
171
172;
173;     Setup the correct modes for Brief
174;
175store-procedure brief_startup_mode
176	set $ssave FALSE
177	set $cmode 72	; EXACT + MAGIC or search/replace
178	set $gmode 72
179	set %bf_dot &sin $cfname "."
180	!if %bf_dot
181		set %bf_ftype &rig $cfname &sub &len $cfname %bf_dot
182		!if &or &seq "c" %bf_ftype &seq "h" %bf_ftype
183			add-mode "CMODE"
184		!endif
185	!endif
186!endm
187set $readhook brief_startup_mode
188
189;
190;     Parse the error file. Part of Ctrl-P Error processing
191;
192;     This code is OS and Compiler specific.  Currently the Brief Emulation
193;     supports the output from AT&T 5.4 and AIX compilers.  Post me other
194;     compiler error outputs for inclusion or write your one.
195;     jlk@sni.co.uk
196;
197store-procedure bf_parse_error_file
198	;
199	; this parses AT&T compiler output
200	;
201	set %bf_start &add &sin $line "line" 4
202	set %bf_len &sub &sin $line ":" %bf_start
203	set %bf_lnum &mid $line %bf_start %bf_len
204	;
205	; you get >>> 211.16<<< under AIX. Parse it some more
206	;
207	set %bf_lnum &right %bf_lnum &sub &len %bf_lnum 1
208	set %bf_lnum &left %bf_lnum &sub &sin %bf_lnum "." 1
209	;
210	; end of AIX specific parse
211	;
212	unbind-key ^M
213	bind-to-key %bf_newline ^M
214	set %bf_start &sin $line "error"
215	set %bf_error &right $line &sub $lwidth &sub %bf_start 1
216	find-screen "MAIN"
217	goto-line %bf_lnum
218	write-message %bf_error
219!endm
220
221;
222;	Store the file name in the backup string array
223;	Part of Brief Backup
224;
225;	if there is room in the last backup string
226;		store the file name
227;	else
228;		create a new backup string and increment the count
229;
230store-procedure bf_backup_str
231	set %bf_ttmp &cat "%bf_bklst" %bf_bcnt
232	!if &gre &add &len %bf_file &len &ind %bf_ttmp 127
233		set %bf_bcnt &add %bf_bcnt 1
234		set %bf_ttmp &cat "%bf_bklst" %bf_bcnt
235		set &ind %bf_ttmp &cat " " %bf_file
236	!else
237;		set %bf_tttmp &cat &ind %bf_ttmp %bf_file
238;		set &ind %bf_ttmp %bf_tttmp
239		set &ind %bf_ttmp &cat &ind %bf_ttmp %bf_file
240	!endif
241!endm
242
243;
244;	Brief Check Backup
245;
246;	Check if the current files has been backed up
247;	if it has %bf_ret is set TRUE
248;	else set %bf_ret FALSE and call bf_backup_str
249;		to add it to the list of already backed up files
250;
251store-procedure bf_ckbkup
252	set %bf_ret FALSE
253	set %bf_tmp %bf_bcnt
254	!while &not &equ %bf_tmp 0
255		;
256		;	look for the file name in the current backup string
257		;	if we find it set bf_ret TRUE and retur
258		;	else save the file name in the backup string array
259		;
260		set %bf_ttmp &cat "%bf_bklst" %bf_tmp
261		set %bf_file &fin $cfname
262		!if &not &equ &sin &ind %bf_ttmp %bf_file 0
263			set %bf_ret TRUE
264			!return
265		!else
266			bf_backup_str
267		!endif
268		set %bf_tmp &sub %bf_tmp 1
269	!endwhile
270!endm
271
272;
273;	Backup a file if $BBACKUP is set in the environment
274;	and we haven't already backed up this file
275;
276;	WARNINGS***WARNING***WARNING***WARNING***WARNING
277;
278;	If you are editing two files with the same filename
279;	the last one written will be the only one in $BBACKUP
280;	This limitation will be repaired, once it is possible to
281;	determine the fully qualified path of each file, hopefully in
282;	MicroEMACS 3.13
283;
284;	WARNINGS***WARNING***WARNING***WARNING***WARNING
285;
286store-procedure bf_bfile
287	set %bbdir &env BBACKUP
288	!if &not &equ &len %bbdir 0
289		bf_ckbkup
290		!if &ind %bf_ret TRUE
291			write-message "backup already done"
292		!else
293			write-message "Creating backup file..."
294			set %bf_cmd &cat &cat &cat "cp " %bf_file " " &env BBACKUP
295			shell-command %bf_cmd
296		!endif
297	!else
298		write-message "$BBACKUP not set"
299	!endif
300!endm
301
302
303;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
304;
305;   Section 3  KeyBindings a Specific Procedure for Brief Emulation
306;
307;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
308
309;
310;     Alt-A Non-Inclusive Mark
311;
312;     Maped to Esc-A  M-A
313;
314unbind-key M-A
315bind-to-key set-mark M-A
316
317;
318;     Ctrl-A not used by Brief
319;
320;     just unbind
321;
322unbind-key ^A
323
324;
325;     Alt-B Buffer List   Differenct from Brief Buffer List
326;
327;     Maped to Esc-B  M-B
328;
329;     note: room for improvement in the style of Brief
330;
331unbind-key M-B
332bind-to-key list-buffers M-B
333
334;
335;     Ctrl-B      Line to Bottom (of screen)
336;
337store-procedure brief-line-to-bottom
338	&sub $wline $cwline move-window-up
339!endm
340unbind-key ^B
341macro-to-key brief-line-to-bottom ^B
342
343;
344;     Alt-C  Column Mark
345;
346;     Not implemented.  Columns not supported by MicroEmacs.
347;
348
349;
350;     Ctrl-C      Centre Line in Window
351;
352store-procedure brief-centre-line
353;	&sub &div $wline 2 $cwline move-window-up ;this should work but doesn't
354    set %briefctr &sub &div $wline 2 $cwline
355    !if &les %briefctr 0
356        &abs %briefctr move-window-down
357    !else
358        %briefctr move-window-up
359    !endif
360!endm
361unbind-key ^C
362macro-to-key brief-centre-line ^C
363
364;
365;     Alt-D Delete Line
366;
367;     Maped to Esc-D  M-D
368;
369store-procedure brief-delete-line
370	set %briefcol $curcol
371	beginning-of-line
372	!if &LEN $line
373		!force kill-to-end-of-line
374		!force kill-to-end-of-line
375	!else
376		!force kill-to-end-of-line
377	!endif
378    !if &GRE %briefcol $lwidth
379		end-of-line
380	!else
381		%briefcol forward-character
382	!endif
383!endm
384unbind-key M-D
385macro-to-key brief-delete-line M-D
386
387;
388;     Ctrl-D Scroll Buffer Down not implemented
389;
390;     Ctrl-D is the same as the End key on most Unix keyboards so.......
391;
392
393;
394;     Alt-E    Edit file
395;
396;     Maped to Esc-E  M-E
397;
398bind-to-key find-file M-E
399
400;
401;     Ctrl-E is not used by Brief
402;
403;     just unbind
404;
405unbind-key ^E
406
407;
408;     Alt-F Display File Name
409;
410;     just unbind. Well is on the status line ;-)
411;
412unbind-key M-F
413
414;
415;     Ctrl-F is not used by Brief
416;
417unbind-key ^F
418
419;
420;     Alt-G Go to Line
421;
422;     Maped to Esc-G M-G
423;     wow !!! a match !!!
424;
425
426;
427;     Alt-H Help!
428;
429;     Maped to Esc-H M-H
430;     For now we use the apropos command
431;
432bind-to-key apropos M-H
433
434;
435;     Ctrl-H is backspace in both Brief and MicroEmacs
436;
437
438;
439;     Alt-I Insert Mode Toggle
440;
441;     Maped to Esc-I  M-I. Toggle insert/overtype mode
442;     Note Brief changes global modes.  This may not suit everyone
443;
444;     cmode is also set so the current buffer over/insert mode is
445;     also changed.  32 is the bitwise position of overwrite mode.
446;
447store-procedure brief-toggle-insert-mode
448	!if &ban $gmode 32
449		delete-global-mode over
450	!else
451		add-global-mode over
452	!endif
453	!if &ban $cmode 32
454		delete-mode over
455	!else
456		add-mode over
457	!endif
458!endm
459macro-to-key brief-toggle-insert-mode M-I
460
461;
462;     Ctrl-I  Tab same in Micro-Emacs!!!!
463;
464
465;
466;     Alt-J  Jump to Bookmark
467;
468;     Maped to Esc-J M-J
469;
470bind-to-key goto-mark M-J
471
472;
473;     Alt-K  Delete to End of Line
474;
475;     Maped to Esc-K M-K
476;
477unbind-key M-K
478bind-to-key kill-to-end-of-line M-K
479
480;
481;     Ctrl-K  Not used by Brief  (just unbind)
482;
483unbind-key ^K
484
485;
486;     Alt-L Line Mark  No equilvent in MicroEmacs
487;
488;     We could simulate by eol;set-mark;bol if required but this
489;     is different from Brief
490;
491unbind-key M-L
492
493;
494;     Ctrl-L Not used by Brief
495;
496unbind-key ^L
497
498;
499;     Alt-M  Mark
500;
501;     Maped to Esc-M  M-M
502;
503unbind-key M-M
504bind-to-key set-mark M-M
505
506;
507;     Ctrl-M is newline in Brief and MicroEmacs
508;
509
510;
511;     Alt-N Next Buffer
512;
513;     Maped to Esc-N M-N
514;
515store-procedure brief-next-buffer
516	!force next-buffer
517	!if $status
518		clear-message-line
519	!else
520		write-message "No other buffers."
521	!endif
522!endm
523unbind-key M-N
524macro-to-key brief-next-buffer M-N
525
526;
527;    Ctrl-N Next Error
528;
529;    Will add to the Ctrl-P processing next release
530;
531unbind-key ^N
532
533;
534;     Alt-O Change Output File
535;
536;     Maped to Esc-O  M-O
537;
538bind-to-key change-file-name M-O
539
540;
541;     Ctrl-O Not used by Brief
542;
543unbind-key ^O
544
545;
546;     Alt-O Print Block: Not supported by Micro-Emacs
547;
548;unbind-key M-P
549
550;
551;     Ctrl-P      Error Display
552;
553store-procedure bf_display_error
554	set %bf_dot &sin $cfname "."
555	!if %bf_dot
556		set %bf_ftype &rig $cfname &sub &len $cfname %bf_dot
557		!if &not &seq "c" %bf_ftype
558			write-message "No errors."
559			!return
560		!endif
561	!endif
562	set %bf_hfile $cfname
563	set %bf_tmp &left $cfname &sub &len $cfname 1
564	set %bf_filename &cat %bf_tmp "err"
565!force	find-file %bf_filename
566	!if &seq $status FALSE
567		find-file %bf_hfile
568		delete-buffer %bf_filename
569		write-message "No errors."
570	!else
571		add-mode "VIEW"
572		set %bf_newline &bind ^M
573		unbind-key ^M
574		macro-to-key bf_parse_error_file ^M
575	!endif
576!endm
577unbind-key ^P
578macro-to-key bf_display_error ^P
579
580;
581;     Alt-Q Quote
582;
583;     Maped to Esc-Q  M-Q
584;
585unbind-key M-Q
586bind-to-key quote-character M-Q
587
588;
589;     Ctrl-Q Not used by Brief
590;
591;unbind-key ^Q
592
593;
594;     Alt-R Read File
595;
596;     Maped to Esc-R M-R
597;
598unbind-key M-R
599bind-to-key insert-file M-R
600
601;
602;    Ctrl-R Repeat
603;
604unbind-key ^R
605bind-to-key universal-argument ^R
606
607;
608;    Alt-S Search Forward
609;
610;    Maped to Esc-S M-S
611;
612bind-to-key search-forward M-S
613
614;
615;    Ctrl-S not used by Brief
616;
617unbind-key ^S
618
619;
620;     Alt-T Translate Forward
621;
622;     Query-replace-string is a better match than replace-string
623;
624bind-to-key query-replace-string M-T
625
626;
627;    Ctrl-T      Line to Top (of screen)
628;
629store-procedure brief-line-to-top
630	&sub $cwline 1 move-window-down
631!endm
632unbind-key ^T
633macro-to-key brief-line-to-top ^T		; line to top (of window)
634
635;
636;     Alt-U Undo  Not currently supported by 3.12
637;
638;     But comming to a new version of MicroEMACS near you soon......
639;     Just needs some BETA testers.  Contact Jim Kissel jlk@sni.co.uk
640;
641unbind-key M-U
642bind-to-key undo M-U
643
644;
645;     Ctrl-U Scroll buffer Up
646;
647;     ^U move-window-down in MicroEmacs is the same (similar?)
648;
649bind-to-key move-window-down ^U
650
651;
652;    Alt-V Display Version Id
653;
654;    Maped to Esc-V  M-V
655;    just for those who cannot read the status line
656;
657store-procedure brief-version
658	write-message &cat $progname &cat " " $version
659!endm
660unbind-key M-V
661macro-to-key brief-version M-V
662
663;
664;    Ctrl-V not used by Brief
665;
666unbind-key ^V
667
668;
669;    Alt-W Write
670;
671;    Maped to Esc-W  M-W
672;
673store-procedure brief_save_file
674	!if &SEQ $region "ERROR"
675		!if &BAN $cbflags 2
676			!if &seq %bf_btoggle TRUE
677				bf_bfile
678			!endif
679			save-file
680		!else
681			write-message "File has not been modified -- not written."
682		!endif
683	!else
684		save-file ; for now do a write block later
685	!endif
686;	clear-message-line
687!endm
688unbind-key M-W
689macro-to-key brief_save_file M-W
690
691;
692;    Ctrl-W Backup File Toggle
693;
694store-procedure bf_back_toggle
695	!if &seq %bf_btoggle TRUE
696		write-message "Backup files will not be created."
697		set %bf_btoggle FALSE
698	!else
699		write-message "Backup files will be created."
700		set %bf_btoggle TRUE
701	!endif
702!endm
703unbind-key ^W
704macro-to-key bf_back_toggle ^W
705
706;
707;    Alt-X  Exit
708;
709;    Maped to Esc-X  M-X
710;
711unbind-key M-X
712bind-to-key exit-emacs M-X
713
714;
715;    Ctrl-X Write Files and Exit
716;
717;    t.b.a
718;
719
720;
721;    Alt-Z Suspend Brief
722;
723;    Maped to Esc-Z  M-Z  MicroEmacs i-shell
724;
725unbind-key M-Z
726bind-to-key i-shell M-Z
727
728;
729;    Ctrl-Z Zoom Window
730;
731;    missing for now (will add later)
732;
733unbind-key ^Z
734
735;
736;    Alt-minus Previous Buffer
737;
738;    Keyboard - is mapped to M--  (Alt-minus) which conflicts wiht
739;    this command.  Not implimented at present.
740;
741
742;
743;    Ctrl-minus Delete Current Buffer
744;
745store-procedure brief_delete_current_buffer
746	set %brief_buf $cbufname
747	!force next-buffer
748	!if $status
749		delete-buffer %brief_buf
750	!else
751		write-message "Can't delete: no other buffers."
752	!endif
753!endm
754macro-to-key brief_delete_current_buffer ^_
755
756;
757;    Backspace  no change from MicroEmacs
758;
759
760;
761;    Ctrl-Backspace  Delete Previous Word
762;
763;    not implemented as my terminal emulator returns the same codes for
764;    CTRL-Backspace and the Del key
765;
766
767;
768;    Enter as per MicroEmacs
769;
770
771;
772;    Ctrl-Enter Open Line
773;
774store-procedure brief_open_line
775	end-of-line
776	newline
777!endm
778unbind-key ^J
779macro-to-key brief_open_line ^J
780
781;
782;    Esc Escape
783;
784;    We are using Esc for the Alt key. ;-(  can't map
785;
786
787;
788;    Tab  as per MicroEmacs
789;
790
791;
792;    Shift-Tab is Back-Tab!  Why do anything?
793;
794
795;
796;    Alt-1 to Alt-0  Drop Bookmark n
797;
798;    We either sacrifice Repeat 1 to 10 or we have only one mark?
799;
800
801;
802;    F1 Change Window
803;
804;    not quite brief style but it goes to previous/next window via cursor keys
805;
80637 store-macro
807*bwinretry
808	write-message "Point to destination (use cursor keys)"
809	set %briefchar &gtc
810	!if &seq %briefchar FNP		; the up arrow key
811		previous-window
812	!else
813		!if &seq %briefchar FNN	; the down arrow key
814			next-window
815		!else
816;			!if $seq %briefchar &chr 7	; abort !
817;				write-message "Command canceled"
818;				!goto bwinend
819;			!else
820;write-message &cat >>> &cat %briefchar <<<
821				!goto bwinretry
822;			!endif
823;will fix this when I know how to read a ^G
824		!endif
825	!endif
826*bwinend
827!endm
828unbind-key ^XO
829unbind-key ^XP
830bind-to-key execute-macro-37 FN1
831
832;
833;    Alt F1 Toggle Borders
834;
835;    We can realy toggle to borders but we can turn off the mode line so...
836;    Maped to Esc-F1  M-FN1
837;
838;    May not work on slow terminals or over telnet. try a 1 second pause
839;    between the Esc and the F1.  ;-(
840;
841store-procedure brief_toggle_borders
842	!if $modeflag
843		set $modeflag FALSE
844	!else
845		set $modeflag TRUE
846	!endif
847	clear-and-redraw
848!endm
849macro-to-key brief_toggle_borders M-FN1
850
851;
852;    F2 Resize Window  tba
853;
854
855;
856;    Alt F2 Zoom Windows
857;
858;    Maped to Esc-F2  M-F2
859;    Just get rid of the other windows
860;
861bind-to-key delete-other-windows M-FN2
862
863;
864;    F3 Create Window
865;
866;    Not realy Brief Style
867;
868unbind-key ^X2
869bind-to-key split-current-window FN3 ; Brief Func Key 3
870
871;
872;    F4 Delete Window
873;
874;    Not realy Brief Style (yet)
875;
876bind-to-key delete-other-windows FN4
877
878;
879;    F5 Search Forward
880;
881bind-to-key hunt-forward FN5
882
883;
884;    F6 Translate Forward
885;
886bind-to-key query-replace-string FN6
887
888;
889;    F7 Remember
890;
891store-procedure bf_remember
892	!if &seq %bf_macro TRUE
893		set %bf_macro FALSE
894		end-macro
895	!else
896		set %bf_macro TRUE
897		begin-macro
898	!endif
899!endm
900macro-to-key bf_remember FN7
901
902;
903;    F8 Playback
904;
905bind-to-key execute-macro FN8
906
907;
908;    F9 Load a Macro File
909;
910
911;
912;    F-10 Execute Command
913;
914bind-to-key execute-named-command FN0
915
916;
917;    HOME           Beginning of Line
918;    HOME HOME      Teginning of Window
919;    HOME HOME HOME Beginning of Buffer
920;
921store-procedure brief_home
922	!if &equ %brief_home 1
923		beginning-of-line
924	!else
925		!if &equ %brief_home 2
926			&sub $cwline 1 previous-line
927			beginning-of-line
928
929		!else
930			beginning-of-file
931		!endif
932	!endif
933!endm
934unbind-key FN<
935macro-to-key brief_home FN<
936
937;
938;    END          End of Line
939;    END END      Emd of Window
940;    END END END  End of Buffer
941;
942store-procedure brief-end
943	!if &equ %brief_end 1
944		end-of-line
945	!else
946		!if &equ %brief_end 2
947			&sub $wline $cwline next-line
948			end-of-line
949		!else
950			end-of-file
951		!endif
952	!endif
953!endm
954unbind-key ^D
955macro-to-key brief-end ^D
956
957;
958;    Ctrl-Right  Next Word
959;
960bind-to-key next-word M-:
961
962;
963;    Ctrl-Left Previous Word
964;
965;    My terminal emulator is bizarre Ctrl-Left_Arrow_Key returns M-9
966;    so no book mark 9 for me ;-(
967;
968bind-to-key previous-word M-9
969
970;
971;    Del Delete
972;
973store-procedure bf_delete
974	!if &SEQ $region "ERROR"
975		!force delete-next-character
976	!else
977		!if &LEN $region
978			kill-region
979			remove-mark	; otherwise you could kill another region when you move
980		!else
981			delete-next-character
982		!endif
983	!endif
984	clear-message-line
985!endm
986unbind-key ^?
987macro-to-key bf_delete ^?
988
989;
990;    Ins  Paste from Scrap
991;
992unbind-key FNC
993bind-to-key yank FNC
994
995;
996;    Keypad -
997;
998;    Maped to Esc -  M--
999;
1000store-procedure bf_keypad_minus
1001	!if &SEQ $region "ERROR"
1002		beginning-of-line
1003		!if &LEN $line
1004			!force kill-to-end-of-line
1005			!force kill-to-end-of-line
1006		!else
1007			!force kill-to-end-of-line
1008		!endif
1009		write-message "Line cut to scrap."
1010	!else
1011		!if &LEN $region
1012			kill-region
1013			remove-mark	; otherwise you could kill another region
1014			write-message "Block deleted to scrap."
1015		!else
1016			!if &LEN $line
1017				!force kill-to-end-of-line
1018				!force kill-to-end-of-line
1019			!else
1020				!force kill-to-end-of-line
1021			!endif
1022			write-message "Line cut to scrap."
1023		!endif
1024	!endif
1025!endm
1026macro-to-key bf_keypad_minus M--
1027
1028;
1029;    Keypad +
1030;
1031;    Maped to Esc +  M-+
1032;    WARNING changes MARK 0 & 1
1033;    to make this work we need either a $MARKCOL[] $MARKLINE[]
1034;    or you need to write more code to save the marks before the copy
1035;
1036store-procedure bf_keypad_plus
1037	!if &SEQ $region "ERROR"
1038		1 set-mark
1039		beginning-of-line
1040		set-mark
1041		next-line
1042		copy-region
1043		previous-line
1044		1 exchange-point-and-mark
1045		remove-mark
1046		1 remove-mark
1047		write-message "Line copied to scrap."
1048	!else
1049		!if &LEN $region
1050			copy-region
1051			remove-mark
1052			write-message "Block copied to scrap."
1053		!else
1054			set %brief_col $curcol
1055			beginning-of-line
1056			set-mark
1057			next-line
1058			copy-region
1059			previous-line
1060			beginning-of-line
1061			%brief_col forward-character
1062			remove-mark
1063			write-message "Line copied to scrap."
1064		!endif
1065	!endif
1066!endm
1067macro-to-key bf_keypad_plus M-+
1068
1069
1070;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1071;
1072;   Section 4  Non-Brief useful MicroEMACS bindings
1073;
1074;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1075
1076bind-to-key goto-matching-fence M-%			; matching fence
1077bind-to-key tag-word ^]						; vi c-tag
1078bind-to-key back-from-tag-word ^^			; vi c-tag
1079
1080;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1081;
1082;   Section 5  Brief Emulation Comments
1083;
1084;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1085;
1086; Functions not implemented
1087;
1088; Alt-C Set Column Mark. Colums not (yet) supported in Micro-Emacs
1089; Ctrl-D is returned by the END key so no Brief "Scroll Buffer Down"
1090; Alt-E "Display File Name" as the emacs status line handles this
1091; Alt-P "Print Block" not available in micro-emacs
1092; Alt-U "Undo" not available in micro-emacs (current in BETA test)
1093; Ctrl-X "Write Files and Exit" conflict with emacs ^X
1094; Shift Tab as my terminal emulator doesn't do this
1095; bookmarks as they must be entered via the universal-argument method
1096; Shift-End not in my terminal emulator
1097;
1098
1099;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1100;
1101;   Section 6  Brief Startup
1102;
1103;   Requires modification to MicroEMACS 3.12 source to provide .emacsrc
1104;	with some information on how many arguments where passed at startup.
1105;	At present in my ALPHA source tree there is a new environment varialbe
1106;   $argcnt which contains the number of arguments passed to MicroEMACS
1107;	at startup. If $argcnt == 1 then no files as arguments, so restore
1108;   the previous files stored in the file pointed at by $BFILE as per BRIEF
1109;
1110;   Hopefully Dan Lawerence will agree to incorporate this into the next
1111;   release of MicroEMACS.  Brief Startup will also require Brief Shutdown
1112;
1113;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1114
1115;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1116;
1117;   Section 7  Brief Exit
1118;
1119;	In order to store the information required by Brief Startup, a new
1120;   environment variable $exithook will have to be provided.  This will
1121;	allow a macro to loop through all the current buffers and store the
1122;	required information on each file in $BFILE for processing during
1123;	startup if required.  Again this is under ALPHA test and may be
1124;	incorporated in the next release of MicroEMACS
1125;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1126
1127set $discmd TRUE
1128
1129;
1130;   uncomment to determine value of keys
1131;
1132;store-procedure bf_test
1133;	write-message "Type a key: "
1134;	write-message &cat "The key value is: " $lastkey
1135;!endm
1136;macro-to-key bf_test ^L
1137---------------------end of emacsrc------------------------------------------
1138
1139
1140
1141
1142