Subject: Epoch-4.0a2 extended to handle 8-bit characters

Here is a 8-bit patch for epoch-4.0a2. It is mainly copied from the
one for emacs-18.57 by anderse@dna.lth.se.

These modifications are mainly of interest to those that have
a workstation/terminal that can display Latin-1 characters,
as well as a keyboard that can be used to enter characters in
this extended set (or any iso-latin-mode under epoch).

Some points of interest are:

	-- All characters in ISO 8859-1 are now considered normal
	   characters, and are entered and displayed in the usual way.
	   (Characters in the range 128..255 can also be displayed
	   as \xxx, by setting the variable meta-printable to nil.)
	   Commands like upcase-word, forward-word, etc. should
	   work as expected.

	-- Meta-commands are entered using either the ESC-prefix,
	   or the Meta-shift key in Emacstool or in Emacs
	   under X windows.

	-- Whether you use X windows or Sunview or some other
	   windowing system, make sure that you have a fixed width font
	   with a full character set. Many of the fonts in OpenWindows
	   that claim to be ISO 8859-1, are not! Also, some of
	   the fonts have accented characters that are too tall.

	-- Keymaps are extended to length 256.

I have installed this modified version of Epoch on our
SPARC workstations, and no major problems have surfaced yet.

Obviously, I take no responsibility for bugs or errors in this code,
nor for finding or correcting errors; as usual,

	this code comes with ABSOLUTELY NO WARRANTY.


Renaud Keriven
CERMICS - ENPC
La Courtine
F-93167 NOISY LE GRAND Cedex

E-mail: keriven@cadix.enpc.fr

Here are the diffs (don't forget to compile isearch.el again):

*** src/buffer.c	Tue Nov  5 04:02:11 1991
--- ../epoch-4.0/src/buffer.c	Thu Dec 12 12:21:25 1991
***************
*** 1105,1111 ****
    XFASTINT (buffer_defaults.tab_width) = 8;
    buffer_defaults.truncate_lines = Qnil;
    buffer_defaults.ctl_arrow = Qt;
! 
    XFASTINT (buffer_defaults.fill_column) = 70;
    XFASTINT (buffer_defaults.fill_pixel) = 0; /* Disable */
    XFASTINT (buffer_defaults.left_margin) = 0;
--- 1105,1112 ----
    XFASTINT (buffer_defaults.tab_width) = 8;
    buffer_defaults.truncate_lines = Qnil;
    buffer_defaults.ctl_arrow = Qt;
!   buffer_defaults.meta_printable = Qt;
!   
    XFASTINT (buffer_defaults.fill_column) = 70;
    XFASTINT (buffer_defaults.fill_pixel) = 0; /* Disable */
    XFASTINT (buffer_defaults.left_margin) = 0;
***************
*** 1148,1153 ****
--- 1149,1155 ----
    XFASTINT (buffer_local_flags.syntax_table) = 0x2000;
    XFASTINT (buffer_local_flags.fill_pixel) = 0x4000;
    XFASTINT (buffer_local_flags.line_fill_hook) = 0x8000;
+   XFASTINT (buffer_local_flags.meta_printable) = 0x10000;
  
    Vbuffer_alist = Qnil;
    current_buffer = 0;
***************
*** 1218,1224 ****
  	      &buffer_defaults.ctl_arrow,
      "Default ctl-arrow for buffers that do not override it.\n\
  This is the same as (default-value 'ctl-arrow).");
! 
    DEFVAR_LISP_NOPRO ("default-truncate-lines",
  	      &buffer_defaults.truncate_lines,
      "Default truncate-lines for buffers that do not override it.\n\
--- 1220,1230 ----
  	      &buffer_defaults.ctl_arrow,
      "Default ctl-arrow for buffers that do not override it.\n\
  This is the same as (default-value 'ctl-arrow).");
