home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume6 / uemacs3.7 / part08 < prev    next >
Encoding:
Internet Message Format  |  1986-11-30  |  43.0 KB

  1. Subject: v06i078:  MicroEmacs, Version 3.7 (uEmacs3.7), Part08/12
  2. Newsgroups: mod.sources
  3. Approved: rs@mirror.UUCP
  4.  
  5. Submitted by: ihnp4!pur-ee!pur-phy!duncan!lawrence
  6. Mod.sources: Volume 6, Issue 78
  7. Archive-name: uEmacs3.7/Part08
  8.  
  9. [  This is the latest revision of one of two programs named "MicroEmacs";
  10.    when discussing these on the net, or in contacting the authors, make
  11.    sure to mention the version number -- in this case 3.7 -- as that is
  12.    the easiest way to distinguish between them.  Daniel will be posting
  13.    uuencoded executables in net.micro.pc and net.micro.amiga; the file
  14.    'readme' contains information on how to also get these from him
  15.    directly.   --r$ ]
  16.  
  17. echo extracting - main1.c
  18. sed 's/^X//' > main1.c << 'FRIDAY_NIGHT'
  19. X/*
  20. X * This program is in public domain; written by Dave G. Conroy.
  21. X * This file contains the main driving routine, and some keyboard processing
  22. X * code, for the MicroEMACS screen editor.
  23. X *
  24. X * REVISION HISTORY:
  25. X *
  26. X * 1.0  Steve Wilhite, 30-Nov-85
  27. X *      - Removed the old LK201 and VT100 logic. Added code to support the
  28. X *        DEC Rainbow keyboard (which is a LK201 layout) using the the Level
  29. X *        1 Console In ROM INT. See "rainbow.h" for the function key defs
  30. X *      Steve Wilhite, 1-Dec-85
  31. X *      - massive cleanup on code in display.c and search.c
  32. X *
  33. X * 2.0  George Jones, 12-Dec-85
  34. X *      - Ported to Amiga.
  35. X *
  36. X * 3.0  Daniel Lawrence, 29-Dec-85
  37. X *      - rebound keys/added new fast buffered I/O for AMIGA
  38. X *    - added META- repeat commands
  39. X *    - added reposition default to center screen (yeah!)
  40. X *    - changed exit with modified buffers message
  41. X *    - made filesave tell us what it is doing
  42. X *    - changed search string entry to terminate with <ESC>
  43. X *      so we can use <NL> in search/replace strings
  44. X *    - updated version number in mode line to 3.0
  45. X *    12-Jan-86
  46. X *    - Added code to reconize the Search/replace functions
  47. X *    - Added code to perform search/replace & query functions
  48. X *    14-Jan-86
  49. X *    - moved search logic to separate function in search.c
  50. X *    - added replace and query replace functions
  51. X *    - separated out control key expansions to be used by others in search.c
  52. X *    15-Jan-86
  53. X *    - changed "visiting" to finding
  54. X *    - changed yes/no responces to not need return
  55. X *    - cleaned up various messages
  56. X *    16-jan-86
  57. X *    - fixed spurious spawn message in MSDOS
  58. X *    - added ^X-S synonime to save command
  59. X *    - moved escape to shell to ^X-C
  60. X *    21-jan-86
  61. X *    - added code to suspend shell under BSD
  62. X *    22-jan-86
  63. X *    - added function key support (SPEC) under MSDOS
  64. X *    - Abort now prints [Aborted] on message line
  65. X *    23-jan-86
  66. X *    - Added modes and commends to set/unset them
  67. X *    24-jan-86
  68. X *    - Added Goto Line command
  69. X *    - added Rename Buffer command
  70. X *    28-jan-86
  71. X *    - added goto begining and end of paragraph commands (META-P/META-N)
  72. X *    - re-wrote kdelete to use realloc. gained MUCH speed here when
  73. X *      doing large wipes both on UNIX and MSDOS. Changed kill buffer
  74. X *      allocation block size from 256 bytes to 1 k
  75. X *    29-jan-86
  76. X *    - moved extern function declarations to efunc.h
  77. X *    - made name[] name binding table
  78. X *    30-jan-86
  79. X *    - fixed Previous/Next paragraph command not to wrap around EOF
  80. X *    - added Fill Paragraph command (META-Q)
  81. X *    4-feb-86
  82. X *    - added code to properly display long lines, scrolling them right
  83. X *      to left
  84. X *    5-feb-85
  85. X *    - rewrote code to right/left scroll...much better
  86. X *    - added shifted arror keys on IBMPC
  87. X *    6-feb-85
  88. X *    - add option to allow forword-word to jump to begining of
  89. X *      next word instead of end of current one. This is different from
  90. X *      other emacs' but can be configured off in estruct.h
  91. X *    - added VIEW mode to allow a buffer to be read only
  92. X *       (-v switch on command line will activate this)
  93. X *    - changed quick exit to write out ALL changed buffers!!!
  94. X *      MAKE SURE YOU KNOW THIS WHEN META-Zing
  95. X *    10-feb-86
  96. X *    - added handling of lines longer than allowed on file read in
  97. X *      (they wrap on additional lines)
  98. X *    - made having space clear the message line and NOT insert itself
  99. X *      a configuration option in ed.h
  100. X *    11-feb-86
  101. X *    - added Describe-command and Help commands.
  102. X *    13-feb-86
  103. X *    - added View file command (^X ^V) and finished HELP command
  104. X *    14-feb-86
  105. X *    - added option to let main loop skip update if type ahead commands
  106. X *       are queued up
  107. X *    16-feb-86
  108. X *    - added Insert File command
  109. X *    17-feb-86
  110. X *    - added scroll next window up/down commands
  111. X *    18-feb-86
  112. X *    - added CMODE indentation
  113. X *    - re-arranged header files to standerdize extern and global
  114. X *      definitions
  115. X *    - changed version number to 3.2
  116. X *    - added numeric arguments to search, reverse search and
  117. X *      search and replace
  118. X *    24-feb-86
  119. X *    - added Bind To Key function (^C for now) to allow the user
  120. X *      to change his command keys
  121. X *    - added Unbind key function (M-^C for now)
  122. X *    - added execute named command to execute unbound commands (M-X)
  123. X *    - added describe bindings command (not bound)
  124. X *    - changed version number to 3.3
  125. X *    25-feb-86
  126. X *    - scrapped CERROR mode (too many compilers)
  127. X *    - added EXACT mode for case sensitive searchers
  128. X *    26-feb-86
  129. X *    - added command completion on execute named command and
  130. X *      all routined grabbing a command name
  131. X *    - adding execute-command-line command and its support functions
  132. X *      (in preporation for sourcing files)
  133. X *    - added Execute Buffer command
  134. X *    27-feb-86
  135. X *    - added execute(source) file command and added code to automatically
  136. X *      execute emacs.rc (or .emacsrc on UNIX) before initial read in
  137. X *    - changed version number to 3.4
  138. X *    4-mar-86
  139. X *    - changed word delete to be consistant with word move (it gets
  140. X *      rid of the inter word space now) This is configurable with the
  141. X *      NFWORD symbol in estruct.h
  142. X *    - added B_ACTIVE entry to the buffer table. Let emacs read multiple
  143. X *      file names from the command line and only read them in as needed
  144. X *    5-mar-85
  145. X *    - rewrote command line parser to get rid of my patchy code
  146. X *    - changed version number to 3.5
  147. X *    1-apr-86
  148. X *    - added support for Aztec C 3.20e under MSDOS
  149. X *    - fixed bug in mlwrite on ADM3's and thier ilk under V7
  150. X *    - added insertion of pounds in column one under CMODE
  151. X *    - changed version number to 3.6
  152. X *    3-apr-86
  153. X *    - added next-buffer command (^X-X)
  154. X *    5-apr-86
  155. X *    - added kill paragraph command (M-^W)
  156. X *    - changed fill-paragraph to leave 2 spaces after a period at the
  157. X *      end of a word.
  158. X *    - added OVERWRITE mode
  159. X *    7-apr-86
  160. X *    - fixed overwrite mode to handle tabs
  161. X *    8-apr-86
  162. X *    - added add/delete global mode (<ESC>M & <ESC> ^M) commands
  163. X *    9-apr-86
  164. X *    - added insert space command
  165. X *    - moved bindings around        ^C    insert space
  166. X *                    M-K    bind-to-key
  167. X *                    INSERT    insert space
  168. X *                    DELETE    forwdel
  169. X *    - added hunt forward and hunt reverse commands
  170. X *    10-apr-86
  171. X *    - fixed bug in DOBUF with non-terminated command string
  172. X *    15-apr-86
  173. X *    - fixed tab expansion bug in DISPLAY which hung the AMIGA
  174. X *      (send in by Dawn Banks)
  175. X *    - fixed curcol problen if forwline/backline during keyboard
  176. X *      macro execution (sent in by Ernst Christen)
  177. X *    - added AMIGA function/cursor key support
  178. X *    - fixed nonterminating <NL> replacement bug
  179. X *    - fixed word wrapping problems
  180. X *    16-apr-86
  181. X *    - updated documentation and froze development for 3.6 net release
  182. X *    23-apr-86    version 3.6a
  183. X *    - added forground and background colors. Setable with the
  184. X *      add mode commands for the moment
  185. X *    24-apr-86
  186. X *    - added command to pipe CLI output to a buffer
  187. X *    25-apr-86
  188. X *    - added Dana Hoggat's code to replace lattice's sick system()
  189. X *      function, now we no longer care what the switchar is.
  190. X *    - cleaned up the positioning on several of the spawing commands
  191. X *    26-apr-86
  192. X *    - added a output flush in vttidy(). Unix really appreciates this.
  193. X *    - added filter-buffer (^X#) command to send a buffer through
  194. X *      a dos filter
  195. X *    - made automatic CMODE on .c and .h file compilation dependant
  196. X *      in estruct.h
  197. X *    1-may-86
  198. X *    - optimized some code in update(). It certainly need a lot more.
  199. X *    - added AZTEC profiling capabilities. These are conditional on
  200. X *      the APROF symbol in estruct.h
  201. X *    2-may-86
  202. X *    - added (u)ndo command in query-replace. undoes last repalce.
  203. X *    6-may-86
  204. X *    - re-orginized and wrote the update() function in display.c
  205. X *      now my color hacks are in the right places and the code can be
  206. X *      understood.
  207. X *    [Released version 3.6f for BETA test sites]
  208. X *    8-may-86
  209. X *    - fixed bug in new display routine to wrap cursor on extended
  210. X *      lines at the right time
  211. X *    - modified the buffer-position command to give reasonable info
  212. X *    9-may-86
  213. X *    - improved the word wrap algorithm as not to discard non-space
  214. X *      delimiters. The backscan now looks for white space rather than
  215. X *      !inword().
  216. X *    [Released version 3.6g to Krannert]
  217. X *    10-may-86
  218. X *    - Added IBMPC.C an IBM-PC specific display driver. This makes paging
  219. X *      4-6 times faster. Also made some conditional changes to DISPLAY.C
  220. X *      to eliminate the pscreen[] if using the PC driver.
  221. X *    [changed version number to 3.6i]
  222. X *    12-may-86
  223. X *    - added delete-window (^X 0) command to dispose of a single window
  224. X *    - fixed problem with multiple prefixes from a command line which
  225. X *      was reported by John Gamble
  226. X *    14-may-86
  227. X *    - Added AZTEC support for the IBMPC display driver. Had to
  228. X *      readjust some includes and defines for this.
  229. X *    - fixed bug in delete-window.
  230. X *    - fixed some bizarre behavior with the cursor after coming back
  231. X *      from spawn calls.
  232. X *    [changed version number to 3.7 Freezing development for net release]
  233. X *    15-may-86
  234. X *    - (that didn't last long...) Added execute-macro-(1 thru 20) commands
  235. X *      to execute macro buffers (named "[Macro nn]")
  236. X *    - changed BFTEMP to BFINVS and cleaned up treatment of invisable
  237. X *      buffers.
  238. X *    16-may-86
  239. X *    - added store-macro (unbound) to store any executed command lines to
  240. X *      macro buffer.
  241. X *    - added clear-message-line (unbound) command to do just that
  242. X *    - added resize-window command to change a window's size to the
  243. X *      specified argument
  244. X *    - improved help's logic not to re-read the file if it was already
  245. X *      in a buffer
  246. X *    - added MAGIC mode to all structures and command tables, but the
  247. X *      regular expression code that John Gamble is writting is not ready.
  248. X *    18-may-86
  249. X *    - added interactive prompt requests in command line execution. IE
  250. X *      while executing a macro, a parameter starting with an at sign (@)
  251. X *      causes emacs to prompt with the rest of the parameter and return
  252. X *      the resulting input as the value of the parameter.
  253. X *    - added arguments to split-current-window to force the cursor into
  254. X *      the upper or lower window.
  255. X *    20-may-86
  256. X *    - added support for the Microsoft C compiler as per the changes
  257. X *      send in by Oliver Sharp
  258. X *    - made some upgrades and fixes for VMS sent in by Guy Streeter
  259. X *    21-may-86
  260. X *    - fixed an AZTEC bug in ttgetc by clearing the upper byte
  261. X *    - fixed buf in CMODE with #preprocesser input (bug fix submitted by
  262. X *      Willis of unknown path)
  263. X *    - added support of alternative startup file ( @<filename> ) in
  264. X *      the command line
  265. X *    - added ^Q quoting in interactive input (mlreplyt()).
  266. X *    - added re-binding of meta-prefix and ctlx-prefix
  267. X *    22-may-86
  268. X *    - reorginize getkey routines to make more sense and let prefix
  269. X *      binding work properly.
  270. X *    23-may-86
  271. X *    - checked new code on BSD4.2 made a few fixes
  272. X *    - added optional fence matching while in CMODE
  273. X *    - added goto and search command line arguments by Mike Spitzer
  274. X *    26-may-86
  275. X *    - added parameter fetching from buffers
  276. X *    27-may-86
  277. X *    - fixed some HP150 bugs......
  278. X *    31-may-86
  279. X *    - Added Wang PC keyboard support from modifications by
  280. X *      Sid Shapiro @ Wang Institute
  281. X *    - Fixed some reverse video bugs with code submitted by Peter Chubb
  282. X *    - Fixed bug in nextbuffer reported by Dave Forslund
  283. X *    - added system V support (USG) from Linwood Varney
  284. X *    2-jun-86
  285. X *    - changed defines to just define one unix define (for example,
  286. X *      just define BSD for Unix BSD 4.2)
  287. X *    - Added Incremental search functions written by D. R. Banks
  288. X *      in file ISEARCH.C
  289. X *    - added insert-string (unbound) command to help the macro
  290. X *      language out.
  291. X *    - added unmark-buffer (M-~) command to turn off the current buffers
  292. X *      change flag
  293. X *    - fixed nxtarg to truncate strings longer than asked for max length
  294. X *    4-jun-86
  295. X *    - added special characters in command line tokens. Tidle (~) is
  296. X *      the special leadin character for "nrtb".
  297. X *    - Fixed bad ifdef in aztec code so it could look at HOME dir
  298. X *      for startup, help, and emacs.rc files
  299. X *    6-jun-86
  300. X *    - make delete word commands clear the kill buffer if not after another
  301. X *      kill command
  302. X *    11-jun-86
  303. X *    - made ~@ in string arguments pass as char(192) to nxtarg() so one can
  304. X *      quote @ at the begining of string arguments
  305. X *    - changed buffer size vars in listbuffers() to long (for big files)
  306. X *    - re-wrote buffer-position command to be much faster
  307. X *    12-jun-86
  308. X *    - added count-words (M-^C) command to count the words/chars and
  309. X *      lines in a region
  310. X *    - changed regions so they could be larger than 65535 (short ->
  311. X *      long in the REGION structure)
  312. X *    - changed ldelete() and all callers to use a long size. The kill
  313. X *      buffer will still have a problem >65535 that can not be solved
  314. X *      until I restructure it.
  315. X *    - grouped paragraph commands and word count together under symbol
  316. X *      WORDPRO to allow them to be conditionally made (or not)
  317. X *    13-jun-86
  318. X *    - re-wrote kill buffer routines again. Now they support an unlimited
  319. X *      size kill buffer, and are (in theory) faster.
  320. X *    - changed delete-next-word (M-D) to not eat the newline after a word,
  321. X *      instead it checks and eats a newline at the cursor.
  322. X *    17-jun-85
  323. X *    - added numeric argument to next/previous-window to access the nth
  324. X *      window from the top/bottom
  325. X *    - added support for the data General 10 MSDOS machine
  326. X *    - added save-window (unbound) and restore-window (unbound) commands
  327. X *      for the use of the menu script. Save-window remembers which window
  328. X *      is current, and restore-window returns the cursor to that window.
  329. X *    20-jun-86
  330. X *    - fixed a bug with the fence matching locking up near the begining
  331. X *    of a buffer
  332. X *    - added argument to update to selectivaly force a complete update
  333. X *    - added update-screen (unbound) command so macros can force a
  334. X *      screen update
  335. X *    21-jun-86
  336. X *    - rearranged token() and nxtarg() calls so that command names and
  337. X *      repeat counts could also be prompted and fetched from buffers
  338. X *    - added write-message (unbound) command to write out a message
  339. X *      on the message line (for macros)
  340. X *    - changed ifdef's so that color modes are reconized as legal in
  341. X *      b/w version, and simply do nothing (allowing us to use the same
  342. X *      script files)
  343. X */
  344. X
  345. X#include        <stdio.h>
  346. X
  347. X/* make global definitions not external */
  348. X#define    maindef
  349. X
  350. X#include        "estruct.h"    /* global structures and defines */
  351. X#include    "efunc.h"    /* function declarations and name table    */
  352. X#include    "edef.h"    /* global definitions */
  353. X#include    "ebind.h"    /* default key bindings */
  354. X
  355. X#if     VMS
  356. X#include        <ssdef.h>
  357. X#define GOOD    (SS$_NORMAL)
  358. X#endif
  359. X
  360. X#ifndef GOOD
  361. X#define GOOD    0
  362. X#endif
  363. X
  364. X#if    APROF    /* Declarations needed for AZTEC C profiling */
  365. Xint _Corg();    /* first address of program */
  366. Xint _Cend();    /* last address of program */
  367. X
  368. Xshort monbuf[NBUCK];    /* buffer for gather info */
  369. X#endif
  370. X
  371. Xmain(argc, argv)
  372. Xchar    *argv[];
  373. X{
  374. X        register int    c;
  375. X        register int    f;
  376. X        register int    n;
  377. X        register int    mflag;
  378. X    register BUFFER *bp;
  379. X    register int    ffile;        /* first file flag */
  380. X    register int    carg;        /* current arg to scan */
  381. X    register int    startf;        /* startup executed flag */
  382. X    int basec;            /* c stripped of meta character */
  383. X    int viewflag;            /* are we starting in view mode? */
  384. X        int gotoflag;                   /* do we need to goto a line at start? */
  385. X        int gline;                      /* if so, what line? */
  386. X        int searchflag;                 /* Do we need to search at start? */
  387. X        char bname[NBUFN];        /* buffer name of file to read */
  388. X
  389. X#if    APROF
  390. X    /* if we are doing AZTEC C profiling, start it up */
  391. X    /*_intr_sp(18);     set clock interupt for 60/second */
  392. X    monitor(_Corg, _Cend, monbuf, NBUCK, 0);
  393. X#endif
  394. X
  395. X    /* initialize the editor and process the command line arguments */
  396. X        strcpy(bname, "main");    /* default buffer name */
  397. X        vtinit();        /* Displays.            */
  398. X        edinit(bname);        /* Buffers, windows.    */
  399. X    viewflag = FALSE;    /* view mode defaults off in command line */
  400. X    gotoflag = FALSE;    /* set to off to begin with */
  401. X    searchflag = FALSE;    /* set to off to begin with */
  402. X    ffile = TRUE;        /* no file to edit yet */
  403. X    startf = FALSE;        /* startup file not executed yet */
  404. X#if    COLOR
  405. X    curwp->w_fcolor = gfcolor;        /* and set colors    */
  406. X    curwp->w_bcolor = gbcolor;
  407. X#endif
  408. X    
  409. X    /* scan through the command line and get the files to edit */
  410. X    for (carg = 1; carg < argc; ++carg) {
  411. X        /* if its a switch, process it */
  412. X        if (argv[carg][0] == '-') {
  413. X            switch (argv[carg][1]) {
  414. X                case 'v':    /* -v for View File */
  415. X                case 'V':
  416. X                    viewflag = TRUE;
  417. X                    break;
  418. X                case 'e':    /* -e for Edit file */
  419. X                case 'E':
  420. X                    viewflag = FALSE;
  421. X                    break;
  422. X                case 's':    /* -s for initial search string */
  423. X                case 'S':
  424. X                    searchflag = TRUE;
  425. X                    strcpy(pat,&argv[carg][2]);
  426. X                    break;
  427. X                case 'g':    /* -g for initial goto */
  428. X                case 'G':    
  429. X                    gotoflag = TRUE;
  430. X                    gline = atoi(&argv[carg][2]);
  431. X                    break;
  432. X                default:    /* unknown switch */
  433. X                    /* ignore this for now */
  434. X                    break;
  435. X            }
  436. X        } else     /* check for a macro file */
  437. X            if (argv[carg][0]== '@') {
  438. X
  439. X            if (startup(&argv[carg][1]) == TRUE)
  440. X                startf = TRUE;    /* don't execute emacs.rc */
  441. X
  442. X        } else {    /* process a file name */
  443. X            /* if we haven't run emacs.rc, do it now */
  444. X            if (startf == FALSE) {
  445. X                startup("");
  446. X                startf = TRUE;
  447. X            }
  448. X
  449. X            /* set up a buffer for this file */
  450. X                    makename(bname, argv[carg]);
  451. X
  452. X            /* if this is the first file, read it in */
  453. X            if (ffile) {
  454. X                bp = curbp;
  455. X                makename(bname, argv[carg]);
  456. X                strcpy(bp->b_bname, bname);
  457. X                strcpy(bp->b_fname, argv[carg]);
  458. X                if (readin(argv[carg], (viewflag==FALSE))
  459. X                                == ABORT) {
  460. X                    strcpy(bp->b_bname, "main");
  461. X                    strcpy(bp->b_fname, "");
  462. X                }
  463. X                bp->b_dotp = bp->b_linep;
  464. X                bp->b_doto = 0;
  465. X                ffile = FALSE;
  466. X            } else {
  467. X                /* set this to inactive */
  468. X                bp = bfind(bname, TRUE, 0);
  469. X                strcpy(bp->b_fname, argv[carg]);
  470. X                bp->b_active = FALSE;
  471. X            }
  472. X
  473. X            /* set the view mode appropriatly */
  474. X            if (viewflag)
  475. X                bp->b_mode |= MDVIEW;
  476. X        }
  477. X    }
  478. X
  479. X    /* if invoked with nothing, run the startup file here */
  480. X    if (startf == FALSE) {
  481. X        startup("");
  482. X        startf = TRUE;
  483. X    }
  484. X        /* Deal with startup gotos and searches */
  485. X        if (gotoflag && searchflag) {
  486. X            update(FALSE);
  487. X        mlwrite("[Can not search and goto at the same time!]");
  488. X    }
  489. X        else if (gotoflag) {
  490. X                if (gotoline(NULL,gline) == FALSE) {
  491. X                    update(FALSE);
  492. X            mlwrite("[Bogus goto argument]");
  493. X        }
  494. X        } else if (searchflag) {
  495. X                if (forscan(&pat[0], 2) == FALSE) {
  496. X                    update(FALSE);
  497. X            mlwrite("Not found.");
  498. X        }
  499. X        }
  500. X
  501. X    /* setup to process commands */
  502. X        lastflag = 0;                           /* Fake last flags.     */
  503. X    curbp->b_mode |= gmode;            /* and set default modes*/
  504. X    curwp->w_flag |= WFMODE;        /* and force an update    */
  505. X#if    COLOR
  506. X    curwp->w_fcolor = gfcolor;        /* and set colors    */
  507. X    curwp->w_bcolor = gbcolor;
  508. X#endif
  509. X
  510. Xloop:
  511. X        update(FALSE);                          /* Fix up the screen    */
  512. X        c = getcmd();
  513. X        if (mpresf != FALSE) {
  514. X                mlerase();
  515. X                update(FALSE);
  516. X#if    CLRMSG
  517. X                if (c == ' ')                   /* ITS EMACS does this  */
  518. X                        goto loop;
  519. X#endif
  520. X        }
  521. X        f = FALSE;
  522. X        n = 1;
  523. X
  524. X    /* do META-# processing if needed */
  525. X
  526. X    basec = c & ~META;        /* strip meta char off if there */
  527. X    if ((c & META) && ((basec >= '0' && basec <= '9') || basec == '-')) {
  528. X        f = TRUE;        /* there is a # arg */
  529. X        n = 0;            /* start with a zero default */
  530. X        mflag = 1;        /* current minus flag */
  531. X        c = basec;        /* strip the META */
  532. X        while ((c >= '0' && c <= '9') || (c == '-')) {
  533. X            if (c == '-') {
  534. X                /* already hit a minus or digit? */
  535. X                if ((mflag == -1) || (n != 0))
  536. X                    break;
  537. X                mflag = -1;
  538. X            } else {
  539. X                n = n * 10 + (c - '0');
  540. X            }
  541. X            if ((n == 0) && (mflag == -1))    /* lonely - */
  542. X                mlwrite("Arg:");
  543. X            else
  544. X                mlwrite("Arg: %d",n * mflag);
  545. X
  546. X            c = getcmd();    /* get the next key */
  547. X        }
  548. X        n = n * mflag;    /* figure in the sign */
  549. X    }
  550. X
  551. X    /* do ^U repeat argument processing */
  552. X
  553. X        if (c == (CTRL|'U')) {                  /* ^U, start argument   */
  554. X                f = TRUE;
  555. X                n = 4;                          /* with argument of 4 */
  556. X                mflag = 0;                      /* that can be discarded. */
  557. X                mlwrite("Arg: 4");
  558. X                while ((c=getcmd()) >='0' && c<='9' || c==(CTRL|'U') || c=='-'){
  559. X                        if (c == (CTRL|'U'))
  560. X                                n = n*4;
  561. X                        /*
  562. X                         * If dash, and start of argument string, set arg.
  563. X                         * to -1.  Otherwise, insert it.
  564. X                         */
  565. X                        else if (c == '-') {
  566. X                                if (mflag)
  567. X                                        break;
  568. X                                n = 0;
  569. X                                mflag = -1;
  570. X                        }
  571. X                        /*
  572. X                         * If first digit entered, replace previous argument
  573. X                         * with digit and set sign.  Otherwise, append to arg.
  574. X                         */
  575. X                        else {
  576. X                                if (!mflag) {
  577. X                                        n = 0;
  578. X                                        mflag = 1;
  579. X                                }
  580. X                                n = 10*n + c - '0';
  581. X                        }
  582. X                        mlwrite("Arg: %d", (mflag >=0) ? n : (n ? -n : -1));
  583. X                }
  584. X                /*
  585. X                 * Make arguments preceded by a minus sign negative and change
  586. X                 * the special argument "^U -" to an effective "^U -1".
  587. X                 */
  588. X                if (mflag == -1) {
  589. X                        if (n == 0)
  590. X                                n++;
  591. X                        n = -n;
  592. X                }
  593. X        }
  594. X
  595. X        if (kbdmip != NULL) {                   /* Save macro strokes.  */
  596. X                if (c!=(CTLX|')') && kbdmip>&kbdm[NKBDM-6]) {
  597. X                        ctrlg(FALSE, 0);
  598. X                        goto loop;
  599. X                }
  600. X                if (f != FALSE) {
  601. X                        *kbdmip++ = (CTRL|'U');
  602. X                        *kbdmip++ = n;
  603. X                }
  604. X                *kbdmip++ = c;
  605. X        }
  606. X        execute(c, f, n);                       /* Do it.               */
  607. X        goto loop;
  608. X}
  609. X
  610. X/*
  611. X * Initialize all of the buffers and windows. The buffer name is passed down
  612. X * as an argument, because the main routine may have been told to read in a
  613. X * file by default, and we want the buffer name to be right.
  614. X */
  615. Xedinit(bname)
  616. Xchar    bname[];
  617. X{
  618. X        register BUFFER *bp;
  619. X        register WINDOW *wp;
  620. X    char *malloc();
  621. X
  622. X        bp = bfind(bname, TRUE, 0);             /* First buffer         */
  623. X        blistp = bfind("[List]", TRUE, BFINVS); /* Buffer list buffer   */
  624. X        wp = (WINDOW *) malloc(sizeof(WINDOW)); /* First window         */
  625. X        if (bp==NULL || wp==NULL || blistp==NULL)
  626. X                exit(1);
  627. X        curbp  = bp;                            /* Make this current    */
  628. X        wheadp = wp;
  629. X        curwp  = wp;
  630. X        wp->w_wndp  = NULL;                     /* Initialize window    */
  631. X        wp->w_bufp  = bp;
  632. X        bp->b_nwnd  = 1;                        /* Displayed.           */
  633. X        wp->w_linep = bp->b_linep;
  634. X        wp->w_dotp  = bp->b_linep;
  635. X        wp->w_doto  = 0;
  636. X        wp->w_markp = NULL;
  637. X        wp->w_marko = 0;
  638. X        wp->w_toprow = 0;
  639. X#if    COLOR
  640. X    /* initalize colors to global defaults */
  641. X    wp->w_fcolor = gfcolor;
  642. X    wp->w_bcolor = gbcolor;
  643. X#endif
  644. X        wp->w_ntrows = term.t_nrow-1;           /* "-1" for mode line.  */
  645. X        wp->w_force = 0;
  646. X        wp->w_flag  = WFMODE|WFHARD;            /* Full.                */
  647. X}
  648. X
  649. X/*
  650. X * This is the general command execution routine. It handles the fake binding
  651. X * of all the keys to "self-insert". It also clears out the "thisflag" word,
  652. X * and arranges to move it to the "lastflag", so that the next command can
  653. X * look at it. Return the status of command.
  654. X */
  655. Xexecute(c, f, n)
  656. X{
  657. X        register KEYTAB *ktp;
  658. X        register int    status;
  659. X
  660. X        ktp = &keytab[0];                       /* Look in key table.   */
  661. X        while (ktp->k_fp != NULL) {
  662. X                if (ktp->k_code == c) {
  663. X                        thisflag = 0;
  664. X                        status   = (*ktp->k_fp)(f, n);
  665. X                        lastflag = thisflag;
  666. X                        return (status);
  667. X                }
  668. X                ++ktp;
  669. X        }
  670. X
  671. X        /*
  672. X         * If a space was typed, fill column is defined, the argument is non-
  673. X         * negative, wrap mode is enabled, and we are now past fill column,
  674. X     * and we are not read-only, perform word wrap.
  675. X         */
  676. X        if (c == ' ' && (curwp->w_bufp->b_mode & MDWRAP) && fillcol > 0 &&
  677. X        n >= 0 && getccol(FALSE) > fillcol &&
  678. X        (curwp->w_bufp->b_mode & MDVIEW) == FALSE)
  679. X                wrapword();
  680. X
  681. X        if ((c>=0x20 && c<=0x7E)                /* Self inserting.      */
  682. X        ||  (c>=0xA0 && c<=0xFE)) {
  683. X                if (n <= 0) {                   /* Fenceposts.          */
  684. X                        lastflag = 0;
  685. X                        return (n<0 ? FALSE : TRUE);
  686. X                }
  687. X                thisflag = 0;                   /* For the future.      */
  688. X
  689. X        /* if we are in overwrite mode, not at eol,
  690. X           and next char is not a tab or we are at a tab stop,
  691. X           delete a char forword            */
  692. X        if (curwp->w_bufp->b_mode & MDOVER &&
  693. X            curwp->w_doto < curwp->w_dotp->l_used &&
  694. X            (lgetc(curwp->w_dotp, curwp->w_doto) != '\t' ||
  695. X             (curwp->w_doto) % 8 == 7))
  696. X                ldelete(1L, FALSE);
  697. X
  698. X        /* do the appropriate insertion */
  699. X        if (c == '}' && (curbp->b_mode & MDCMOD) != 0)
  700. X                status = insbrace(n, c);
  701. X            else if (c == '#' && (curbp->b_mode & MDCMOD) != 0)
  702. X                status = inspound();
  703. X            else
  704. X                    status = linsert(n, c);
  705. X
  706. X#if    CFENCE
  707. X        /* check for CMODE fence matching */
  708. X        if ((c == '}' || c == ')') && (curbp->b_mode & MDCMOD) != 0)
  709. X            fmatch(c);
  710. X#endif
  711. X
  712. X                lastflag = thisflag;
  713. X                return (status);
  714. X        }
  715. X    (*term.t_beep)();
  716. X    mlwrite("[Key not bound]");        /* complain        */
  717. X        lastflag = 0;                           /* Fake last flags.     */
  718. X        return (FALSE);
  719. X}
  720. X
  721. X/*
  722. X * Fancy quit command, as implemented by Norm. If the any buffer has
  723. X * changed do a write on that buffer and exit emacs, otherwise simply exit.
  724. X */
  725. Xquickexit(f, n)
  726. X{
  727. X    register BUFFER *bp;    /* scanning pointer to buffers */
  728. X
  729. X    bp = bheadp;
  730. X    while (bp != NULL) {
  731. X            if ((bp->b_flag&BFCHG) != 0    /* Changed.             */
  732. X            && (bp->b_flag&BFINVS) == 0) {    /* Real.                */
  733. X            curbp = bp;        /* make that buffer cur    */
  734. X            mlwrite("[Saving %s]",bp->b_fname);
  735. X                    filesave(f, n);
  736. X        }
  737. X    bp = bp->b_bufp;            /* on to the next buffer */
  738. X    }
  739. X        quit(f, n);                             /* conditionally quit   */
  740. X}
  741. X
  742. X/*
  743. X * Quit command. If an argument, always quit. Otherwise confirm if a buffer
  744. X * has been changed and not written out. Normally bound to "C-X C-C".
  745. X */
  746. Xquit(f, n)
  747. X{
  748. X        register int    s;
  749. X
  750. X        if (f != FALSE                          /* Argument forces it.  */
  751. X        || anycb() == FALSE                     /* All buffers clean.   */
  752. X                        /* User says it's OK.   */
  753. X        || (s=mlyesno("Modified buffers exist. Leave anyway")) == TRUE) {
  754. X#if    FILOCK
  755. X        if (lockrel() != TRUE) {
  756. X            (*term.t_putchar)('\n');
  757. X            (*term.t_putchar)('\r');
  758. X            (*term.t_close)();
  759. X            exit(1);
  760. X        }
  761. X#endif
  762. X                vttidy();
  763. X#if    APROF
  764. X        /* if doing AZTEC C profiling, close up and write it out */
  765. X        monitor(0,0,0,0,0);
  766. X#endif
  767. X                exit(GOOD);
  768. X        }
  769. X    mlwrite("");
  770. X        return (s);
  771. X}
  772. X
  773. X/*
  774. X * Begin a keyboard macro.
  775. X * Error if not at the top level in keyboard processing. Set up variables and
  776. X * return.
  777. X */
  778. Xctlxlp(f, n)
  779. X{
  780. X        if (kbdmip!=NULL || kbdmop!=NULL) {
  781. X                mlwrite("Not now");
  782. X                return (FALSE);
  783. X        }
  784. X        mlwrite("[Start macro]");
  785. X        kbdmip = &kbdm[0];
  786. X        return (TRUE);
  787. X}
  788. X
  789. X/*
  790. X * End keyboard macro. Check for the same limit conditions as the above
  791. X * routine. Set up the variables and return to the caller.
  792. X */
  793. Xctlxrp(f, n)
  794. X{
  795. X        if (kbdmip == NULL) {
  796. X                mlwrite("Not now");
  797. X                return (FALSE);
  798. X        }
  799. X        mlwrite("[End macro]");
  800. X        kbdmip = NULL;
  801. X        return (TRUE);
  802. X}
  803. X
  804. X/*
  805. X * Execute a macro.
  806. X * The command argument is the number of times to loop. Quit as soon as a
  807. X * command gets an error. Return TRUE if all ok, else FALSE.
  808. X */
  809. Xctlxe(f, n)
  810. X{
  811. X        register int    c;
  812. X        register int    af;
  813. X        register int    an;
  814. X        register int    s;
  815. X
  816. X        if (kbdmip!=NULL || kbdmop!=NULL) {
  817. X                mlwrite("Not now");
  818. X                return (FALSE);
  819. X        }
  820. X        if (n <= 0)
  821. X                return (TRUE);
  822. X        do {
  823. X                kbdmop = &kbdm[0];
  824. X                do {
  825. X                        af = FALSE;
  826. X                        an = 1;
  827. X                        if ((c = *kbdmop++) == (CTRL|'U')) {
  828. X                                af = TRUE;
  829. X                                an = *kbdmop++;
  830. X                                c  = *kbdmop++;
  831. X                        }
  832. X                        s = TRUE;
  833. X                } while (c!=(CTLX|')') && (s=execute(c, af, an))==TRUE);
  834. X                kbdmop = NULL;
  835. X        } while (s==TRUE && --n);
  836. X        return (s);
  837. X}
  838. X
  839. X/*
  840. X * Abort.
  841. X * Beep the beeper. Kill off any keyboard macro, etc., that is in progress.
  842. X * Sometimes called as a routine, to do general aborting of stuff.
  843. X */
  844. Xctrlg(f, n)
  845. X{
  846. X        (*term.t_beep)();
  847. X        if (kbdmip != NULL) {
  848. X                kbdm[0] = (CTLX|')');
  849. X                kbdmip  = NULL;
  850. X        }
  851. X    mlwrite("[Aborted]");
  852. X        return (ABORT);
  853. X}
  854. X
  855. X/* tell the user that this command is illegal while we are in
  856. X   VIEW (read-only) mode                */
  857. X
  858. Xrdonly()
  859. X
  860. X{
  861. X    (*term.t_beep)();
  862. X    mlwrite("[Key illegal in VIEW mode]");
  863. X    return(FALSE);
  864. X}
  865. X
  866. Xmeta()    /* dummy function for binding to meta prefix */
  867. X{
  868. X}
  869. X
  870. Xcex()    /* dummy function for binding to control-x prefix */
  871. X{
  872. X}
  873. X
  874. X
  875. FRIDAY_NIGHT
  876. echo extracting - menu.cmd
  877. sed 's/^X//' > menu.cmd << 'FRIDAY_NIGHT'
  878. X;    MENU.CMD:    Menu learning system for MicroEMACS 3.7
  879. X;
  880. X;            This file is executed to activate MicroEMACS's
  881. X;            menu interface code
  882. X
  883. X;    setup windows for use
  884. X
  885. X    add-global-mode "blue"
  886. X    1 split-current-window
  887. X    5 resize-window
  888. X    add-mode "red"
  889. X    view-file "menu1"
  890. X    name-buffer "menu window"
  891. X    change-file-name ""
  892. X    add-mode "view"
  893. X    next-window
  894. X
  895. X;    Load menu routines as needed
  896. X
  897. X;    Activate Main Menu
  898. X
  899. X1    store-macro
  900. X    save-window
  901. X    1 next-window
  902. X    begining-of-file
  903. X    search-forward "<<01"
  904. X    next-line
  905. X    1 redraw-display
  906. X    restore-window
  907. X    update-screen
  908. X
  909. X;    ***** Rebind the Function key group
  910. X
  911. X    bind-to-key execute-macro-3    FN;
  912. X    bind-to-key execute-macro-4    FN<
  913. X    bind-to-key execute-macro-5    FN=
  914. X    bind-to-key execute-macro-6    FN>
  915. X    bind-to-key execute-macro-7    FN?
  916. X    bind-to-key execute-macro-8    FN@
  917. X    bind-to-key execute-macro-9    FNA
  918. X    bind-to-key execute-macro-2    FNB
  919. X    bind-to-key execute-macro-10    FNC
  920. X    bind-to-key exit-emacs        FND
  921. X    clear-message-line
  922. X[end]
  923. X
  924. X;    and bring that menu up
  925. X
  926. X    execute-macro-1
  927. X    write-message "         [loading MENU system]"
  928. X
  929. X;    set up the editor control menu
  930. X
  931. X2    store-macro
  932. X    save-window
  933. X    1 next-window
  934. X    begining-of-file
  935. X    search-forward "<<02"
  936. X    next-line
  937. X    1 redraw-display
  938. X    restore-window
  939. X    update-screen
  940. X
  941. X;    ***** Rebind the Function key group
  942. X
  943. X    bind-to-key execute-macro-11    FN;
  944. X    bind-to-key execute-macro-12    FN<
  945. X    bind-to-key execute-macro-13    FN=
  946. X    bind-to-key execute-macro-14    FN>
  947. X    bind-to-key execute-macro-15    FN?
  948. X    bind-to-key execute-macro-16    FN@
  949. X    bind-to-key execute-macro-17    FNA
  950. X    bind-to-key execute-macro-18    FNB
  951. X    bind-to-key execute-macro-19    FNC
  952. X    bind-to-key execute-macro-1    FND
  953. X    clear-message-line
  954. X[end]
  955. X
  956. X;    Activate word case/screen control Menu
  957. X
  958. X3    store-macro
  959. X    save-window
  960. X    1 next-window
  961. X    begining-of-file
  962. X    search-forward "<<03"
  963. X    next-line
  964. X    1 redraw-display
  965. X    restore-window
  966. X    update-screen
  967. X
  968. X;    ***** Rebind the Function key group
  969. X
  970. X    bind-to-key case-word-upper    FN;
  971. X    bind-to-key case-region-upper    FN<
  972. X    bind-to-key case-word-lower    FN=
  973. X    bind-to-key case-region-lower    FN>
  974. X    bind-to-key case-word-capitalize FN?
  975. X    unbind-key FN@
  976. X    bind-to-key clear-and-redraw    FNA
  977. X    bind-to-key set-mark        FNB
  978. X    bind-to-key redraw-display    FNC
  979. X    bind-to-key execute-macro-1    FND
  980. X    clear-message-line
  981. X[end]
  982. X
  983. X;    Activate paging/scrolling Menu
  984. X
  985. X4    store-macro
  986. X    save-window
  987. X    1 next-window
  988. X    begining-of-file
  989. X    search-forward "<<08"
  990. X    next-line
  991. X    1 redraw-display
  992. X    restore-window
  993. X    update-screen
  994. X
  995. X;    ***** Rebind the Function key group
  996. X
  997. X    bind-to-key previous-page    FN;
  998. X    bind-to-key next-page        FN<
  999. X    bind-to-key move-window-down    FN=
  1000. X    bind-to-key move-window-up    FN>
  1001. X    bind-to-key scroll-next-up    FN?
  1002. X    unbind-key             FN@
  1003. X    bind-to-key scroll-next-down    FNA
  1004. X    unbind-key             FNB
  1005. X    bind-to-key exchange-point-and-mark FNC
  1006. X    bind-to-key execute-macro-1    FND
  1007. X    clear-message-line
  1008. X[end]
  1009. X
  1010. X;    Activate cut & paste Menu
  1011. X
  1012. X5    store-macro
  1013. X    save-window
  1014. X    1 next-window
  1015. X    begining-of-file
  1016. X    search-forward "<<04"
  1017. X    next-line
  1018. X    1 redraw-display
  1019. X    restore-window
  1020. X    update-screen
  1021. X
  1022. X;    ***** Rebind the Function key group
  1023. X
  1024. X    bind-to-key set-mark        FN;
  1025. X    unbind-key FN<
  1026. X    bind-to-key kill-region        FN=
  1027. X    unbind-key FN>
  1028. X    bind-to-key copy-region        FN?
  1029. X    unbind-key FN@
  1030. X    bind-to-key yank        FNA
  1031. X    unbind-key FNB
  1032. X    unbind-key FNC
  1033. X    bind-to-key execute-macro-1    FND
  1034. X    clear-message-line
  1035. X[end]
  1036. X
  1037. X;    Activate Search & replace Menu
  1038. X
  1039. X6    store-macro
  1040. X    save-window
  1041. X    1 next-window
  1042. X    begining-of-file
  1043. X    search-forward "<<09"
  1044. X    next-line
  1045. X    1 redraw-display
  1046. X    restore-window
  1047. X    update-screen
  1048. X
  1049. X;    ***** Rebind the Function key group
  1050. X
  1051. X    bind-to-key search-forward    FN;
  1052. X    bind-to-key search-reverse    FN<
  1053. X    bind-to-key hunt-forward    FN=
  1054. X    bind-to-key hunt-backward    FN>
  1055. X    bind-to-key incremental-search    FN?
  1056. X    bind-to-key reverse-incremental-search FN@
  1057. X    bind-to-key replace-string    FNA
  1058. X    bind-to-key query-replace-string FNB
  1059. X    unbind-key FNC
  1060. X    bind-to-key execute-macro-1    FND
  1061. X    clear-message-line
  1062. X[end]
  1063. X
  1064. X;    Activate Deletion Menu
  1065. X
  1066. X7    store-macro
  1067. X    save-window
  1068. X    1 next-window
  1069. X    begining-of-file
  1070. X    search-forward "<<05"
  1071. X    next-line
  1072. X    1 redraw-display
  1073. X    restore-window
  1074. X    update-screen
  1075. X
  1076. X;    ***** Rebind the Function key group
  1077. X
  1078. X    bind-to-key delete-previous-character FN;
  1079. X    unbind-key FN<
  1080. X    bind-to-key delete-next-character FN=
  1081. X    unbind-key FN>
  1082. X    bind-to-key kill-to-end-of-line    FN?
  1083. X    unbind-key FN@
  1084. X    bind-to-key delete-blank-lines    FNA
  1085. X    unbind-key FNB
  1086. X    unbind-key FNC
  1087. X    bind-to-key execute-macro-1    FND
  1088. X    clear-message-line
  1089. X[end]
  1090. X
  1091. X;    Activate Word procesing Menu
  1092. X
  1093. X8    store-macro
  1094. X    save-window
  1095. X    1 next-window
  1096. X    begining-of-file
  1097. X    search-forward "<<10"
  1098. X    next-line
  1099. X    1 redraw-display
  1100. X    restore-window
  1101. X    update-screen
  1102. X
  1103. X;    ***** Rebind the Function key group
  1104. X
  1105. X    bind-to-key previous-word    FN;
  1106. X    bind-to-key next-word        FN<
  1107. X    bind-to-key previous-paragraph    FN=
  1108. X    bind-to-key next-paragraph    FN>
  1109. X    bind-to-key fill-paragraph    FN?
  1110. X    bind-to-key kill-paragraph    FN@
  1111. X    bind-to-key delete-previous-word FNA
  1112. X    bind-to-key delete-next-word    FNB
  1113. X    bind-to-key count-words        FNC
  1114. X    bind-to-key execute-macro-1    FND
  1115. X    clear-message-line
  1116. X[end]
  1117. X
  1118. X;    Activate Insertion Menu
  1119. X
  1120. X9    store-macro
  1121. X    save-window
  1122. X    1 next-window
  1123. X    begining-of-file
  1124. X    search-forward "<<06"
  1125. X    next-line
  1126. X    1 redraw-display
  1127. X    restore-window
  1128. X    update-screen
  1129. X
  1130. X;    ***** Rebind the Function key group
  1131. X
  1132. X    bind-to-key open-line        FN;
  1133. X    bind-to-key insert-string    FN<
  1134. X    bind-to-key handle-tab        FN=
  1135. X    bind-to-key quote-character    FN>
  1136. X    bind-to-key insert-space    FN?
  1137. X    bind-to-key transpose-characters FN@
  1138. X    bind-to-key newline-and-indent    FNA
  1139. X    unbind-key FNB
  1140. X    bind-to-key newline        FNC
  1141. X    bind-to-key execute-macro-1    FND
  1142. X    clear-message-line
  1143. X[end]
  1144. X
  1145. X;    Activate Cursor movement Menu
  1146. X
  1147. X10    store-macro
  1148. X    save-window
  1149. X    1 next-window
  1150. X    begining-of-file
  1151. X    search-forward "<<07"
  1152. X    next-line
  1153. X    1 redraw-display
  1154. X    restore-window
  1155. X    update-screen
  1156. X
  1157. X;    ***** Rebind the Function key group
  1158. X
  1159. X    bind-to-key begining-of-file    FN;
  1160. X    bind-to-key previous-line    FN<
  1161. X    bind-to-key backward-character    FN=
  1162. X    bind-to-key forward-character    FN>
  1163. X    bind-to-key end-of-file        FN?
  1164. X    bind-to-key next-line        FN@
  1165. X    bind-to-key begining-of-line    FNA
  1166. X    bind-to-key end-of-line        FNB
  1167. X    bind-to-key execute-macro-21    FNC
  1168. X    bind-to-key execute-macro-1    FND
  1169. X    clear-message-line
  1170. X[end]
  1171. X
  1172. X21    store-macro
  1173. X    "@Line number to go to: " goto-line
  1174. X[end]
  1175. X
  1176. X;    Activate Buffer Menu
  1177. X
  1178. X11    store-macro
  1179. X    save-window
  1180. X    1 next-window
  1181. X    begining-of-file
  1182. X    search-forward "<<11"
  1183. X    next-line
  1184. X    1 redraw-display
  1185. X    restore-window
  1186. X    update-screen
  1187. X
  1188. X;    ***** Rebind the Function key group
  1189. X
  1190. X    bind-to-key buffer-position    FN;
  1191. X    bind-to-key unmark-buffer    FN<
  1192. X    bind-to-key delete-buffer    FN=
  1193. X    bind-to-key next-buffer        FN>
  1194. X    bind-to-key list-buffers    FN?
  1195. X    bind-to-key execute-macro-22    FN@
  1196. X    bind-to-key name-buffer        FNA
  1197. X    unbind-key FNB
  1198. X    bind-to-key select-buffer    FNC
  1199. X    bind-to-key execute-macro-2    FND
  1200. X    clear-message-line
  1201. X[end]
  1202. X
  1203. X22    store-macro
  1204. X    filter-buffer "@Name of DOS filter: "
  1205. X[end]
  1206. X;    Macro Menu
  1207. X
  1208. X12    store-macro
  1209. X    save-window
  1210. X    1 next-window
  1211. X    begining-of-file
  1212. X    search-forward "<<11"
  1213. X    next-line
  1214. X    1 redraw-display
  1215. X    restore-window
  1216. X    update-screen
  1217. X
  1218. X;    ***** Rebind the Function key group
  1219. X
  1220. X    bind-to-key begin-macro        FN;
  1221. X    unbind-key FN<
  1222. X    bind-to-key end-macro        FN=
  1223. X    unbind-key FN>
  1224. X    bind-to-key execute-macro    FN?
  1225. X    unbind-key FN@
  1226. X    unbind-key FNA
  1227. X    unbind-key FNB
  1228. X    unbind-key FNC
  1229. X    bind-to-key execute-macro-2    FND
  1230. X    clear-message-line
  1231. X[end]
  1232. X
  1233. X;    Color change Menu
  1234. X
  1235. X13    store-macro
  1236. X    save-window
  1237. X    1 next-window
  1238. X    begining-of-file
  1239. X    search-forward "<<12"
  1240. X    next-line
  1241. X    1 redraw-display
  1242. X    restore-window
  1243. X    update-screen
  1244. X
  1245. X;    ***** Rebind the Function key group
  1246. X
  1247. X    bind-to-key execute-macro-23    FN;
  1248. X    unbind-key FN<
  1249. X    bind-to-key execute-macro-24    FN=
  1250. X    unbind-key FN>
  1251. X    bind-to-key execute-macro-25    FN?
  1252. X    unbind-key FN@
  1253. X    bind-to-key execute-macro-26    FNA
  1254. X    unbind-key FNB
  1255. X    unbind-key FNC
  1256. X    bind-to-key execute-macro-2    FND
  1257. X    clear-message-line
  1258. X[end]
  1259. X
  1260. X;    Set forground color
  1261. X
  1262. X23    store-macro
  1263. X    save-window
  1264. X    1 next-window
  1265. X    select-buffer "[color]"
  1266. X    begining-of-file
  1267. X    insert-string "@Color to change to: "
  1268. X    newline
  1269. X    begining-of-file
  1270. X    case-word-upper
  1271. X    begining-of-file
  1272. X    unmark-buffer
  1273. X    select-buffer "menu window"
  1274. X    1 redraw-display
  1275. X    restore-window
  1276. X    add-mode "#[color]"
  1277. X    delete-buffer "[color]"
  1278. X[end]
  1279. X
  1280. X;    Set background color
  1281. X
  1282. X24    store-macro
  1283. X    save-window
  1284. X    1 next-window
  1285. X    select-buffer "[color]"
  1286. X    begining-of-file
  1287. X    insert-string "@Color to change to: "
  1288. X    newline
  1289. X    begining-of-file
  1290. X    case-word-lower
  1291. X    begining-of-file
  1292. X    unmark-buffer
  1293. X    select-buffer "menu window"
  1294. X    1 redraw-display
  1295. X    restore-window
  1296. X    add-mode "#[color]"
  1297. X    delete-buffer "[color]"
  1298. X[end]
  1299. X
  1300. X;    Set global forground color
  1301. X
  1302. X25    store-macro
  1303. X    save-window
  1304. X    1 next-window
  1305. X    select-buffer "[color]"
  1306. X    begining-of-file
  1307. X    insert-string "@Color to change to: "
  1308. X    newline
  1309. X    begining-of-file
  1310. X    case-word-upper
  1311. X    begining-of-file
  1312. X    unmark-buffer
  1313. X    select-buffer "menu window"
  1314. X    1 redraw-display
  1315. X    restore-window
  1316. X    add-global-mode "#[color]"
  1317. X    delete-buffer "[color]"
  1318. X[end]
  1319. X
  1320. X;    Set global background color
  1321. X
  1322. X26    store-macro
  1323. X    save-window
  1324. X    1 next-window
  1325. X    select-buffer "[color]"
  1326. X    begining-of-file
  1327. X    insert-string "@Color to change to: "
  1328. X    newline
  1329. X    begining-of-file
  1330. X    case-word-lower
  1331. X    begining-of-file
  1332. X    unmark-buffer
  1333. X    select-buffer "menu window"
  1334. X    1 redraw-display
  1335. X    restore-window
  1336. X    add-global-mode "#[color]"
  1337. X    delete-buffer "[color]"
  1338. X[end]
  1339. X
  1340. X;    set Mode Menu
  1341. X
  1342. X14    store-macro
  1343. X    save-window
  1344. X    1 next-window
  1345. X    begining-of-file
  1346. X    search-forward "<<17"
  1347. X    next-line
  1348. X    1 redraw-display
  1349. X    restore-window
  1350. X    update-screen
  1351. X
  1352. X;    ***** Rebind the Function key group
  1353. X
  1354. X    bind-to-key add-mode        FN;
  1355. X    bind-to-key add-global-mode    FN<
  1356. X    bind-to-key delete-mode        FN=
  1357. X    bind-to-key delete-global-mode    FN>
  1358. X    unbind-key FN?
  1359. X    bind-to-key execute-macro-27    FN@
  1360. X    unbind-key FNA
  1361. X    unbind-key FNB
  1362. X    bind-to-key select-buffer    FNC
  1363. X    bind-to-key execute-macro-2    FND
  1364. X    clear-message-line
  1365. X[end]
  1366. X
  1367. X27    store-macro
  1368. X    "@Column to fill to: " set-fill-column
  1369. X[end]
  1370. X
  1371. X;    DOS command Menu
  1372. X
  1373. X15    store-macro
  1374. X    save-window
  1375. X    1 next-window
  1376. X    begining-of-file
  1377. X    search-forward "<<13"
  1378. X    next-line
  1379. X    1 redraw-display
  1380. X    restore-window
  1381. X    update-screen
  1382. X
  1383. X;    ***** Rebind the Function key group
  1384. X
  1385. X    bind-to-key shell-command    FN;
  1386. X    unbind-key FN<
  1387. X    bind-to-key pipe-command    FN=
  1388. X    unbind-key FN>
  1389. X    bind-to-key i-shell        FN?
  1390. X    unbind-key FN@
  1391. X    bind-to-key quick-exit        FNA
  1392. X    unbind-key FNB
  1393. X    bind-to-key exit-emacs        FNC
  1394. X    bind-to-key execute-macro-2    FND
  1395. X    clear-message-line
  1396. X[end]
  1397. X
  1398. X;    Script Menu
  1399. X
  1400. X16    store-macro
  1401. X    save-window
  1402. X    1 next-window
  1403. X    begining-of-file
  1404. X    search-forward "<<18"
  1405. X    next-line
  1406. X    1 redraw-display
  1407. X    restore-window
  1408. X    update-screen
  1409. X
  1410. X;    ***** Rebind the Function key group
  1411. X
  1412. X    bind-to-key execute-file    FN;
  1413. X    bind-to-key execute-command-line FN<
  1414. X    bind-to-key execute-buffer    FN=
  1415. X    bind-to-key execute-named-command FN>
  1416. X    unbind-key FN?
  1417. X    unbind-key FN@
  1418. X    unbind-key FNA
  1419. X    unbind-key FNB
  1420. X    unbind-key FNC
  1421. X    bind-to-key execute-macro-2    FND
  1422. X    clear-message-line
  1423. X[end]
  1424. X
  1425. X;    File access Menu
  1426. X
  1427. X17    store-macro
  1428. X    save-window
  1429. X    1 next-window
  1430. X    begining-of-file
  1431. X    search-forward "<<14"
  1432. X    next-line
  1433. X    1 redraw-display
  1434. X    restore-window
  1435. X    update-screen
  1436. X
  1437. X;    ***** Rebind the Function key group
  1438. X
  1439. X    bind-to-key find-file        FN;
  1440. X    bind-to-key save-file        FN<
  1441. X    bind-to-key view-file        FN=
  1442. X    bind-to-key write-file        FN>
  1443. X    bind-to-key read-file        FN?
  1444. X    bind-to-key change-file-name    FN@
  1445. X    bind-to-key insert-file        FNA
  1446. X    unbind-key FNB
  1447. X    unbind-key FNC
  1448. X    bind-to-key execute-macro-2    FND
  1449. X    clear-message-line
  1450. X[end]
  1451. X
  1452. X;    Window Menu
  1453. X
  1454. X18    store-macro
  1455. X    save-window
  1456. X    1 next-window
  1457. X    begining-of-file
  1458. X    search-forward "<<19"
  1459. X    next-line
  1460. X    1 redraw-display
  1461. X    restore-window
  1462. X    update-screen
  1463. X
  1464. X;    ***** Rebind the Function key group
  1465. X
  1466. X    bind-to-key split-current-window FN;
  1467. X    bind-to-key delete-other-windows FN<
  1468. X    bind-to-key resize-window    FN=
  1469. X    bind-to-key delete-window    FN>
  1470. X    bind-to-key shrink-window    FN?
  1471. X    bind-to-key grow-window        FN@
  1472. X    bind-to-key next-window        FNA
  1473. X    bind-to-key previous-window    FNB
  1474. X    unbind-key FNC
  1475. X    bind-to-key execute-macro-2    FND
  1476. X    clear-message-line
  1477. X[end]
  1478. X
  1479. X;    key binding Menu
  1480. X
  1481. X19    store-macro
  1482. X    save-window
  1483. X    1 next-window
  1484. X    begining-of-file
  1485. X    search-forward "<<15"
  1486. X    next-line
  1487. X    1 redraw-display
  1488. X    restore-window
  1489. X    update-screen
  1490. X
  1491. X;    ***** Rebind the Function key group
  1492. X
  1493. X    bind-to-key bind-to-key        FN;
  1494. X    unbind-key FN<
  1495. X    bind-to-key unbind-key        FN=
  1496. X    unbind-key FN>
  1497. X    bind-to-key describe-key    FN?
  1498. X    unbind-key FN@
  1499. X    bind-to-key describe-bindings    FNA
  1500. X    unbind-key FNB
  1501. X    unbind-key FNC
  1502. X    bind-to-key execute-macro-2    FND
  1503. X    clear-message-line
  1504. X[end]
  1505. X
  1506. X    clear-message-line
  1507. FRIDAY_NIGHT
  1508. echo es.8 completed!
  1509. : That's all folks!
  1510.  
  1511.