!   DEFVAR_LISP_NOPRO ("default-meta-printable",
!  	      &buffer_defaults.meta_printable,
!      "Default meta-printable for buffers that do not override it.\n\
! This is the same as (default-value 'meta-printable).");
!  
    DEFVAR_LISP_NOPRO ("default-truncate-lines",
  	      &buffer_defaults.truncate_lines,
      "Default truncate-lines for buffers that do not override it.\n\
***************
*** 1321,1327 ****
    DEFVAR_PER_BUFFER ("ctl-arrow", &current_buffer->ctl_arrow,
      "*t means display control chars with uparrow.\n\
  Nil means use backslash and octal digits.\n\
! Otherwise assume that control and meta characters are printable.\n\
  Automatically becomes local when set in any fashion.");
  
    DEFVAR_PER_BUFFER ("truncate-lines", &current_buffer->truncate_lines,
--- 1327,1338 ----
    DEFVAR_PER_BUFFER ("ctl-arrow", &current_buffer->ctl_arrow,
      "*t means display control chars with uparrow.\n\
  Nil means use backslash and octal digits.\n\
! Automatically becomes local when set in any fashion.");
! 
!   DEFVAR_PER_BUFFER ("meta-printable", &current_buffer->meta_printable,
!      "*Non-nil means meta characters, that is characters in the range \n\
! 0240..0377, are printable.\n\
! Nil means display meta chars with backslash and octal digits.\n\
  Automatically becomes local when set in any fashion.");
  
    DEFVAR_PER_BUFFER ("truncate-lines", &current_buffer->truncate_lines,
*** src/buffer.h	Tue Nov  5 04:02:11 1991
--- ../epoch-4.0/src/buffer.h	Thu Dec 12 12:23:19 1991
***************
*** 216,221 ****
--- 216,223 ----
      Lisp_Object truncate_lines;
      /* Non-nil means display ctl chars with uparrow */
      Lisp_Object ctl_arrow;
+     /* Non-nil means meta chars are printable. */
+     Lisp_Object meta_printable;
      /* Non-nil means do selective display;
         See doc string in syms_of_buffer (buffer.c) for details.  */
      Lisp_Object selective_display;
***************
*** 280,284 ****
  #define BufferSafeCeiling(n) (((n) < GPT && GPT < ZV ? GPT : ZV) - 1)
  
  #define BufferSafeFloor(n) (BEGV <= GPT && GPT <= (n) ? GPT : BEGV)
! 
  extern void reset_buffer ();
--- 282,289 ----
  #define BufferSafeCeiling(n) (((n) < GPT && GPT < ZV ? GPT : ZV) - 1)
  
  #define BufferSafeFloor(n) (BEGV <= GPT && GPT <= (n) ? GPT : BEGV)
!   
! #define is_control_char(c)   (((c) >= 0 && (c) < 040) || (c) == 0177)
! #define is_meta_char(c) ((c) >= 0240 && (c) <= 0377)
  extern void reset_buffer ();
+ 
*** src/cmds.c	Tue Nov  5 04:02:17 1991
--- ../epoch-4.0/src/cmds.c	Thu Dec 12 12:24:38 1991
***************
*** 370,376 ****
    ndefkey (Vglobal_map, Ctl('I'), "self-insert-command");
    for (n = 040; n < 0177; n++)
      ndefkey (Vglobal_map, n, "self-insert-command");
! 
    ndefkey (Vglobal_map, Ctl ('A'), "beginning-of-line");
    ndefkey (Vglobal_map, Ctl ('B'), "backward-char");
    ndefkey (Vglobal_map, Ctl ('D'), "delete-char");
--- 370,377 ----
    ndefkey (Vglobal_map, Ctl('I'), "self-insert-command");
    for (n = 040; n < 0177; n++)
      ndefkey (Vglobal_map, n, "self-insert-command");
!   for (n = 0240; n <= 0377; n++)
! 	  ndefkey (Vglobal_map, n, "self-insert-command");
    ndefkey (Vglobal_map, Ctl ('A'), "beginning-of-line");
    ndefkey (Vglobal_map, Ctl ('B'), "backward-char");
    ndefkey (Vglobal_map, Ctl ('D'), "delete-char");
Common subdirectories: src/config and ../epoch-4.0/src/config
*** src/indent.c	Sun Nov  3 04:23:06 1991
--- ../epoch-4.0/src/indent.c	Thu Dec 12 16:29:33 1991
***************
*** 106,111 ****
--- 106,112 ----
    register int tab_width = XINT (current_buffer->tab_width);
    int ctl_arrow = (!NULL (current_buffer->ctl_arrow))
      + (EQ (current_buffer->ctl_arrow,Qt));
+   int meta_printable = !NULL (current_buffer->meta_printable);
  
    if (point == last_known_column_point
        && MODIFF == last_known_column_modified)
***************
*** 158,170 ****
  	  post_tab += col;
  	  col = 0;
  	  tab_seen = 1;
! 	}
!       else
! 	col += (ctl_arrow == 1 && c >= 0177) ? 1 :
! 	  (ctl_arrow && c < 0200) ? 2 : 4;
  
-     }
- 
    if (tab_seen)
      {
        col = ((col + tab_width) / tab_width) * tab_width;
--- 159,172 ----
  	  post_tab += col;
  	  col = 0;
  	  tab_seen = 1;
!   } else if (is_control_char(c))
! 	  col += ctl_arrow ? 2 : 4;
!   else if (is_meta_char(c))
! 	  col += meta_printable ? 1 : 4;
!   else
! 	  col += 4;
!   }
  
    if (tab_seen)
      {
        col = ((col + tab_width) / tab_width) * tab_width;
***************
*** 495,500 ****
--- 497,503 ----
    register int tab_width = XINT(current_buffer->tab_width);
    register int ctl_arrow = (!NULL (current_buffer->ctl_arrow))
      + (EQ (current_buffer->ctl_arrow, Qt));
+   register int meta_printable = !NULL (current_buffer->meta_printable);
    register int i;
    struct X_font *font;
    struct buffer *b = current_buffer;
***************
*** 534,539 ****
--- 537,543 ----
  	}
        else if (ctl_arrow == 1 && a >= 040)
  	continue;
+ /*
        else if (ctl_arrow && (a < 040 || a == 0177))
  	{
  	  col++;
***************
*** 545,552 ****
  	  col += 3;
  	  c[0] = '0';
  	  pix += text_width(font,c,1);
! 	}
!     }      
  
    SET_PT(pos);
  
--- 549,570 ----
  	  col += 3;
  	  c[0] = '0';
  	  pix += text_width(font,c,1);
!  	}
! */
! 	  else if (is_control_char(a)) {
! 		  col += ctl_arrow ? 1 : 3;
! 		  c[0] = '0';
! 		  pix += text_width(font,c,1);
!       } else  if (is_meta_char(a)) {
! 		  col += meta_printable ? 0 : 3;
! 		  c[0] = '0';
! 		  pix += text_width(font,c,1);
! 	  } else if (a < 040 || a >= 0177) {
! 		  col += 3;
! 		  c[0] = '0';
! 		  pix += text_width(font,c,1);
! 	  }
!   }      
  
    SET_PT(pos);
  
***************
*** 587,592 ****
--- 605,611 ----
    register int tab_width = XINT (current_buffer->tab_width);
    register int ctl_arrow = (!NULL (current_buffer->ctl_arrow))
      + (EQ (current_buffer->ctl_arrow, Qt));
+   register int meta_printable = !NULL (current_buffer->meta_printable);
  
    if (tab_width <= 0 || tab_width > 20) tab_width = 8;
  
***************
*** 614,628 ****
  	}
        else if (ctl_arrow == 1 && c >= 040)
  	continue;
!       else if (ctl_arrow && (c < 040 || c == 0177))
! 	{
! 	  col++;
! 	}
!       else if (c < 040 || c >= 0177)
! 	{
! 	  int i;
! 	  col += 3;
! 	}
      }
  
    SET_PT (pos);
--- 633,645 ----
  	}
        else if (ctl_arrow == 1 && c >= 040)
  	continue;
! 	  else if (is_control_char(c)) {
! 		  col += ctl_arrow ? 1 : 3;
!       } else  if (is_meta_char(c)) {
! 		  col += meta_printable ? 0 : 3;
! 	  } else if (c < 040 || c >= 0177) {
! 		  col += 3;
! 	  }
      }
  
    SET_PT (pos);
***************
*** 696,701 ****
--- 713,719 ----
    int button_end, button_start;
    int truncate = hscroll || (truncate_partial_width_windows &&
  			     XFASTINT(w->pixwidth) < XWSCREEN(XROOT(w->root)->win)->pixw);
+   int meta_printable = !NULL (current_buffer->meta_printable);
    int selective = XTYPE (current_buffer->selective_display) == Lisp_Int
      ? XINT (current_buffer->selective_display)
        : !NULL (current_buffer->selective_display) ? -1 : 0;
***************
*** 835,842 ****
        else
  	{
  	  int i;
! 	  int inc = (ctl_arrow == 1 && c >= 040) ? 1 :
! 	    (ctl_arrow && c < 0200) ? 2 : 4;
  
  	  a[0] = '0';
  	  for (i = 0; i < inc; i++)
--- 853,866 ----
        else
  	{
  	  int i;
! 	  int inc;
! 
! if (is_control_char(c))
!  	inc = ctl_arrow ? 2 : 4;
!        else if (is_meta_char(c))
!  	inc = meta_printable ? 1 : 4;
!         else
!  	inc = 4;
  
  	  a[0] = '0';
  	  for (i = 0; i < inc; i++)
*** src/keyboard.c	Sun Nov  3 04:23:08 1991
--- ../epoch-4.0/src/keyboard.c	Thu Dec 12 16:30:15 1991
***************
*** 1526,1537 ****
  
        if (c < 0)
  	return 0;
!       if (c >= 0200)
  	{
  	  nextc = c & 0177;
  	  c = meta_prefix_char;
  	}
! 
        keybuf[i] = c;
  
        global = !NULL (nextglobal)
--- 1526,1537 ----
  
        if (c < 0)
  	return 0;
! /*      if (c >= 0200)
  	{
  	  nextc = c & 0177;
  	  c = meta_prefix_char;
  	}
! */
        keybuf[i] = c;
  
        global = !NULL (nextglobal)
*** src/keymap.c	Sun Nov  3 04:23:09 1991
--- ../epoch-4.0/src/keymap.c	Thu Dec 12 16:42:13 1991
***************
*** 66,81 ****
  
  /* A char over 0200 in a key sequence
     is equivalent to prefixing with this character.  */
! 
  extern int meta_prefix_char;
  
  DEFUN ("make-keymap", Fmake_keymap, Smake_keymap, 0, 0, 0,
!   "Construct and return a new keymap, a vector of length 128.\n\
  All entries in it are nil, meaning \"command undefined\".")
    ()
  {
    register Lisp_Object val;
!   XFASTINT (val) = 0200;
    return Fmake_vector (val, Qnil);
  }
  
--- 66,83 ----
  
  /* A char over 0200 in a key sequence
     is equivalent to prefixing with this character.  */
! /* All 8-bit characters are allowed. */
! /* extern int meta_prefix_char; */
!   
  extern int meta_prefix_char;
  
  DEFUN ("make-keymap", Fmake_keymap, Smake_keymap, 0, 0, 0,
!   "Construct and return a new keymap, a vector of length 256.\n\
  All entries in it are nil, meaning \"command undefined\".")
    ()
  {
    register Lisp_Object val;
!   XFASTINT (val) = 0400;
    return Fmake_vector (val, Qnil);
  }
  
***************
*** 119,125 ****
  
  DEFUN ("keymapp", Fkeymapp, Skeymapp, 1, 1, 0,
    "Return t if ARG is a keymap.\n\
! A keymap is a vector of length 128, or a list (keymap . ALIST),\n\
  where alist elements look like (CHAR . DEFN).")
    (object)
       Lisp_Object object;
--- 121,127 ----
  
  DEFUN ("keymapp", Fkeymapp, Skeymapp, 1, 1, 0,
    "Return t if ARG is a keymap.\n\
! A keymap is a vector of length 256, or a list (keymap . ALIST),\n\
  where alist elements look like (CHAR . DEFN).")
    (object)
       Lisp_Object object;
***************
*** 134,140 ****
        QUIT;
      }
  
!   if ((XTYPE (tem) == Lisp_Vector && XVECTOR (tem)->size == 0200)
        || (CONSP (tem) && EQ (XCONS (tem)->car, Qkeymap)))
      return Qt;
    return Qnil;
--- 136,142 ----
        QUIT;
      }
  
!   if ((XTYPE (tem) == Lisp_Vector && XVECTOR (tem)->size == 0400)
        || (CONSP (tem) && EQ (XCONS (tem)->car, Qkeymap)))
      return Qt;
    return Qnil;
***************
*** 155,161 ****
  	  tem = XSYMBOL (tem)->function;
  	  QUIT;
  	}
!       if ((XTYPE (tem) == Lisp_Vector && XVECTOR (tem)->size == 0200)
  	  || (CONSP (tem) && EQ (XCONS (tem)->car, Qkeymap)))
  	return tem;
        if (error)
--- 157,163 ----
  	  tem = XSYMBOL (tem)->function;
  	  QUIT;
  	}
!       if ((XTYPE (tem) == Lisp_Vector && XVECTOR (tem)->size == 0400)
  	  || (CONSP (tem) && EQ (XCONS (tem)->car, Qkeymap)))
  	return tem;
        if (error)
***************
*** 197,204 ****
       register int idx;
  {
    register Lisp_Object val;
!   if (idx < 0 || idx >= 0200)
!     error ("Command key out of range 0-127");
  
    /* Get definition for character `idx' proper.  */
    if (CONSP (map))
--- 199,206 ----
       register int idx;
  {
    register Lisp_Object val;
!   if (idx < 0 || idx >= 0400)
!     error ("Command key out of range 0-255");
  
    /* Get definition for character `idx' proper.  */
    if (CONSP (map))
***************
*** 217,224 ****
  {
    register Lisp_Object tem;
  
!   if (idx < 0 || idx >= 0200)
!     error ("Command key out of range 0-127");
  
    if (CONSP (keymap))
      {
--- 219,226 ----
  {
    register Lisp_Object tem;
  
!   if (idx < 0 || idx >= 0400)
!     error ("Command key out of range 0-255");
  
    if (CONSP (keymap))
      {
***************
*** 289,295 ****
    register int c;
    register Lisp_Object tem;
    register Lisp_Object cmd;
-   int metized = 0;
  
    keymap = get_keymap (keymap);
  
--- 291,296 ----
***************
*** 301,317 ****
    while (1)
      {
        c = XSTRING (key)->data[idx];
-       if (c >= 0200 && !metized)
- 	{
- 	  c = meta_prefix_char;
- 	  metized = 1;
- 	}
-       else
- 	{
- 	  c &= 0177;
- 	  metized = 0;
  	  idx++;
- 	}
  
        if (idx == XSTRING (key)->size)
  	return store_in_keymap (keymap, c, def);
--- 302,308 ----
***************
*** 349,355 ****
    register Lisp_Object tem;
    register Lisp_Object cmd;
    register int c;
-   int metized = 0;
  
    keymap = get_keymap (keymap);
  
--- 340,345 ----
***************
*** 361,377 ****
    while (1)
      {
        c = XSTRING (key)->data[idx];
-       if (c >= 0200 && !metized)
- 	{
- 	  c = meta_prefix_char;
- 	  metized = 1;
- 	}
-       else
- 	{
- 	  c &= 0177;
- 	  metized = 0;
  	  idx++;
- 	}
  
        cmd = get_keyelt (access_keymap (keymap, c));
        if (idx == XSTRING (key)->size)
--- 351,357 ----
***************
*** 577,583 ****
      {
        thisseq = Fcar (Fcar (tail));
        thismap = Fcdr (Fcar (tail));
!       for (i = 0; i < 0200; i++)
  	{
  	  cmd = get_keyelt (access_keymap (thismap, i));
  	  if (NULL (cmd)) continue;
--- 557,563 ----
      {
        thisseq = Fcar (Fcar (tail));
        thismap = Fcdr (Fcar (tail));
!       for (i = 0; i < 0400; i++)
  	{
  	  cmd = get_keyelt (access_keymap (thismap, i));
  	  if (NULL (cmd)) continue;
***************
*** 617,628 ****
       register unsigned int c;
       register char *p;
  {
-   if (c >= 0200)
-     {
-       *p++ = 'M';
-       *p++ = '-';
-       c -= 0200;
-     }
    if (c < 040)
      {
        if (c == 033)
--- 597,602 ----
***************
*** 698,709 ****
       register unsigned int c;
       register char *p;
  {
-   if (c >= 0200)
-     {
-       *p++ = 'M';
-       *p++ = '-';
-       c -= 0200;
-     }
    if (c < 040)
      {
        *p++ = '^';
--- 672,677 ----
***************
*** 770,776 ****
        /* If the MAP is a vector, I increments and eventually reaches 0200.
  	 Otherwise I remains 0; MAP is cdr'd and eventually becomes nil.  */
  
!       while (!NULL (map) && i < 0200)
  	{
  	  register Lisp_Object elt, dummy;
  
--- 738,744 ----
        /* If the MAP is a vector, I increments and eventually reaches 0200.
  	 Otherwise I remains 0; MAP is cdr'd and eventually becomes nil.  */
  
!       while (!NULL (map) && i < 0400)
  	{
  	  register Lisp_Object elt, dummy;
  
*** src/regex.c	Sun Nov  3 04:23:22 1991
--- ../epoch-4.0/src/regex.c	Thu Dec 12 16:45:34 1991
***************
*** 1617,1627 ****
      0300, 0301, 0302, 0303, 0304, 0305, 0306, 0307,
      0310, 0311, 0312, 0313, 0314, 0315, 0316, 0317,
      0320, 0321, 0322, 0323, 0324, 0325, 0326, 0327,
!     0330, 0331, 0332, 0333, 0334, 0335, 0336, 0337,
!     0340, 0341, 0342, 0343, 0344, 0345, 0346, 0347,
!     0350, 0351, 0352, 0353, 0354, 0355, 0356, 0357,
!     0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367,
!     0370, 0371, 0372, 0373, 0374, 0375, 0376, 0377
    };
  
  main (argc, argv)
--- 1617,1627 ----
      0300, 0301, 0302, 0303, 0304, 0305, 0306, 0307,
      0310, 0311, 0312, 0313, 0314, 0315, 0316, 0317,
      0320, 0321, 0322, 0323, 0324, 0325, 0326, 0327,
!     0300, 0301, 0302, 0303, 0304, 0305, 0306, 0307,
!     0310, 0311, 0312, 0313, 0314, 0315, 0316, 0317,
!     0320, 0321, 0322, 0323, 0324, 0325, 0326, 0327,
!     0330, 0331, 0332, 0333, 0334, 0335, 0336, 0367,
!     0340, 0341, 0342, 0343, 0344, 0345, 0346, 0377
    };
  
  main (argc, argv)
*** src/search.c	Sun Nov  3 04:23:26 1991
--- ../epoch-4.0/src/search.c	Thu Dec 12 16:49:59 1991
***************
*** 1264,1279 ****
  
    for (i = 0; i < 0400; i++)
      {
!       downcase_table[i] = (i >= 'A' && i <= 'Z') ? i + 040 : i;
  /* We do this instead of using compute_trt_inverse to save space. */
   /* Does it? */
!       downcase_table[0400+i]
! 	= ((i >= 'A' && i <= 'Z')
! 	   ? i + ('a' - 'A')
! 	   : ((i >= 'a' && i <= 'z')
! 	      ? i + ('A' - 'a')
! 	      : i));
!     }
  /* Use this instead when there come to be multiple translation tables. 
    compute_trt_inverse (downcase_table);    */
  
--- 1264,1298 ----
  
    for (i = 0; i < 0400; i++)
      {
!        /*
!         * Table updated to handle extended character set.
!         */
!        if (i >= 'A' && i <= 'Z')
!  	downcase_table[i] = i + 'a' - 'A';
!        else if (i >= 0300 && i <= 0326)
!  	downcase_table[i] = i + 040;
!        else if (i >= 0330 && i <= 0336)
!  	downcase_table[i] = i + 040;
!        else
!  	downcase_table[i] = i;
  /* We do this instead of using compute_trt_inverse to save space. */
   /* Does it? */
!  
! 	   if (i >= 'A' && i <= 'Z')
! 	downcase_table[0400+i] = i + 'a' - 'A';
!        else if (i >= 0300 && i <= 0326)
!  	downcase_table[0400+i] = i + 040;
!        else if (i >= 0330 && i <= 0336)
!  	downcase_table[0400+i] = i + 040;
!        else if (i >= 'a' && i <= 'z')
!  	downcase_table[0400+i] = i + 'A' - 'a';
!       else if (i >= 0340 && i <= 0366)
!  	downcase_table[0400+i] = i - 040;
!        else if (i >= 0370 && i <= 0376)
!  	downcase_table[0400+i] = i - 040;
!        else
!  	downcase_table[0400+i] = i;
!    }
  /* Use this instead when there come to be multiple translation tables. 
    compute_trt_inverse (downcase_table);    */
  
*** src/syntax.c	Sun Nov  3 04:23:29 1991
--- ../epoch-4.0/src/syntax.c	Thu Dec 12 16:53:22 1991
***************
*** 1106,1111 ****
--- 1106,1138 ----
  
    for (i = 0; i < 12; i++)
      XFASTINT (v->contents[".,;:?!#@~^'`"[i]]) = (int) Spunct;
+ 
+    /*
+     * Syntax table entries for extended character set:
+     */
+  
+    for (i = 0300; i <= 0326; i++)
+      XFASTINT (v->contents[i]) = (int) Sword;
+    for (i = 0330; i <= 0337; i++)
+      XFASTINT (v->contents[i]) = (int) Sword;
+    for (i = 0340; i <= 0366; i++)
+      XFASTINT (v->contents[i]) = (int) Sword;
+    for (i = 0370; i <= 0377; i++)
+      XFASTINT (v->contents[i]) = (int) Sword;
+  
+    XFASTINT (v->contents[0240]) = (int) Swhitespace;
+    
+    for (i = 0242; i <= 0245; i++)
+      XFASTINT (v->contents[i]) = (int) Sword;
+  
+    for (i = 0246; i <= 0276; i++)
+      XFASTINT (v->contents[i]) = (int) Ssymbol;
+  
+    XFASTINT (v->contents[0327]) = (int) Ssymbol;
+    XFASTINT (v->contents[0367]) = (int) Ssymbol;
+  
+    XFASTINT (v->contents[0241]) = (int) Spunct;
+    XFASTINT (v->contents[0277]) = (int) Spunct;
  }
  
  syms_of_syntax ()
*** src/x11term.c	Mon Nov  4 04:58:38 1991
--- ../epoch-4.0/src/x11term.c	Thu Dec 12 17:28:07 1991
***************
*** 182,187 ****
--- 182,189 ----
  
  int XXpid;
  
+ static XComposeStatus status;
+  
  static int InUpdate;		/* many of functions here may be invoked
  				 * even if no update in progress; when
  				 * no update is in progress the action
***************
*** 347,352 ****
--- 349,356 ----
  	fprintf (stderr, "XTset_terminal_modes\n");
  #endif
    InUpdate = 0;
+   status.compose_ptr = 0;
+   status.chars_matched = 0;
    if (!initialized)
      {
        xs->cursor_exists = 0;
***************
*** 1306,1313 ****
    char mapping_buf[20];
    BLOCK_INPUT_DECLARE ();
    XEvent event;
-   /* Must be static since data is saved between calls.  */
-   static XComposeStatus status;
    KeySym keysym;
    struct Root_Block *rb,*x_find_screen();
    struct X_Screen *xs;
--- 1310,1315 ----
***************
*** 1314,1319 ****
--- 1316,1322 ----
    struct W_Screen *ws;
    struct X_font *font;
    Display *xdisp = XXSCREEN(root->x11)->display;
+   extern int meta_prefix_char;
  
    extern Atom selection_selection;
    extern Window selection_screen;
***************
*** 1506,1512 ****
  	case KeyPress:
  	  nbytes = XLookupString (&event.xkey,
  				  mapping_buf, MAPPINGBUFLEN, &keysym,
! 				  0);
  	  /* Someday this will be unnecessary as we will
  	   * be able to use XRebindKeysym so XLookupString
  	   * will have already given us the string we want.
--- 1509,1515 ----
  	case KeyPress:
  	  nbytes = XLookupString (&event.xkey,
  				  mapping_buf, MAPPINGBUFLEN, &keysym,
! 				  &status);
  	  /* Someday this will be unnecessary as we will
  	   * be able to use XRebindKeysym so XLookupString
  	   * will have already given us the string we want.
***************
*** 1518,1524 ****
  	      extern char *stringFuncVal();
  
  	      if (!EQ(Qnil,Vepoch_function_key_mapping) &&
! 		  (IsFunctionKey(keysym) || IsMiscFunctionKey(keysym)))
  		{
  		  strcpy(mapping_buf,"\033[");
  		  strcat(mapping_buf,stringFuncVal(keysym));
--- 1521,1528 ----
  	      extern char *stringFuncVal();
  
  	      if (!EQ(Qnil,Vepoch_function_key_mapping) &&
! 		  (IsFunctionKey(keysym)
!            || (IsMiscFunctionKey(keysym) && (keysym != XK_Mode_switch))))
  		{
  		  strcpy(mapping_buf,"\033[");
  		  strcat(mapping_buf,stringFuncVal(keysym));
***************
*** 1546,1554 ****
  #endif				/* not AIX */
  	  if (nbytes)
  	    {
! 	      if ((nbytes == 1) && (event.xkey.state & Mod1Mask))
! 		*mapping_buf |= METABIT;
  	      if ((nbytes == 1) && (event.xkey.state & ControlMask))
  		*mapping_buf &= 0x9F; /* mask off bits 1 and 2 */
  	      if (numchars > nbytes)
  		{
--- 1550,1574 ----
  #endif				/* not AIX */
  	  if (nbytes)
  	    {
!  	if ((nbytes == 1) && (event.xkey.state & Mod1Mask)) {
!  	  /* Character typed with META-shift key held down is split
!  	     into META-prefix + ASCII-character. */
!  	  mapping_buf[1] = mapping_buf[0] & 0x7F;
!  	  mapping_buf[0] = meta_prefix_char;
!  	  nbytes = 2;
!  	}
!  	else if ((nbytes == 1) && (event.xkey.state & Mod3Mask)) {
!  	  KeySym ks;
! #define KeysymToChar(k) (k & 0xFF)
! 
!  	  if ((ks = XLookupKeysym(&event.xkey,
!  				  (event.xkey.state & ShiftMask) ? 3 : 2))
!  	      != NoSymbol) {
!  	    *mapping_buf = KeysymToChar(ks);
!  	  }
!  	} 
  	      if ((nbytes == 1) && (event.xkey.state & ControlMask))
+ 
  		*mapping_buf &= 0x9F; /* mask off bits 1 and 2 */
  	      if (numchars > nbytes)
  		{
*** src/x11term.h	Sun Nov  3 04:23:48 1991
--- ../epoch-4.0/src/x11term.h	Thu Dec 12 17:08:49 1991
***************
*** 10,15 ****
--- 10,16 ----
  #include <X11/keysym.h>
  #include <X11/cursorfont.h>
  #include <X11/Xutil.h>
+ #include <X11/X10.h>
  
  #define XMOUSEBUFSIZE 64
  
*** src/xdispepoch.c	Sun Nov  3 04:23:50 1991
--- ../epoch-4.0/src/xdispepoch.c	Fri Dec 13 09:39:48 1991
***************
*** 1593,1598 ****
--- 1593,1599 ----
    int tab_width = XINT(current_buffer->tab_width);
    int ctl_arrow = (!NULL(current_buffer->ctl_arrow))
      + (EQ (current_buffer->ctl_arrow, Qt));
+   int meta_printable = !NULL (current_buffer->meta_printable);
    struct position val;
    struct buffer *b = current_buffer;
    int pixright = w->pixleft + w->pixwidth;
***************
*** 1792,1798 ****
  	  ADD_LEFT_CHAR();
  	}
        c = *p++;
!       if (c >= 040 && c < 0177)
  	{
  	  if (numchars < 0)
  	    numchars++;
--- 1793,1800 ----
  	  ADD_LEFT_CHAR();
  	}
        c = *p++;
!       if ((c >= 040 && c < 0177)
!             || (meta_printable && is_meta_char(c)))
  	{
  	  if (numchars < 0)
  	    numchars++;
***************
*** 1974,1980 ****
  	      lwidth += prev->width;
  	    }
  	}
!       else if (c < 0200 && ctl_arrow)
  	{
  	  if (numchars < 0)
  	    numchars++;
--- 1976,1982 ----
  	      lwidth += prev->width;
  	    }
  	}
!       else if (is_control_char(c) && ctl_arrow)
  	{
  	  if (numchars < 0)
  	    numchars++;
***************
*** 2403,2409 ****
        c = *string++;
        if (!c) break;
  
!       if (c >= 040 && c < 0177)
  	{
  	  if ((cb->ch != c) || (cb->style != style) || replot_lines)
  	    {
--- 2405,2412 ----
        c = *string++;
        if (!c) break;
  
!       if ((c >= 040 && c < 0177)
! 		  || (buffer_defaults.meta_printable && is_meta_char(c)))
  	{
  	  if ((cb->ch != c) || (cb->style != style) || replot_lines)
  	    {
***************
*** 2451,2457 ****
  	  numchars++;
  	  lwidth += prev->width;
  	}
!       else if (c < 0200 && buffer_defaults.ctl_arrow)
  	{
  	  c1 = '^';	      
  	  if ((cb->ch != c1) || (cb->style != style) || replot_lines)
--- 2454,2460 ----
  	  numchars++;
  	  lwidth += prev->width;
  	}
!       else if (is_control_char(c) && buffer_defaults.ctl_arrow)
  	{
  	  c1 = '^';	      
  	  if ((cb->ch != c1) || (cb->style != style) || replot_lines)
*** etc/emacstool.c	Sun Nov  3 04:29:25 1991
--- ../epoch-4.0/etc/emacstool.c	Thu Dec 12 17:22:29 1991
***************
*** 263,268 ****
--- 263,285 ----
    }
    if ((event_is_ascii(event) || event_is_meta(event)) 
        && event_is_up(event)) return NOTIFY_IGNORED;
+ 
+   /* Characters with a character code >= 128, and which are
+     * entered using the meta key, are translated into a two-character
+     * code with an ESC prefix. This makes it possible to distinguish
+     * between meta commands, and characters in the ISO 8859-1
+     * standard that are entered using dedicated keys.
+     */
+    if ((event_is_meta(event) && event_meta_is_down(event)))
+      {
+        char buffer[4];
+  
+        sprintf (buffer, "\033%c", event_id(event) - 128);
+        ttysw_input(tty_win, buffer, 2);
+  
+        return NOTIFY_IGNORED;
+      }
+  
    /* Allow arbitary mapping of ASCII keys,
       mostly, this will allow swapping BS and DEL (the -bs option) */
    if (event_is_ascii(event))
*** lisp/isearch.el	Sun Nov  3 04:19:26 1991
--- ../epoch-4.0/lisp/isearch.el	Thu Dec 12 17:41:50 1991
***************
*** 107,118 ****
  			 ?\C-g
  		       (read-char))))
  	   (setq quit-flag nil adjusted nil)
! 	   ;; Meta character means exit search.
! 	   (cond ((and (>= char 128)
! 		       search-exit-option)
! 		  (setq unread-command-char char)
! 		  (throw 'search-done t))
! 		 ((eq char search-exit-char)
  		  ;; Esc means exit search normally.
  		  ;; Except, if first thing typed, it means do nonincremental
  		  (if (= 0 (length search-string))
--- 107,119 ----
  			 ?\C-g
  		       (read-char))))
  	   (setq quit-flag nil adjusted nil)
!  	   ;; Meta character no longer means exit search.
!  	   (cond
! 		;;((and (>= char 128)
! 		;;     search-exit-option)
! 		;;(setq unread-command-char char)
! 		;;(throw 'search-done t))
!   		 ((eq char search-exit-char)
  		  ;; Esc means exit search normally.
  		  ;; Except, if first thing typed, it means do nonincremental
  		  (if (= 0 (length search-string))
