changeset 485:8c615e453683

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Mon, 13 Jan 1992 21:48:08 +0000
parents 3165b2697c78
children 80cdb2387043
files src/=xselect.c.old src/alloc.c src/buffer.c src/buffer.h src/bytecode.c src/callint.c src/cmds.c src/commands.h src/dired.c src/dispextern.h src/doc.c src/eval.c src/fileio.c src/filelock.c src/floatfns.c src/fns.c src/frame.c src/frame.h src/hftctl.c src/keymap.c src/lread.c src/macros.c src/ralloc.c src/sunfns.c src/syntax.c src/termhooks.h src/undo.c src/unexaix.c src/unexec.c src/window.c src/xdisp.c src/xfns.c src/xmenu.c src/xrdb.c src/xterm.c src/xterm.h
diffstat 36 files changed, 990 insertions(+), 890 deletions(-) [+]
line wrap: on
line diff
--- a/src/=xselect.c.old	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/=xselect.c.old	Mon Jan 13 21:48:08 1992 +0000
@@ -28,11 +28,13 @@
 #define MAX_SELECTION(dpy) (((dpy)->max_request_size << 3) - 100)
 #define SELECTION_LENGTH(len,format) ((len) * ((format) >> 3))
 
-/* The last 23 bits of the timestamp of the last mouse button event. */
-extern Time mouse_timestamp;
+/* From keyboard.c.  This is almost always the right timestamp for
+   ownership arbitration, since the last event was either the
+   keystroke bound to the command now running, or something else read
+   by that command.  */
+extern unsigned long last_event_timestamp;
 
 /* t if a mouse button is depressed. */
-
 extern Lisp_Object Vmouse_grabbed;
 
 /* When emacs became the PRIMARY selection owner. */
@@ -113,7 +115,7 @@
 
   if (EQ (Qnil, Vx_selection_value)) /* We are not the owner. */
     {
-      event_time = mouse_timestamp;
+      event_time = last_event_timestamp;
       XSetSelectionOwner (x_current_display, XA_PRIMARY,
 			  selecting_window,  event_time);
       owner_window = XGetSelectionOwner (x_current_display, XA_PRIMARY);
@@ -150,7 +152,7 @@
 
   if (EQ (Qnil, Vx_clipboard_value))
     {
-      event_time = mouse_timestamp;
+      event_time = last_event_timestamp;
       XSetSelectionOwner (x_current_display, Xatom_clipboard,
 			  selecting_window,  event_time);
       owner_window = XGetSelectionOwner (x_current_display, Xatom_clipboard);
@@ -489,7 +491,7 @@
     return Vx_selection_value;
 
   BLOCK_INPUT;
-  requestor_time = mouse_timestamp;
+  requestor_time = last_event_timestamp;
   requestor_window = selected_screen->display.x->window_desc;
   XConvertSelection (x_current_display, XA_PRIMARY, XA_STRING,
 		     Xatom_emacs_selection, requestor_window, requestor_time);
@@ -520,7 +522,7 @@
     return Vx_selection_value;
 
   BLOCK_INPUT;
-  requestor_time = mouse_timestamp;
+  requestor_time = last_event_timestamp;
   requestor_window = selected_screen->display.x->window_desc;
   XConvertSelection (x_current_display, Xatom_clipboard, XA_STRING,
 		     Xatom_clipboard_selection,
--- a/src/alloc.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/alloc.c	Mon Jan 13 21:48:08 1992 +0000
@@ -329,7 +329,7 @@
   XFASTINT (len) = nargs;
   val = Fmake_list (len, Qnil);
   val_tail = val;
-  while (!NULL (val_tail))
+  while (!NILP (val_tail))
     {
       XCONS (val_tail)->car = *args++;
       val_tail = XCONS (val_tail)->cdr;
@@ -425,14 +425,14 @@
   register struct Lisp_Vector *p;
 
   XFASTINT (len) = nargs;
-  if (!NULL (Vpurify_flag))
+  if (!NILP (Vpurify_flag))
     val = make_pure_vector (len);
   else
     val = Fmake_vector (len, Qnil);
   p = XVECTOR (val);
   for (index = 0; index < nargs; index++)
     {
-      if (!NULL (Vpurify_flag))
+      if (!NILP (Vpurify_flag))
 	args[index] = Fpurecopy (args[index]);
       p->contents[index] = args[index];
     }
@@ -905,7 +905,7 @@
   register Lisp_Object new, tem;
   register int i;
 
-  if (NULL (Vpurify_flag))
+  if (NILP (Vpurify_flag))
     return obj;
 
   if ((PNTR_COMPARISON_TYPE) XPNTR (obj) < (PNTR_COMPARISON_TYPE) ((char *) pure + PURESIZE)
@@ -1041,7 +1041,7 @@
 
   /* Save a copy of the contents of the stack, for debugging.  */
 #if MAX_SAVE_STACK > 0
-  if (NULL (Vpurify_flag))
+  if (NILP (Vpurify_flag))
     {
       i = &stack_top_variable - stack_bottom;
       if (i < 0) i = -i;
--- a/src/buffer.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/buffer.c	Mon Jan 13 21:48:08 1992 +0000
@@ -25,9 +25,6 @@
 #define MAXPATHLEN 1024
 #endif /* not MAXPATHLEN */
 
-#ifdef NULL
-#undef NULL
-#endif
 #include "config.h"
 #include "lisp.h"
 #include "window.h"
@@ -163,7 +160,7 @@
       if (XTYPE (buf) != Lisp_Buffer) continue;
       if (XTYPE (XBUFFER (buf)->filename) != Lisp_String) continue;
       tem = Fstring_equal (XBUFFER (buf)->filename, filename);
-      if (!NULL (tem))
+      if (!NILP (tem))
 	return buf;
     }
   return Qnil;
@@ -185,7 +182,7 @@
   register struct buffer *b;
 
   buf = Fget_buffer (name);
-  if (!NULL (buf))
+  if (!NILP (buf))
     return buf;
 
   b = (struct buffer *) malloc (sizeof (struct buffer));
@@ -227,14 +224,14 @@
   b->name = name;
 
   function = buffer_defaults.major_mode;
-  if (NULL (function))
+  if (NILP (function))
     {
       tem = Fget (current_buffer->major_mode, Qmode_class);
       if (EQ (tem, Qnil))
 	function = current_buffer->major_mode;
     }
 
-  if (NULL (function) || EQ (function, Qfundamental_mode))
+  if (NILP (function) || EQ (function, Qfundamental_mode))
     return buf;
 
   /* To select a nonfundamental mode,
@@ -327,7 +324,7 @@
   CHECK_STRING (name, 0);
 
   tem = Fget_buffer (name);
-  if (NULL (tem))
+  if (NILP (tem))
     return name;
 
   count = 1;
@@ -336,7 +333,7 @@
       sprintf (number, "<%d>", ++count);
       gentemp = concat2 (name, build_string (number));
       tem = Fget_buffer (gentemp);
-      if (NULL (tem))
+      if (NILP (tem))
 	return gentemp;
     }
 }
@@ -348,7 +345,7 @@
   (buffer)
      register Lisp_Object buffer;
 {
-  if (NULL (buffer))
+  if (NILP (buffer))
     return current_buffer->name;
   CHECK_BUFFER (buffer, 0);
   return XBUFFER (buffer)->name;
@@ -360,7 +357,7 @@
   (buffer)
      register Lisp_Object buffer;
 {
-  if (NULL (buffer))
+  if (NILP (buffer))
     return current_buffer->filename;
   CHECK_BUFFER (buffer, 0);
   return XBUFFER (buffer)->filename;
@@ -378,7 +375,7 @@
   register struct buffer *buf;
   register Lisp_Object val;
 
-  if (NULL (buffer))
+  if (NILP (buffer))
     buf = current_buffer;
   else
     {
@@ -433,7 +430,7 @@
      register Lisp_Object buffer;
 {
   register struct buffer *buf;
-  if (NULL (buffer))
+  if (NILP (buffer))
     buf = current_buffer;
   else
     {
@@ -459,17 +456,17 @@
      If buffer becoming unmodified, unlock the file.  */
 
   fn = current_buffer->filename;
-  if (!NULL (fn))
+  if (!NILP (fn))
     {
       already = current_buffer->save_modified < MODIFF;
-      if (!already && !NULL (flag))
+      if (!already && !NILP (flag))
 	lock_file (fn);
-      else if (already && NULL (flag))
+      else if (already && NILP (flag))
 	unlock_file (fn);
     }
 #endif /* CLASH_DETECTION */
 
-  current_buffer->save_modified = NULL (flag) ? MODIFF : 0;
+  current_buffer->save_modified = NILP (flag) ? MODIFF : 0;
   update_mode_lines++;
   return flag;
 }
@@ -484,7 +481,7 @@
      register Lisp_Object buffer;
 {
   register struct buffer *buf;
-  if (NULL (buffer))
+  if (NILP (buffer))
     buf = current_buffer;
   else
     {
@@ -513,9 +510,9 @@
   tem = Fget_buffer (name);
   if (XBUFFER (tem) == current_buffer)
     return current_buffer->name;
-  if (!NULL (tem))
+  if (!NILP (tem))
     {
-      if (!NULL (distinguish))
+      if (!NILP (distinguish))
 	name = Fgenerate_new_buffer_name (name);
       else
 	error ("Buffer name \"%s\" is in use", XSTRING (name)->data);
@@ -524,7 +521,7 @@
   current_buffer->name = name;
   XSET (buf, Lisp_Buffer, current_buffer);
   Fsetcar (Frassq (buf, Vbuffer_alist), name);
-  if (NULL (current_buffer->filename) && !NULL (current_buffer->auto_save_file_name))
+  if (NILP (current_buffer->filename) && !NILP (current_buffer->auto_save_file_name))
     call0 (intern ("rename-auto-save-file"));
   return name;
 }
@@ -540,7 +537,7 @@
   register Lisp_Object tail, buf, notsogood, tem;
   notsogood = Qnil;
 
-  for (tail = Vbuffer_alist; !NULL (tail); tail = Fcdr (tail))
+  for (tail = Vbuffer_alist; !NILP (tail); tail = Fcdr (tail))
     {
       buf = Fcdr (Fcar (tail));
       if (EQ (buf, buffer))
@@ -548,12 +545,12 @@
       if (XSTRING (XBUFFER (buf)->name)->data[0] == ' ')
 	continue;
       tem = Fget_buffer_window (buf, Qnil);
-      if (NULL (tem))
+      if (NILP (tem))
 	return buf;
-      if (NULL (notsogood))
+      if (NILP (notsogood))
 	notsogood = buf;
     }
-  if (!NULL (notsogood))
+  if (!NILP (notsogood))
     return notsogood;
   return Fget_buffer_create (build_string ("*scratch*"));
 }
@@ -579,12 +576,12 @@
   register struct buffer *b;
   register Lisp_Object buf1;
 
-  if (NULL (buf))
+  if (NILP (buf))
     b = current_buffer;
   else
     {
       buf1 = Fget_buffer (buf);
-      if (NULL (buf1)) nsberror (buf);
+      if (NILP (buf1)) nsberror (buf);
       b = XBUFFER (buf1);
     }
 
@@ -620,24 +617,24 @@
   register struct Lisp_Marker *m;
   struct gcpro gcpro1, gcpro2;
 
-  if (NULL (bufname))
+  if (NILP (bufname))
     buf = Fcurrent_buffer ();
   else
     buf = Fget_buffer (bufname);
-  if (NULL (buf))
+  if (NILP (buf))
     nsberror (bufname);
 
   b = XBUFFER (buf);
 
   /* Query if the buffer is still modified.  */
-  if (INTERACTIVE && !NULL (b->filename)
+  if (INTERACTIVE && !NILP (b->filename)
       && BUF_MODIFF (b) > b->save_modified)
     {
       GCPRO2 (buf, bufname);
       tem = do_yes_or_no_p (format1 ("Buffer %s modified; kill anyway? ",
 				     XSTRING (b->name)->data));
       UNGCPRO;
-      if (NULL (tem))
+      if (NILP (tem))
 	return Qnil;
     }
 
@@ -660,7 +657,7 @@
   if (EQ (buf, XWINDOW (minibuf_window)->buffer))
     return Qnil;
 
-  if (NULL (b->name))
+  if (NILP (b->name))
     return Qnil;
 
   /* Make this buffer not be current.
@@ -696,7 +693,7 @@
     {
       Lisp_Object tem;
       tem = Fsymbol_value (intern ("delete-auto-save-files"));
-      if (! NULL (tem))
+      if (! NILP (tem))
 	unlink (XSTRING (b->auto_save_file_name)->data);
     }
 
@@ -739,7 +736,7 @@
   /* Effectively do Vbuffer_alist = Fdelq (link, Vbuffer_alist)
      but cannot use Fdelq here it that allows quitting.  */
 
-  if (NULL (prev))
+  if (NILP (prev))
     Vbuffer_alist = XCONS (Vbuffer_alist)->cdr;
   else
     XCONS (prev)->cdr = XCONS (XCONS (prev)->cdr)->cdr;
@@ -766,15 +763,15 @@
   if (EQ (minibuf_window, selected_window))
     error ("Cannot switch buffers in minibuffer window");
   tem = Fwindow_dedicated_p (selected_window);
-  if (!NULL (tem))
+  if (!NILP (tem))
     error ("Cannot switch buffers in a dedicated window");
 
-  if (NULL (bufname))
+  if (NILP (bufname))
     buf = Fother_buffer (Fcurrent_buffer ());
   else
     buf = Fget_buffer_create (bufname);
   Fset_buffer (buf);
-  if (NULL (norecord))
+  if (NILP (norecord))
     record_buffer (buf);
 
   Fset_window_buffer (EQ (selected_window, minibuf_window)
@@ -794,7 +791,7 @@
      Lisp_Object bufname, other;
 {
   register Lisp_Object buf;
-  if (NULL (bufname))
+  if (NILP (bufname))
     buf = Fother_buffer (Fcurrent_buffer ());
   else
     buf = Fget_buffer_create (bufname);
@@ -834,7 +831,7 @@
   /* Look down buffer's list of local Lisp variables
      to find and update any that forward into C variables. */
 
-  for (tail = b->local_var_alist; !NULL (tail); tail = XCONS (tail)->cdr)
+  for (tail = b->local_var_alist; !NILP (tail); tail = XCONS (tail)->cdr)
     {
       valcontents = XSYMBOL (XCONS (XCONS (tail)->car)->car)->value;
       if ((XTYPE (valcontents) == Lisp_Buffer_Local_Value
@@ -850,7 +847,7 @@
   /* Do the same with any others that were local to the previous buffer */
 
   if (old_buf)
-    for (tail = old_buf->local_var_alist; !NULL (tail); tail = XCONS (tail)->cdr)
+    for (tail = old_buf->local_var_alist; !NILP (tail); tail = XCONS (tail)->cdr)
       {
 	valcontents = XSYMBOL (XCONS (XCONS (tail)->car)->car)->value;
 	if ((XTYPE (valcontents) == Lisp_Buffer_Local_Value
@@ -876,9 +873,9 @@
 {
   register Lisp_Object buffer;
   buffer = Fget_buffer (bufname);
-  if (NULL (buffer))
+  if (NILP (buffer))
     nsberror (bufname);
-  if (NULL (XBUFFER (buffer)->name))
+  if (NILP (XBUFFER (buffer)->name))
     error ("Selecting deleted buffer");
   set_buffer_internal (XBUFFER (buffer));
   return buffer;
@@ -889,7 +886,7 @@
   "Signal a `buffer-read-only' error if the current buffer is read-only.")
   ()
 {
-  while (!NULL (current_buffer->read_only))
+  while (!NILP (current_buffer->read_only))
     Fsignal (Qbuffer_read_only, (Fcons (Fcurrent_buffer (), Qnil)));
   return Qnil;
 }
@@ -903,7 +900,7 @@
 {
   register Lisp_Object aelt, link;
 
-  if (NULL (buf))
+  if (NILP (buf))
     {
       XSET (buf, Lisp_Buffer, current_buffer);
       Fswitch_to_buffer (Fother_buffer (buf), Qnil);
@@ -913,7 +910,7 @@
       Lisp_Object buf1;
       
       buf1 = Fget_buffer (buf);
-      if (NULL (buf1))
+      if (NILP (buf1))
 	nsberror (buf);
       buf = buf1;
     }	  
@@ -983,7 +980,7 @@
 
   tail = intern ("Buffer-menu-mode");
   if (!EQ (tail, current_buffer->major_mode)
-      && (tem = Ffboundp (tail), !NULL (tem)))
+      && (tem = Ffboundp (tail), !NILP (tem)))
     call0 (tail);
   Fbuffer_disable_undo (Vstandard_output);
   current_buffer->read_only = Qnil;
@@ -992,7 +989,7 @@
  MR Buffer         Size  Mode           File\n\
  -- ------         ----  ----           ----\n", -1);
 
-  for (tail = Vbuffer_alist; !NULL (tail); tail = Fcdr (tail))
+  for (tail = Vbuffer_alist; !NILP (tail); tail = Fcdr (tail))
     {
       buf = Fcdr (Fcar (tail));
       b = XBUFFER (buf);
@@ -1000,7 +997,7 @@
       if (XSTRING (b->name)->data[0] == ' ')
 	continue;
       /* Optionally don't mention buffers that lack files. */
-      if (!NULL (files) && NULL (b->filename))
+      if (!NILP (files) && NILP (b->filename))
 	continue;
       /* Identify the current buffer. */
       if (b == old)
@@ -1008,7 +1005,7 @@
       write_string (b == old ? "." : " ", -1);
       /* Identify modified buffers */
       write_string (BUF_MODIFF (b) > b->save_modified ? "*" : " ", -1);
-      write_string (NULL (b->read_only) ? "  " : "% ", -1);
+      write_string (NILP (b->read_only) ? "  " : "% ", -1);
       Fprinc (b->name, Qnil);
       Findent_to (col1, make_number (2));
       XFASTINT (tem) = BUF_Z (b) - BUF_BEG (b);
@@ -1017,7 +1014,7 @@
       Fprinc (b->mode_name, Qnil);
       Findent_to (col3, minspace);
 
-      if (!NULL (b->filename))
+      if (!NILP (b->filename))
 	Fprinc (b->filename, Qnil);
       else
 	{
@@ -1025,7 +1022,7 @@
 	  Lisp_Object tem;
 	  set_buffer_internal (b);
 	  tem = Fboundp (other_file_symbol);
-	  if (!NULL (tem))
+	  if (!NILP (tem))
 	    {
 	      tem = Fsymbol_value (other_file_symbol);
 	      Fset_buffer (Vstandard_output);
@@ -1085,7 +1082,7 @@
   /* Make sure no local variables remain set up with this buffer
      for their current values.  */
 
-  for (alist = oalist; !NULL (alist); alist = XCONS (alist)->cdr)
+  for (alist = oalist; !NILP (alist); alist = XCONS (alist)->cdr)
     {
       sym = XCONS (XCONS (alist)->car)->car;
 
@@ -1115,11 +1112,11 @@
   /* Any which are supposed to be permanent,
      make local again, with the same values they had.  */
      
-  for (alist = oalist; !NULL (alist); alist = XCONS (alist)->cdr)
+  for (alist = oalist; !NILP (alist); alist = XCONS (alist)->cdr)
     {
       sym = XCONS (XCONS (alist)->car)->car;
       tem = Fget (sym, Qpermanent_local);
-      if (! NULL (tem))
+      if (! NILP (tem))
 	{
 	  Fmake_local_variable (sym);
 	  Fset (sym, XCONS (XCONS (alist)->car)->cdr);
@@ -1146,7 +1143,7 @@
   Lisp_Object fieldlist;
   Lisp_Object collector;
 
-  if (NULL (buffer))
+  if (NILP (buffer))
     fieldlist = current_buffer->fieldlist;
   else
     {
@@ -1174,9 +1171,9 @@
       if ((start_loc < field_start && end_loc > field_start)
 	  || (start_loc >= field_start && start_loc < field_end))
 	{
-	  if (!NULL (error_check))
+	  if (!NILP (error_check))
 	    {
-	      if (!NULL (FIELD_PROTECTED_FLAG (field)))
+	      if (!NILP (FIELD_PROTECTED_FLAG (field)))
 		{
 		  struct gcpro gcpro1;
 		  GCPRO1 (fieldlist);
--- a/src/buffer.h	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/buffer.h	Mon Jan 13 21:48:08 1992 +0000
@@ -128,7 +128,6 @@
 				   for this buffer.  It is incremented for
 				   each such event, and never otherwise
 				   changed.  */
-
   };
 
 struct buffer
@@ -148,7 +147,7 @@
     /* Flags saying which DEFVAR_PER_BUFFER variables
        are local to this buffer.  */
     int local_var_flags;
-    /* Value of text.modified as of when visited file was read or written. */
+    /* Value of text.modiff as of when visited file was read or written. */
     int save_modified;
     /* Set to the modtime of the visited file when read or written.
        -1 means visited file was nonexistent.
--- a/src/bytecode.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/bytecode.c	Mon Jan 13 21:48:08 1992 +0000
@@ -450,7 +450,7 @@
 
 	case Bgotoifnil:
 	  op = FETCH2;
-	  if (NULL (POP))
+	  if (NILP (POP))
 	    {
 	      QUIT;
 	      pc = XSTRING (string_saved)->data + op;
@@ -459,7 +459,7 @@
 
 	case Bgotoifnonnil:
 	  op = FETCH2;
-	  if (!NULL (POP))
+	  if (!NILP (POP))
 	    {
 	      QUIT;
 	      pc = XSTRING (string_saved)->data + op;
@@ -468,7 +468,7 @@
 
 	case Bgotoifnilelsepop:
 	  op = FETCH2;
-	  if (NULL (TOP))
+	  if (NILP (TOP))
 	    {
 	      QUIT;
 	      pc = XSTRING (string_saved)->data + op;
@@ -478,7 +478,7 @@
 
 	case Bgotoifnonnilelsepop:
 	  op = FETCH2;
-	  if (!NULL (TOP))
+	  if (!NILP (TOP))
 	    {
 	      QUIT;
 	      pc = XSTRING (string_saved)->data + op;
@@ -492,7 +492,7 @@
 	  break;
 
 	case BRgotoifnil:
-	  if (NULL (POP))
+	  if (NILP (POP))
 	    {
 	      QUIT;
 	      pc += *pc - 128;
@@ -501,7 +501,7 @@
 	  break;
 
 	case BRgotoifnonnil:
-	  if (!NULL (POP))
+	  if (!NILP (POP))
 	    {
 	      QUIT;
 	      pc += *pc - 128;
@@ -511,7 +511,7 @@
 
 	case BRgotoifnilelsepop:
 	  op = *pc++;
-	  if (NULL (TOP))
+	  if (NILP (TOP))
 	    {
 	      QUIT;
 	      pc += op - 128;
@@ -521,7 +521,7 @@
 
 	case BRgotoifnonnilelsepop:
 	  op = *pc++;
-	  if (!NULL (TOP))
+	  if (!NILP (TOP))
 	    {
 	      QUIT;
 	      pc += op - 128;
@@ -598,7 +598,7 @@
 	    {
 	      if (CONSP (v1))
 		v1 = XCONS (v1)->cdr;
-	      else if (!NULL (v1))
+	      else if (!NILP (v1))
 		{
 		  immediate_quit = 0;
 		  v1 = wrong_type_argument (Qlistp, v1);
@@ -622,7 +622,7 @@
 	  break;
 
 	case Blistp:
-	  TOP = CONSP (TOP) || NULL (TOP) ? Qt : Qnil;
+	  TOP = CONSP (TOP) || NILP (TOP) ? Qt : Qnil;
 	  break;
 
 	case Beq:
@@ -636,21 +636,21 @@
 	  break;
 
 	case Bnot:
-	  TOP = NULL (TOP) ? Qt : Qnil;
+	  TOP = NILP (TOP) ? Qt : Qnil;
 	  break;
 
 	case Bcar:
 	  v1 = TOP;
 	docar:
 	  if (CONSP (v1)) TOP = XCONS (v1)->car;
-	  else if (NULL (v1)) TOP = Qnil;
+	  else if (NILP (v1)) TOP = Qnil;
 	  else Fcar (wrong_type_argument (Qlistp, v1));
 	  break;
 
 	case Bcdr:
 	  v1 = TOP;
 	  if (CONSP (v1)) TOP = XCONS (v1)->cdr;
-	  else if (NULL (v1)) TOP = Qnil;
+	  else if (NILP (v1)) TOP = Qnil;
 	  else Fcdr (wrong_type_argument (Qlistp, v1));
 	  break;
 
--- a/src/callint.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/callint.c	Mon Jan 13 21:48:08 1992 +0000
@@ -103,7 +103,7 @@
      register Lisp_Object exp;
 {
   if (XTYPE (exp) != Lisp_Int && XTYPE (exp) != Lisp_String
-      && !NULL (exp) && !EQ (exp, Qt))
+      && !NILP (exp) && !EQ (exp, Qt))
     return Fcons (Qquote, Fcons (exp, Qnil));
 
   return exp;
@@ -131,7 +131,7 @@
 check_mark ()
 {
   Lisp_Object tem = Fmarker_buffer (current_buffer->mark);
-  if (NULL (tem) || (XBUFFER (tem) != current_buffer))
+  if (NILP (tem) || (XBUFFER (tem) != current_buffer))
     error ("The mark is not set now");
 }
 
@@ -221,7 +221,7 @@
   else if (EQ (funcar, Qlambda))
     {
       specs = Fassq (Qinteractive, Fcdr (Fcdr (fun)));
-      if (NULL (specs))
+      if (NILP (specs))
 	goto lose;
       specs = Fcar (Fcdr (specs));
     }
@@ -236,7 +236,7 @@
     {
       i = num_input_chars;
       specs = Feval (specs);
-      if (i != num_input_chars || !NULL (record))
+      if (i != num_input_chars || !NILP (record))
 	Vcommand_history
 	  = Fcons (Fcons (function, quotify_args (Fcopy_sequence (specs))),
 		   Vcommand_history);
@@ -251,13 +251,13 @@
       if (*string == '*')
 	{
 	  string++;
-	  if (!NULL (current_buffer->read_only))
+	  if (!NILP (current_buffer->read_only))
 	    Fbarf_if_buffer_read_only ();
 	}
       else if (*string == '@')
 	{
 	  string++;
-	  if (!NULL (Vmouse_window))
+	  if (!NILP (Vmouse_window))
 	    Fselect_window (Vmouse_window);
 	}
       else break;
@@ -379,7 +379,7 @@
 
 	case 'K':		/* Mouse click.  */
 	  args[i] = last_command_char;
-	  if (NULL (Fmouse_click_p (args[i])))
+	  if (NILP (Fmouse_click_p (args[i])))
 	    error ("%s must be bound to a mouse click.",
 		   (XTYPE (function) == Lisp_Symbol
 		    ? (char *) XSYMBOL (function)->name->data
@@ -394,7 +394,7 @@
 	  break;
 
 	case 'N':		/* Prefix arg, else number from minibuffer */
-	  if (!NULL (prefix_arg))
+	  if (!NILP (prefix_arg))
 	    goto have_prefix_arg;
 	case 'n':		/* Read number from minibuffer.  */
 	  do
@@ -470,7 +470,7 @@
       if (varies[i] == 0)
 	arg_from_tty = 1;
 
-      if (NULL (visargs[i]) && XTYPE (args[i]) == Lisp_String)
+      if (NILP (visargs[i]) && XTYPE (args[i]) == Lisp_String)
 	visargs[i] = args[i];
 
       tem = (unsigned char *) index (tem, '\n');
@@ -482,7 +482,7 @@
 
   args[0] = function;
 
-  if (arg_from_tty || !NULL (record))
+  if (arg_from_tty || !NILP (record))
     {
       visargs[0] = function;
       for (i = 1; i < count + 1; i++)
@@ -519,7 +519,7 @@
      may use XSETINT.  */
   XFASTINT (val) = 0;
 
-  if (NULL (raw))
+  if (NILP (raw))
     XFASTINT (val) = 1;
   else if (XTYPE (raw) == Lisp_Symbol)
     XSETINT (val, -1);
--- a/src/cmds.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/cmds.c	Mon Jan 13 21:48:08 1992 +0000
@@ -33,7 +33,7 @@
   (n)
      Lisp_Object n;
 {
-  if (NULL (n))
+  if (NILP (n))
     XFASTINT (n) = 1;
   else
     CHECK_NUMBER (n, 0);
@@ -58,7 +58,7 @@
   (n)
      Lisp_Object n;
 {
-  if (NULL (n))
+  if (NILP (n))
     XFASTINT (n) = 1;
   else
     CHECK_NUMBER (n, 0);
@@ -82,7 +82,7 @@
   int pos;
   int count, shortage, negp;
 
-  if (NULL (n))
+  if (NILP (n))
     count = 1;
   else
     {
@@ -109,7 +109,7 @@
   (n)
      Lisp_Object n;
 {
-  if (NULL (n))
+  if (NILP (n))
     XFASTINT (n) = 1;
   else
     CHECK_NUMBER (n, 0);
@@ -129,7 +129,7 @@
   register int pos;
   register int stop;
 
-  if (NULL (n))
+  if (NILP (n))
     XFASTINT (n) = 1;
   else
     CHECK_NUMBER (n, 0);
@@ -155,7 +155,7 @@
 {
   CHECK_NUMBER (n, 0);
 
-  if (NULL (killflag))
+  if (NILP (killflag))
     {
       if (XINT (n) < 0)
 	{
@@ -225,7 +225,7 @@
 
   arg = Fprefix_numeric_value (arg1);
 
-  if (!NULL (current_buffer->read_only))
+  if (!NILP (current_buffer->read_only))
     Fsignal (Qbuffer_read_only, Qnil);
 
   /* Inserting a newline at the end of a line
@@ -245,7 +245,7 @@
       if (flag)
 	insert (&c1, 1);
       else
-	internal_self_insert ('\n', !NULL (arg1));
+	internal_self_insert ('\n', !NILP (arg1));
       XFASTINT (arg)--;		/* Ok since old and new vals both nonneg */
     }
 
@@ -265,10 +265,10 @@
   register enum syntaxcode synt;
   register int c = c1;
 
-  if (!NULL (Vbefore_change_function) || !NULL (Vafter_change_function))
+  if (!NILP (Vbefore_change_function) || !NILP (Vafter_change_function))
     hairy = 1;
 
-  if (!NULL (current_buffer->overwrite_mode)
+  if (!NILP (current_buffer->overwrite_mode)
       && point < ZV
       && c != '\n' && FETCH_CHAR (point) != '\n'
       && (FETCH_CHAR (point) != '\t'
@@ -278,18 +278,18 @@
       del_range (point, point + 1);
       hairy = 1;
     }
-  if (!NULL (current_buffer->abbrev_mode)
+  if (!NILP (current_buffer->abbrev_mode)
       && SYNTAX (c) != Sword
-      && NULL (current_buffer->read_only)
+      && NILP (current_buffer->read_only)
       && point > BEGV && SYNTAX (FETCH_CHAR (point - 1)) == Sword)
     {
       tem = Fexpand_abbrev ();
-      if (!NULL (tem))
+      if (!NILP (tem))
 	hairy = 1;
     }
   if ((c == ' ' || c == '\n')
       && !noautofill
-      && !NULL (current_buffer->auto_fill_function)
+      && !NILP (current_buffer->auto_fill_function)
       && current_column () > XFASTINT (current_buffer->fill_column))
     {
       if (c1 != '\n')
@@ -303,7 +303,7 @@
     insert (&c1, 1);
   synt = SYNTAX (c);
   if ((synt == Sclose || synt == Smath)
-      && !NULL (Vblink_paren_function) && INTERACTIVE)
+      && !NILP (Vblink_paren_function) && INTERACTIVE)
     {
       call0 (Vblink_paren_function);
       hairy = 1;
--- a/src/commands.h	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/commands.h	Mon Jan 13 21:48:08 1992 +0000
@@ -58,7 +58,7 @@
 
 /* Nonzero if input is coming from the keyboard */
 
-#define INTERACTIVE (NULL (Vexecuting_macro) && !noninteractive)
+#define INTERACTIVE (NILP (Vexecuting_macro) && !noninteractive)
 
 /* Set this nonzero to force reconsideration of mode line. */
 
--- a/src/dired.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/dired.c	Mon Jan 13 21:48:08 1992 +0000
@@ -46,8 +46,6 @@
 
 #endif
 
-#undef NULL
-
 #include "lisp.h"
 #include "buffer.h"
 #include "commands.h"
@@ -81,7 +79,7 @@
   int length;
   Lisp_Object list, name;
 
-  if (!NULL (match))
+  if (!NILP (match))
     {
       CHECK_STRING (match, 3);
       /* Compile it now so we don't get an error after opendir */
@@ -110,10 +108,10 @@
       len = NAMLEN (dp);
       if (dp->d_ino)
 	{
-	  if (NULL (match)
+	  if (NILP (match)
 	      || (0 <= re_search (&searchbuf, dp->d_name, len, 0, len, 0)))
 	    {
-	      if (!NULL (full))
+	      if (!NILP (full))
 		{
 		  int index = XSTRING (dirname)->size;
 		  int total = len + index;
@@ -140,7 +138,7 @@
 	}
     }
   closedir (d);
-  if (!NULL (nosort))
+  if (!NILP (nosort))
     return list;
   return Fsort (Fnreverse (list), Qstring_lessp);
 }
@@ -233,7 +231,7 @@
      ** It would not actually be helpful to the user to ignore any possible
      completions when making a list of them.**  */
 
-  for (passcount = !!all_flag; NULL (bestmatch) && passcount < 2; passcount++)
+  for (passcount = !!all_flag; NILP (bestmatch) && passcount < 2; passcount++)
     {
       if (!(d = opendir (XSTRING (Fdirectory_file_name (dirname))->data)))
 	report_file_error ("Opening directory", Fcons (dirname, Qnil));
@@ -254,7 +252,7 @@
 
 	  len = NAMLEN (dp);
 
-	  if (!NULL (Vquit_flag) && NULL (Vinhibit_quit))
+	  if (!NILP (Vquit_flag) && NILP (Vinhibit_quit))
 	    goto quit;
 	  if (!dp->d_ino
 	      || len < XSTRING (file)->size
@@ -297,7 +295,7 @@
 
 	      matchcount++;
 
-	      if (all_flag || NULL (bestmatch))
+	      if (all_flag || NILP (bestmatch))
 		{
 		  /* This is a possible completion */
 		  if (directoryp)
@@ -341,7 +339,7 @@
 
   unbind_to (count, Qnil);
 
-  if (all_flag || NULL (bestmatch))
+  if (all_flag || NILP (bestmatch))
     return bestmatch;
   if (matchcount == 1 && bestmatchsize == XSTRING (file)->size)
     return Qt;
--- a/src/dispextern.h	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/dispextern.h	Mon Jan 13 21:48:08 1992 +0000
@@ -48,22 +48,27 @@
     int height;
     int width;
 
-    int *used;			/* Vector of widths (in chars) of lines. */
-    /* Vector of line contents.
-       m->glyphs[V][H] is the glyph at position V, H.
-       Note that ->glyphs[...][screen_width] is always 0
-       and so is ->glyphs[...][-1].  */
+    /* Contents of the screen.
+       glyphs[V][H] is the glyph at position V, H.
+       Note that glyphs[V][-1],
+                 glyphs[V][used[V]],
+	     and glyphs[V][screen_width] are always '\0'.  */
     GLYPH **glyphs;
     /* long vector from which the strings in `glyphs' are taken.  */
     GLYPH *total_contents;
 
+    /* When representing a desired screen,
+         enable[n] == 0 means that line n is same as current screen.
+       When representing current screen contents,
+         enable[n] == 0 means that line n is blank.  */
+    char *enable;
+
+    /* Everything on line n after column used[n] is considered blank.  */
+    int *used;
+
     /* highlight[n] != 0 iff line n is highlighted.  */
     char *highlight;
 
-    /* When representing a desired screen, enable[n] == 0 implies line
-       n is same as current screen.  When representing current screen
-       contents, enable[n] == 0 implies line n is blank.  */
-    char *enable;
 
     /* Buffer offset of this line's first char. */
     int   *bufp;
--- a/src/doc.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/doc.c	Mon Jan 13 21:48:08 1992 +0000
@@ -31,7 +31,6 @@
 #define O_RDONLY 0
 #endif
 
-#undef NULL
 #include "lisp.h"
 #include "buffer.h"
 
@@ -348,7 +347,7 @@
   int length;
   struct gcpro gcpro1;
 
-  if (NULL (str))
+  if (NILP (str))
     return Qnil;
 
   CHECK_STRING (str, 0);
@@ -388,7 +387,7 @@
 	  tem = Fintern (make_string (start, length), Qnil);
 	  tem = Fwhere_is_internal (tem, keymap, Qnil, Qt, Qnil);
 
-	  if (NULL (tem))	/* but not on any keys */
+	  if (NILP (tem))	/* but not on any keys */
 	    {
 	      new = (unsigned char *) xrealloc (buf, bsize += 4);
 	      bufp += new - buf;
@@ -429,10 +428,10 @@
 	     in case it is a local variable.  */
 	  name = Fintern (make_string (start, length), Qnil);
 	  tem = Fboundp (name);
-	  if (! NULL (tem))
+	  if (! NILP (tem))
 	    {
 	      tem = Fsymbol_value (name);
-	      if (! NULL (tem))
+	      if (! NILP (tem))
 		tem = get_keymap_1 (tem, 0);
 	    }
 
@@ -440,7 +439,7 @@
 	  oldbuf = current_buffer;
 	  set_buffer_internal (XBUFFER (Vprin1_to_string_buffer));
 
-	  if (NULL (tem))
+	  if (NILP (tem))
 	    {
 	      name = Fsymbol_name (name);
 	      insert_string ("\nUses keymap \"");
--- a/src/eval.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/eval.c	Mon Jan 13 21:48:08 1992 +0000
@@ -180,7 +180,7 @@
   Lisp_Object args_left;
   struct gcpro gcpro1;
 
-  if (NULL(args))
+  if (NILP(args))
     return Qnil;
 
   args_left = args;
@@ -189,11 +189,11 @@
   do
     {
       val = Feval (Fcar (args_left));
-      if (!NULL (val))
+      if (!NILP (val))
 	break;
       args_left = Fcdr (args_left);
     }
-  while (!NULL(args_left));
+  while (!NILP(args_left));
 
   UNGCPRO;
   return val;
@@ -210,7 +210,7 @@
   Lisp_Object args_left;
   struct gcpro gcpro1;
 
-  if (NULL(args))
+  if (NILP(args))
     return Qt;
 
   args_left = args;
@@ -219,11 +219,11 @@
   do
     {
       val = Feval (Fcar (args_left));
-      if (NULL (val))
+      if (NILP (val))
 	break;
       args_left = Fcdr (args_left);
     }
-  while (!NULL(args_left));
+  while (!NILP(args_left));
 
   UNGCPRO;
   return val;
@@ -244,7 +244,7 @@
   cond = Feval (Fcar (args));
   UNGCPRO;
 
-  if (!NULL (cond))
+  if (!NILP (cond))
     return Feval (Fcar (Fcdr (args)));
   return Fprogn (Fcdr (Fcdr (args)));
 }
@@ -266,11 +266,11 @@
 
   val = Qnil;
   GCPRO1 (args);
-  while (!NULL (args))
+  while (!NILP (args))
     {
       clause = Fcar (args);
       val = Feval (Fcar (clause));
-      if (!NULL (val))
+      if (!NILP (val))
 	{
 	  if (!EQ (XCONS (clause)->cdr, Qnil))
 	    val = Fprogn (XCONS (clause)->cdr);
@@ -297,14 +297,14 @@
   if (!EQ (Vmocklisp_arguments, Qt))
     {
       val = make_number (0);
-      while (!NULL (args) && (tem = Fcar (args), XTYPE (tem) == Lisp_Symbol))
+      while (!NILP (args) && (tem = Fcar (args), XTYPE (tem) == Lisp_Symbol))
 	{
 	  QUIT;
 	  specbind (tem, val), args = Fcdr (args);
 	}
     }
 
-  if (NULL(args))
+  if (NILP(args))
     return Qnil;
 
   args_left = args;
@@ -315,7 +315,7 @@
       val = Feval (Fcar (args_left));
       args_left = Fcdr (args_left);
     }
-  while (!NULL(args_left));
+  while (!NILP(args_left));
 
   UNGCPRO;
   return val;
@@ -333,7 +333,7 @@
   struct gcpro gcpro1, gcpro2;
   register int argnum = 0;
 
-  if (NULL(args))
+  if (NILP(args))
     return Qnil;
 
   args_left = args;
@@ -348,7 +348,7 @@
 	Feval (Fcar (args_left));
       args_left = Fcdr (args_left);
     }
-  while (!NULL(args_left));
+  while (!NILP(args_left));
 
   UNGCPRO;
   return val;
@@ -368,7 +368,7 @@
 
   val = Qnil;
 
-  if (NULL(args))
+  if (NILP(args))
     return Qnil;
 
   args_left = args;
@@ -383,7 +383,7 @@
 	Feval (Fcar (args_left));
       args_left = Fcdr (args_left);
     }
-  while (!NULL(args_left));
+  while (!NILP(args_left));
 
   UNGCPRO;
   return val;
@@ -400,7 +400,7 @@
   register Lisp_Object val, sym;
   struct gcpro gcpro1;
 
-  if (NULL(args))
+  if (NILP(args))
     return Qnil;
 
   args_left = args;
@@ -413,7 +413,7 @@
       Fset (sym, val);
       args_left = Fcdr (Fcdr (args_left));
     }
-  while (!NULL(args_left));
+  while (!NILP(args_left));
 
   UNGCPRO;
   return val;
@@ -491,7 +491,7 @@
 
   fn_name = Fcar (args);
   defn = Fcons (Qlambda, Fcdr (args));
-  if (!NULL (Vpurify_flag))
+  if (!NILP (Vpurify_flag))
     defn = Fpurecopy (defn);
   Ffset (fn_name, defn);
   return fn_name;
@@ -512,7 +512,7 @@
 
   fn_name = Fcar (args);
   defn = Fcons (Qmacro, Fcons (Qlambda, Fcdr (args)));
-  if (!NULL (Vpurify_flag))
+  if (!NILP (Vpurify_flag))
     defn = Fpurecopy (defn);
   Ffset (fn_name, defn);
   return fn_name;
@@ -536,16 +536,16 @@
 
   sym = Fcar (args);
   tem = Fcdr (args);
-  if (!NULL (tem))
+  if (!NILP (tem))
     {
       tem = Fdefault_boundp (sym);
-      if (NULL (tem))
+      if (NILP (tem))
 	Fset_default (sym, Feval (Fcar (Fcdr (args))));
     }
   tem = Fcar (Fcdr (Fcdr (args)));
-  if (!NULL (tem))
+  if (!NILP (tem))
     {
-      if (!NULL (Vpurify_flag))
+      if (!NILP (Vpurify_flag))
 	tem = Fpurecopy (tem);
       Fput (sym, Qvariable_documentation, tem);
     }
@@ -573,9 +573,9 @@
   sym = Fcar (args);
   Fset_default (sym, Feval (Fcar (Fcdr (args))));
   tem = Fcar (Fcdr (Fcdr (args)));
-  if (!NULL (tem))
+  if (!NILP (tem))
     {
-      if (!NULL (Vpurify_flag))
+      if (!NILP (Vpurify_flag))
 	tem = Fpurecopy (tem);
       Fput (sym, Qvariable_documentation, tem);
     }
@@ -617,7 +617,7 @@
   GCPRO3 (args, elt, varlist);
 
   varlist = Fcar (args);
-  while (!NULL (varlist))
+  while (!NILP (varlist))
     {
       QUIT;
       elt = Fcar (varlist);
@@ -661,7 +661,7 @@
   GCPRO2 (args, *temps);
   gcpro2.nvars = 0;
 
-  for (argnum = 0; !NULL (varlist); varlist = Fcdr (varlist))
+  for (argnum = 0; !NILP (varlist); varlist = Fcdr (varlist))
     {
       QUIT;
       elt = Fcar (varlist);
@@ -674,7 +674,7 @@
   UNGCPRO;
 
   varlist = Fcar (args);
-  for (argnum = 0; !NULL (varlist); varlist = Fcdr (varlist))
+  for (argnum = 0; !NILP (varlist); varlist = Fcdr (varlist))
     {
       elt = Fcar (varlist);
       tem = temps[argnum++];
@@ -702,7 +702,7 @@
 
   test = Fcar (args);
   body = Fcdr (args);
-  while (tem = Feval (test), !NULL (tem))
+  while (tem = Feval (test), !NILP (tem))
     {
       QUIT;
       Fprogn (body);
@@ -747,7 +747,7 @@
 	{
 	  QUIT;
 	  tem = Fassq (sym, env);
-	  if (NULL (tem))
+	  if (NILP (tem))
 	    {
 	      def = XSYMBOL (sym)->function;
 	      if (XTYPE (def) == Lisp_Symbol && !EQ (def, Qunbound))
@@ -770,7 +770,7 @@
 	}
       /* Right now TEM is the result from SYM in ENV,
 	 and if TEM is nil then DEF is SYM's function definition.  */
-      if (NULL (tem))
+      if (NILP (tem))
 	{
 	  /* SYM is not mentioned in ENV.
 	     Look at its function definition.  */
@@ -782,7 +782,7 @@
 	    {
 	      /* Autoloading function: will it be a macro when loaded?  */
 	      tem = Fcar (Fnthcdr (make_number (4), def));
-	      if (NULL (tem))
+	      if (NILP (tem))
 		break;
 	      /* Yes, load it and try again.  */
 	      do_autoload (def, sym);
@@ -795,7 +795,7 @@
       else
 	{
 	  expander = XCONS (tem)->cdr;
-	  if (NULL (expander))
+	  if (NILP (expander))
 	    break;
 	}
     explicit:
@@ -897,7 +897,7 @@
 
   while (1)
     {
-      if (!NULL (tag))
+      if (!NILP (tag))
 	for (c = catchlist; c; c = c->next)
 	  {
 	    if (EQ (c->tag, tag))
@@ -980,7 +980,7 @@
   c.gcpro = gcprolist;
   if (_setjmp (c.jmp))
     {
-      if (!NULL (h.var))
+      if (!NILP (h.var))
         specbind (h.var, Fcdr (c.val));
       val = Fprogn (Fcdr (Fcar (c.val)));
       unbind_to (c.pdlcount, Qnil);
@@ -991,10 +991,10 @@
   h.var = Fcar (args);
   h.handler = Fcdr (Fcdr (args));
   
-  for (val = h.handler; ! NULL (val); val = Fcdr (val))
+  for (val = h.handler; ! NILP (val); val = Fcdr (val))
     {
       tem = Fcar (val);
-      if ((!NULL (tem)) &&
+      if ((!NILP (tem)) &&
 	  (!CONSP (tem) || (XTYPE (XCONS (tem)->car) != Lisp_Symbol)))
 	error ("Invalid condition handler", tem);
     }
@@ -1095,7 +1095,7 @@
 	error ("Returning a value from an error is no longer supported");
 #endif
 
-      if (!NULL (clause))
+      if (!NILP (clause))
 	{
 	  struct handler *h = handlerlist;
 	  /* Restore the polling-suppression count.  */
@@ -1155,7 +1155,7 @@
       if (!CONSP (tem1))
 	continue;
       tem = Fmemq (Fcar (tem1), conditions);
-      if (!NULL (tem))
+      if (!NILP (tem))
         return tem1;
     }
   return Qnil;
@@ -1202,7 +1202,7 @@
     {
       if (++i > 10) return Qnil;
       tem = Ffboundp (fun);
-      if (NULL (tem)) return Qnil;
+      if (NILP (tem)) return Qnil;
       fun = Fsymbol_function (fun);
     }
 
@@ -1353,7 +1353,7 @@
       if (EQ (Vmocklisp_arguments, Qt))
         return Fsymbol_value (form);
       val = Fsymbol_value (form);
-      if (NULL (val))
+      if (NILP (val))
 	XFASTINT (val) = 0;
       else if (EQ (val, Qt))
 	XFASTINT (val) = 1;
@@ -1438,7 +1438,7 @@
 	  gcpro3.var = vals;
 	  gcpro3.nvars = 0;
 
-	  while (!NULL (args_left))
+	  while (!NILP (args_left))
 	    {
 	      vals[argnum++] = Feval (Fcar (args_left));
 	      args_left = Fcdr (args_left);
@@ -1528,7 +1528,7 @@
  done:
   if (!EQ (Vmocklisp_arguments, Qt))
     {
-      if (NULL (val))
+      if (NILP (val))
 	XFASTINT (val) = 0;
       else if (EQ (val, Qt))
 	XFASTINT (val) = 1;
@@ -1614,7 +1614,7 @@
   /* Spread the last arg we got.  Its first element goes in
      the slot that it used to occupy, hence this value of I.  */
   i = nargs - 1;
-  while (!NULL (spread_arg))
+  while (!NILP (spread_arg))
     {
       funcall_args [i++] = XCONS (spread_arg)->car;
       spread_arg = XCONS (spread_arg)->cdr;
@@ -1631,7 +1631,7 @@
   struct gcpro gcpro1;
 
   GCPRO1 (fn);
-  if (NULL (arg))
+  if (NILP (arg))
     RETURN_UNGCPRO (Ffuncall (1, &fn));
   gcpro1.nvars = 2;
 #ifdef NO_ARG_ARRAY
@@ -1942,7 +1942,7 @@
   else abort ();
 
   i = 0;
-  for (; !NULL (syms_left); syms_left = Fcdr (syms_left))
+  for (; !NILP (syms_left); syms_left = Fcdr (syms_left))
     {
       QUIT;
       next = Fcar (syms_left);
@@ -2042,7 +2042,7 @@
      int count;
      Lisp_Object value;
 {
-  int quitf = !NULL (Vquit_flag);
+  int quitf = !NILP (Vquit_flag);
   struct gcpro gcpro1;
 
   GCPRO1 (value);
@@ -2056,12 +2056,12 @@
 	(*specpdl_ptr->func) (specpdl_ptr->old_value);
       /* Note that a "binding" of nil is really an unwind protect,
 	so in that case the "old value" is a list of forms to evaluate.  */
-      else if (NULL (specpdl_ptr->symbol))
+      else if (NILP (specpdl_ptr->symbol))
 	Fprogn (specpdl_ptr->old_value);
       else
         Fset (specpdl_ptr->symbol, specpdl_ptr->old_value);
     }
-  if (NULL (Vquit_flag) && quitf) Vquit_flag = Qt;
+  if (NILP (Vquit_flag) && quitf) Vquit_flag = Qt;
 
   UNGCPRO;
 
@@ -2125,7 +2125,7 @@
     }
 
   if (backlist)
-    backlist->debug_on_exit = !NULL (flag);
+    backlist->debug_on_exit = !NILP (flag);
 
   return flag;
 }
@@ -2164,7 +2164,7 @@
 	  if (backlist->nargs == MANY)
 	    {
 	      for (tail = *backlist->args, i = 0;
-		   !NULL (tail);
+		   !NILP (tail);
 		   tail = Fcdr (tail), i++)
 		{
 		  if (i) write_string (" ", -1);
--- a/src/fileio.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/fileio.c	Mon Jan 13 21:48:08 1992 +0000
@@ -52,9 +52,6 @@
 #include <sys/time.h>
 #endif
 
-#ifdef NULL
-#undef NULL
-#endif
 #include "config.h"
 #include "lisp.h"
 #include "buffer.h"
@@ -269,7 +266,7 @@
   char *buf;
 
   CHECK_STRING (file, 0);
-  if (NULL (file))
+  if (NILP (file))
     return Qnil;
   buf = (char *) alloca (XSTRING (file)->size + 10);
   return build_string (file_name_as_directory (buf, XSTRING (file)->data));
@@ -435,7 +432,7 @@
 
   CHECK_STRING (directory, 0);
 
-  if (NULL (directory))
+  if (NILP (directory))
     return Qnil;
 #ifdef VMS
   /* 20 extra chars is insufficient for VMS, since we might perform a
@@ -658,7 +655,7 @@
 #endif /* not VMS */
       && !newdir)
     {
-      if (NULL (defalt))
+      if (NILP (defalt))
 	defalt = current_buffer->directory;
       CHECK_STRING (defalt, 1);
       newdir = XSTRING (defalt)->data;
@@ -994,7 +991,7 @@
 #endif /* not VMS */
       && !newdir)
     {
-      if (NULL (defalt))
+      if (NILP (defalt))
 	defalt = current_buffer->directory;
       CHECK_STRING (defalt, 1);
       newdir = XSTRING (defalt)->data;
@@ -1354,7 +1351,7 @@
       tem = do_yes_or_no_p (format1 ("File %s already exists; %s anyway? ",
 				     XSTRING (absname)->data, querystring));
       UNGCPRO;
-      if (NULL (tem))
+      if (NILP (tem))
 	Fsignal (Qfile_already_exists,
 		 Fcons (build_string ("File already exists"),
 			Fcons (absname, Qnil)));
@@ -1385,7 +1382,7 @@
   CHECK_STRING (newname, 1);
   filename = Fexpand_file_name (filename, Qnil);
   newname = Fexpand_file_name (newname, Qnil);
-  if (NULL (ok_if_already_exists)
+  if (NILP (ok_if_already_exists)
       || XTYPE (ok_if_already_exists) == Lisp_Int)
     barf_or_query_if_file_exists (newname, "copy to it",
 				  XTYPE (ok_if_already_exists) == Lisp_Int);
@@ -1417,7 +1414,7 @@
   if (fstat (ifd, &st) >= 0)
     {
 #ifdef HAVE_TIMEVAL
-      if (!NULL (keep_date))
+      if (!NILP (keep_date))
 	{
 #ifdef USE_UTIME
 /* AIX has utimes() in compatibility package, but it dies.  So use good old
@@ -1521,7 +1518,7 @@
   CHECK_STRING (newname, 1);
   filename = Fexpand_file_name (filename, Qnil);
   newname = Fexpand_file_name (newname, Qnil);
-  if (NULL (ok_if_already_exists)
+  if (NILP (ok_if_already_exists)
       || XTYPE (ok_if_already_exists) == Lisp_Int)
     barf_or_query_if_file_exists (newname, "rename to it",
 				  XTYPE (ok_if_already_exists) == Lisp_Int);
@@ -1572,7 +1569,7 @@
   CHECK_STRING (newname, 1);
   filename = Fexpand_file_name (filename, Qnil);
   newname = Fexpand_file_name (newname, Qnil);
-  if (NULL (ok_if_already_exists)
+  if (NILP (ok_if_already_exists)
       || XTYPE (ok_if_already_exists) == Lisp_Int)
     barf_or_query_if_file_exists (newname, "make it a new name",
 				  XTYPE (ok_if_already_exists) == Lisp_Int);
@@ -1615,7 +1612,7 @@
   filename = Fexpand_file_name (filename, Qnil);
 #endif
   newname = Fexpand_file_name (newname, Qnil);
-  if (NULL (ok_if_already_exists)
+  if (NILP (ok_if_already_exists)
       || XTYPE (ok_if_already_exists) == Lisp_Int)
     barf_or_query_if_file_exists (newname, "make it a link",
 				  XTYPE (ok_if_already_exists) == Lisp_Int);
@@ -1653,7 +1650,7 @@
      Lisp_Object string;
 {
   CHECK_STRING (varname, 0);
-  if (NULL (string))
+  if (NILP (string))
     delete_logical_name (XSTRING (varname)->data);
   else
     {
@@ -1809,10 +1806,10 @@
     return (access (XSTRING (abspath)->data, 2) >= 0) ? Qt : Qnil;
   dir = Ffile_name_directory (abspath);
 #ifdef VMS
-  if (!NULL (dir))
+  if (!NILP (dir))
     dir = Fdirectory_file_name (dir);
 #endif /* VMS */
-  return (access (!NULL (dir) ? (char *) XSTRING (dir)->data : "", 2) >= 0
+  return (access (!NILP (dir) ? (char *) XSTRING (dir)->data : "", 2) >= 0
 	  ? Qt : Qnil);
 }
 
@@ -1947,7 +1944,7 @@
   struct gcpro gcpro1;
   
   GCPRO1 (filename);
-  if (!NULL (current_buffer->read_only))
+  if (!NILP (current_buffer->read_only))
     Fbarf_if_buffer_read_only();
 
   CHECK_STRING (filename, 0);
@@ -1964,7 +1961,7 @@
 #endif /* not APOLLO */
     {
       if (fd >= 0) close (fd);
-      if (NULL (visit))
+      if (NILP (visit))
 	report_file_error ("Opening input file", Fcons (filename, Qnil));
       st.st_mtime = -1;
       how_much = 0;
@@ -1985,7 +1982,7 @@
       error ("maximum buffer size exceeded");
   }
 
-  if (NULL (visit))
+  if (NILP (visit))
     prepare_to_modify_buffer (point, point);
 
   move_gap (point);
@@ -2025,7 +2022,7 @@
 
  notfound:
 
-  if (!NULL (visit))
+  if (!NILP (visit))
     {
       current_buffer->undo_list = Qnil;
 #ifdef APOLLO
@@ -2036,7 +2033,7 @@
       current_buffer->auto_save_modified = MODIFF;
       XFASTINT (current_buffer->save_length) = Z - BEG;
 #ifdef CLASH_DETECTION
-      if (!NULL (current_buffer->filename))
+      if (!NILP (current_buffer->filename))
 	unlock_file (current_buffer->filename);
       unlock_file (filename);
 #endif /* CLASH_DETECTION */
@@ -2082,7 +2079,7 @@
 #endif /* VMS */
 
   /* Special kludge to simplify auto-saving */
-  if (NULL (start))
+  if (NILP (start))
     {
       XFASTINT (start) = BEG;
       XFASTINT (end) = Z;
@@ -2099,7 +2096,7 @@
 #endif /* CLASH_DETECTION */
 
   desc = -1;
-  if (!NULL (append))
+  if (!NILP (append))
     desc = open (fn, O_WRONLY);
 
   if (desc < 0)
@@ -2118,7 +2115,7 @@
 	Lisp_Object temp_name;
 	temp_name = Ffile_name_directory (filename);
 
-	if (!NULL (temp_name))
+	if (!NILP (temp_name))
 	  {
 	    temp_name = Fmake_temp_name (concat2 (temp_name,
 						  build_string ("$$SAVE$$")));
@@ -2164,7 +2161,7 @@
 
   record_unwind_protect (close_file_unwind, make_number (desc));
 
-  if (!NULL (append))
+  if (!NILP (append))
     if (lseek (desc, 0, 2) < 0)
       {
 #ifdef CLASH_DETECTION
@@ -2297,7 +2294,7 @@
       XFASTINT (current_buffer->save_length) = Z - BEG;
       current_buffer->filename = filename;
     }
-  else if (!NULL (visit))
+  else if (!NILP (visit))
     return Qnil;
 
   if (!auto_saving)
@@ -2463,7 +2460,7 @@
 
   /* Vrun_hooks is nil before emacs is dumped, and inc-vers.el will
      eventually call do-auto-save, so don't err here in that case. */
-  if (!NULL (Vrun_hooks))
+  if (!NILP (Vrun_hooks))
     call1 (Vrun_hooks, intern ("auto-save-hook"));
 
   for (tail = Vbuffer_alist; XGCTYPE (tail) == Lisp_Cons;
@@ -2497,7 +2494,7 @@
 	      continue;
 	    }
 	  set_buffer_internal (b);
-	  if (!auto_saved && NULL (nomsg))
+	  if (!auto_saved && NILP (nomsg))
 	    message1 ("Auto-saving...");
 	  internal_condition_case (auto_save_1, Qt, auto_save_error);
 	  auto_saved++;
@@ -2510,7 +2507,7 @@
   if (auto_saved)
     record_auto_save ();
 
-  if (auto_saved && NULL (nomsg))
+  if (auto_saved && NILP (nomsg))
     message1 (omessage ? omessage : "Auto-saving...done");
 
   auto_saving = 0;
@@ -2563,24 +2560,24 @@
       string = Fsubstitute_in_file_name (string);
       name = Ffile_name_nondirectory (string);
       realdir = Ffile_name_directory (string);
-      if (NULL (realdir))
+      if (NILP (realdir))
 	realdir = dir;
       else
 	realdir = Fexpand_file_name (realdir, dir);
     }
 
-  if (NULL (action))
+  if (NILP (action))
     {
       specdir = Ffile_name_directory (string);
       val = Ffile_name_completion (name, realdir);
       if (XTYPE (val) != Lisp_String)
 	{
-	  if (NULL (Fstring_equal (string, orig_string)))
+	  if (NILP (Fstring_equal (string, orig_string)))
 	    return string;
 	  return (val);
 	}
 
-      if (!NULL (specdir))
+      if (!NILP (specdir))
 	val = concat2 (specdir, val);
 #ifndef VMS
       {
@@ -2641,9 +2638,9 @@
   register char *homedir;
   int count;
 
-  if (NULL (dir))
+  if (NILP (dir))
     dir = current_buffer->directory;
-  if (NULL (defalt))
+  if (NILP (defalt))
     defalt = current_buffer->filename;
 
   /* If dir starts with user's homedir, change that to ~. */
@@ -2661,7 +2658,7 @@
   if (insert_default_directory)
     {
       insdef = dir;
-      if (!NULL (initial))
+      if (!NILP (initial))
 	{
 	  Lisp_Object args[2];
 
@@ -2694,10 +2691,10 @@
 #endif
 
   UNGCPRO;
-  if (NULL (val))
+  if (NILP (val))
     error ("No file name specified");
   tem = Fstring_equal (val, insdef);
-  if (!NULL (tem) && !NULL (defalt))
+  if (!NILP (tem) && !NILP (defalt))
     return defalt;
   return Fsubstitute_in_file_name (val);
 }
@@ -2720,9 +2717,9 @@
   register char *homedir;
   int count;
 
-  if (NULL (dir))
+  if (NILP (dir))
     dir = current_buffer->directory;
-  if (NULL (defalt))
+  if (NILP (defalt))
     defalt = current_buffer->filename;
 
   /* If dir starts with user's homedir, change that to ~. */
@@ -2737,7 +2734,7 @@
       XSTRING (dir)->data[0] = '~';
     }
 
-  if (!NULL (initial))
+  if (!NILP (initial))
     insdef = initial;
   else if (insert_default_directory)
     insdef = dir;
@@ -2759,10 +2756,10 @@
 #endif
 
   UNGCPRO;
-  if (NULL (val))
+  if (NILP (val))
     error ("No file name specified");
   tem = Fstring_equal (val, insdef);
-  if (!NULL (tem) && !NULL (defalt))
+  if (!NILP (tem) && !NILP (defalt))
     return defalt;
   return Fsubstitute_in_file_name (val);
 }
--- a/src/filelock.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/filelock.c	Mon Jan 13 21:48:08 1992 +0000
@@ -33,7 +33,6 @@
 #include <fcntl.h>
 #endif /* USG */
 
-#undef NULL
 #include "lisp.h"
 #include "paths.h"
 #include "buffer.h"
@@ -98,9 +97,9 @@
   /* See if this file is visited and has changed on disk since it was visited.  */
   {
     register Lisp_Object subject_buf = Fget_file_buffer (fn);
-    if (!NULL (subject_buf)
-	&& NULL (Fverify_visited_file_modtime (subject_buf))
-	&& !NULL (Ffile_exists_p (fn)))
+    if (!NILP (subject_buf)
+	&& NILP (Fverify_visited_file_modtime (subject_buf))
+	&& !NILP (Ffile_exists_p (fn)))
       call1 (intern ("ask-user-about-supersession-threat"), fn);
   }
 
@@ -112,7 +111,7 @@
   /* Else consider breaking the lock */
   attack = call2 (intern ("ask-user-about-lock"), fn,
 		  lock_file_owner_name (lfname));
-  if (!NULL (attack))
+  if (!NILP (attack))
     /* User says take the lock */
     {
       lock_superlock (lfname);
@@ -298,12 +297,12 @@
   (fn)
      Lisp_Object fn;
 {
-  if (NULL (fn))
+  if (NILP (fn))
     fn = current_buffer->filename;
   else
     CHECK_STRING (fn, 0);
   if (current_buffer->save_modified < MODIFF
-      && !NULL (fn))
+      && !NILP (fn))
     lock_file (fn);
   return Qnil;    
 }
--- a/src/floatfns.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/floatfns.c	Mon Jan 13 21:48:08 1992 +0000
@@ -26,7 +26,23 @@
 Lisp_Object Qarith_error;
 
 #ifdef LISP_FLOAT_TYPE
+
 #include <math.h>
+#include <errno.h>
+
+extern int errno;
+
+/* Avoid traps on VMS from sinh and cosh.
+   All the other functions set errno instead.  */
+
+#ifdef VMS
+#undef cosh
+#undef sinh
+#define cosh(x) ((exp(x)+exp(-x))*0.5)
+#define sinh(x) ((exp(x)-exp(-x))*0.5)
+#endif /* VMS */
+
+static float_error ();
 
 /* Nonzero while executing in floating point.
    This tells float_error what to do.  */
@@ -34,13 +50,19 @@
 static int in_float;
 
 /* If an argument is out of range for a mathematical function,
-   that is detected with a signal.  Here is the actual argument
-   value to use in the error message.  */
+   here is the actual argument value to use in the error message.  */
 
 static Lisp_Object float_error_arg;
 
-#define IN_FLOAT(d, num) \
-(in_float = 1, float_error_arg = num, (d), in_float = 0)
+/* Evaluate the floating point expression D, recording NUM
+   as the original argument for error messages.
+   D is normally an assignment expression.
+   Handle errors which may result in signals or may set errno.  */
+
+#define IN_FLOAT(D, NUM) \
+(in_float = 1, errno = 0, float_error_arg = NUM, (D),		\
+ (errno == ERANGE || errno == EDOM ? float_error () : 0),	\
+ in_float = 0)
 
 /* Extract a Lisp number as a `double', or signal an error.  */
 
@@ -476,7 +498,6 @@
   return num;
 }
 
-#ifdef BSD
 static
 float_error (signo)
      int signo;
@@ -484,22 +505,22 @@
   if (! in_float)
     fatal_error_signal (signo);
 
+#ifdef BSD
 #ifdef BSD4_1
   sigrelse (SIGILL);
 #else /* not BSD4_1 */
   sigsetmask (0);
 #endif /* not BSD4_1 */
+#else
+  /* Must reestablish handler each time it is called.  */
+  signal (SIGILL, float_error);
+#endif /* BSD */
 
   in_float = 0;
 
   Fsignal (Qarith_error, Fcons (float_error_arg, Qnil));
 }
 
-/* Another idea was to replace the library function `infnan'
-   where SIGILL is signaled.  */
-
-#endif /* BSD */
-
 init_floatfns ()
 {
   signal (SIGILL, float_error);
--- a/src/fns.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/fns.c	Mon Jan 13 21:48:08 1992 +0000
@@ -60,9 +60,6 @@
 #undef vector
 #define vector *****
 
-#ifdef NULL
-#undef NULL
-#endif
 #include "lisp.h"
 #include "commands.h"
 
@@ -132,7 +129,7 @@
     return Farray_length (obj);
   else if (CONSP (obj))
     {
-      for (i = 0, tail = obj; !NULL(tail); i++)
+      for (i = 0, tail = obj; !NILP(tail); i++)
 	{
 	  QUIT;
 	  tail = Fcdr (tail);
@@ -141,7 +138,7 @@
       XFASTINT (val) = i;
       return val;
     }
-  else if (NULL(obj))
+  else if (NILP(obj))
     {
       XFASTINT (val) = 0;
       return val;
@@ -263,7 +260,7 @@
   (arg)
      Lisp_Object arg;
 {
-  if (NULL (arg)) return arg;
+  if (NILP (arg)) return arg;
   if (!CONSP (arg) && XTYPE (arg) != Lisp_Vector && XTYPE (arg) != Lisp_String)
     arg = wrong_type_argument (Qsequencep, arg);
   return concat (1, &arg, CONSP (arg) ? Lisp_Cons : XTYPE (arg), 0);
@@ -298,7 +295,7 @@
   for (argnum = 0; argnum < nargs; argnum++)
     {
       this = args[argnum];
-      if (!(CONSP (this) || NULL (this)
+      if (!(CONSP (this) || NILP (this)
 	    || XTYPE (this) == Lisp_Vector || XTYPE (this) == Lisp_String
 	    || XTYPE (this) == Lisp_Compiled))
 	{
@@ -351,7 +348,7 @@
 	  register Lisp_Object elt;
 
 	  /* Fetch next element of `this' arg into `elt', or break if `this' is exhausted. */
-	  if (NULL (this)) break;
+	  if (NILP (this)) break;
 	  if (CONSP (this))
 	    elt = Fcar (this), this = Fcdr (this);
 	  else
@@ -389,7 +386,7 @@
 	    }
 	}
     }
-  if (!NULL (prev))
+  if (!NILP (prev))
     XCONS (prev)->cdr = last_tail;
 
   return val;  
@@ -408,7 +405,7 @@
   register Lisp_Object tem;
 
   CHECK_LIST (alist, 0);
-  if (NULL (alist))
+  if (NILP (alist))
     return alist;
   alist = concat (1, &alist, Lisp_Cons, 0);
   for (tem = alist; CONSP (tem); tem = XCONS (tem)->cdr)
@@ -432,7 +429,7 @@
 {
   CHECK_STRING (string, 0);
   CHECK_NUMBER (from, 1);
-  if (NULL (to))
+  if (NILP (to))
     to = Flength (string);
   else
     CHECK_NUMBER (to, 2);
@@ -458,7 +455,7 @@
   register int i, num;
   CHECK_NUMBER (n, 0);
   num = XINT (n);
-  for (i = 0; i < num && !NULL (list); i++)
+  for (i = 0; i < num && !NILP (list); i++)
     {
       QUIT;
       list = Fcdr (list);
@@ -483,7 +480,7 @@
   CHECK_NUMBER (n, 0);
   while (1)
     {
-      if (XTYPE (seq) == Lisp_Cons || NULL (seq))
+      if (XTYPE (seq) == Lisp_Cons || NILP (seq))
 	return Fcar (Fnthcdr (n, seq));
       else if (XTYPE (seq) == Lisp_String
 	       || XTYPE (seq) == Lisp_Vector)
@@ -501,11 +498,11 @@
      Lisp_Object list;
 {
   register Lisp_Object tail;
-  for (tail = list; !NULL (tail); tail = Fcdr (tail))
+  for (tail = list; !NILP (tail); tail = Fcdr (tail))
     {
       register Lisp_Object tem;
       tem = Fcar (tail);
-      if (! NULL (Fequal (elt, tem)))
+      if (! NILP (Fequal (elt, tem)))
 	return tail;
       QUIT;
     }
@@ -520,7 +517,7 @@
      Lisp_Object list;
 {
   register Lisp_Object tail;
-  for (tail = list; !NULL (tail); tail = Fcdr (tail))
+  for (tail = list; !NILP (tail); tail = Fcdr (tail))
     {
       register Lisp_Object tem;
       tem = Fcar (tail);
@@ -539,7 +536,7 @@
      Lisp_Object list;
 {
   register Lisp_Object tail;
-  for (tail = list; !NULL (tail); tail = Fcdr (tail))
+  for (tail = list; !NILP (tail); tail = Fcdr (tail))
     {
       register Lisp_Object elt, tem;
       elt = Fcar (tail);
@@ -579,13 +576,13 @@
      Lisp_Object list;
 {
   register Lisp_Object tail;
-  for (tail = list; !NULL (tail); tail = Fcdr (tail))
+  for (tail = list; !NILP (tail); tail = Fcdr (tail))
     {
       register Lisp_Object elt, tem;
       elt = Fcar (tail);
       if (!CONSP (elt)) continue;
       tem = Fequal (Fcar (elt), key);
-      if (!NULL (tem)) return elt;
+      if (!NILP (tem)) return elt;
       QUIT;
     }
   return Qnil;
@@ -599,7 +596,7 @@
      Lisp_Object list;
 {
   register Lisp_Object tail;
-  for (tail = list; !NULL (tail); tail = Fcdr (tail))
+  for (tail = list; !NILP (tail); tail = Fcdr (tail))
     {
       register Lisp_Object elt, tem;
       elt = Fcar (tail);
@@ -626,12 +623,12 @@
 
   tail = list;
   prev = Qnil;
-  while (!NULL (tail))
+  while (!NILP (tail))
     {
       tem = Fcar (tail);
       if (EQ (elt, tem))
 	{
-	  if (NULL (prev))
+	  if (NILP (prev))
 	    list = Fcdr (tail);
 	  else
 	    Fsetcdr (prev, Fcdr (tail));
@@ -659,12 +656,12 @@
 
   tail = list;
   prev = Qnil;
-  while (!NULL (tail))
+  while (!NILP (tail))
     {
       tem = Fcar (tail);
       if (Fequal (elt, tem))
 	{
-	  if (NULL (prev))
+	  if (NILP (prev))
 	    list = Fcdr (tail);
 	  else
 	    Fsetcdr (prev, Fcdr (tail));
@@ -685,10 +682,10 @@
 {
   register Lisp_Object prev, tail, next;
 
-  if (NULL (list)) return list;
+  if (NILP (list)) return list;
   prev = Qnil;
   tail = list;
-  while (!NULL (tail))
+  while (!NILP (tail))
     {
       QUIT;
       next = Fcdr (tail);
@@ -774,24 +771,24 @@
 
   while (1)
     {
-      if (NULL (l1))
+      if (NILP (l1))
 	{
 	  UNGCPRO;
-	  if (NULL (tail))
+	  if (NILP (tail))
 	    return l2;
 	  Fsetcdr (tail, l2);
 	  return value;
 	}
-      if (NULL (l2))
+      if (NILP (l2))
 	{
 	  UNGCPRO;
-	  if (NULL (tail))
+	  if (NILP (tail))
 	    return l1;
 	  Fsetcdr (tail, l1);
 	  return value;
 	}
       tem = call2 (pred, Fcar (l2), Fcar (l1));
-      if (NULL (tem))
+      if (NILP (tem))
 	{
 	  tem = l1;
 	  l1 = Fcdr (l1);
@@ -803,7 +800,7 @@
 	  l2 = Fcdr (l2);
 	  org_l2 = l2;
 	}
-      if (NULL (tail))
+      if (NILP (tail))
 	value = tem;
       else
 	Fsetcdr (tail, tem);
@@ -819,7 +816,7 @@
      register Lisp_Object prop;
 {
   register Lisp_Object tail;
-  for (tail = Fsymbol_plist (sym); !NULL (tail); tail = Fcdr (Fcdr (tail)))
+  for (tail = Fsymbol_plist (sym); !NILP (tail); tail = Fcdr (Fcdr (tail)))
     {
       register Lisp_Object tem;
       tem = Fcar (tail);
@@ -840,7 +837,7 @@
   register Lisp_Object tail, prev;
   Lisp_Object newcell;
   prev = Qnil;
-  for (tail = Fsymbol_plist (sym); !NULL (tail); tail = Fcdr (Fcdr (tail)))
+  for (tail = Fsymbol_plist (sym); !NILP (tail); tail = Fcdr (Fcdr (tail)))
     {
       register Lisp_Object tem;
       tem = Fcar (tail);
@@ -849,7 +846,7 @@
       prev = tail;
     }
   newcell = Fcons (prop, Fcons (val, Qnil));
-  if (NULL (prev))
+  if (NILP (prev))
     Fsetplist (sym, newcell);
   else
     Fsetcdr (Fcdr (prev), newcell);
@@ -883,7 +880,7 @@
     {
       Lisp_Object v1;
       v1 = Fequal (Fcar (o1), Fcar (o2), depth + 1);
-      if (NULL (v1))
+      if (NILP (v1))
 	return v1;
       o1 = Fcdr (o1), o2 = Fcdr (o2);
       goto do_cdr;
@@ -905,7 +902,7 @@
 	  v1 = XVECTOR (o1)->contents [index];
 	  v2 = XVECTOR (o2)->contents [index];
 	  v = Fequal (v1, v2, depth + 1);
-	  if (NULL (v)) return v;
+	  if (NILP (v)) return v;
 	}
       return Qt;
     }
@@ -981,9 +978,9 @@
   for (argnum = 0; argnum < nargs; argnum++)
     {
       tem = args[argnum];
-      if (NULL (tem)) continue;
+      if (NILP (tem)) continue;
 
-      if (NULL (val))
+      if (NILP (val))
 	val = tem;
 
       if (argnum + 1 == nargs) break;
@@ -1000,7 +997,7 @@
 
       tem = args[argnum + 1];
       Fsetcdr (tail, tem);
-      if (NULL (tem))
+      if (NILP (tem))
 	args[argnum + 1] = tail;
     }
 
@@ -1409,7 +1406,7 @@
   register Lisp_Object tem;
   CHECK_SYMBOL (feature, 0);
   tem = Fmemq (feature, Vfeatures);
-  return (NULL (tem)) ? Qnil : Qt;
+  return (NILP (tem)) ? Qnil : Qt;
 }
 
 DEFUN ("provide", Fprovide, Sprovide, 1, 1, 0,
@@ -1419,10 +1416,10 @@
 {
   register Lisp_Object tem;
   CHECK_SYMBOL (feature, 0);
-  if (!NULL (Vautoload_queue))
+  if (!NILP (Vautoload_queue))
     Vautoload_queue = Fcons (Fcons (Vfeatures, Qnil), Vautoload_queue);
   tem = Fmemq (feature, Vfeatures);
-  if (NULL (tem))
+  if (NILP (tem))
     Vfeatures = Fcons (feature, Vfeatures);
   return feature;
 }
@@ -1438,7 +1435,7 @@
   register Lisp_Object tem;
   CHECK_SYMBOL (feature, 0);
   tem = Fmemq (feature, Vfeatures);
-  if (NULL (tem))
+  if (NILP (tem))
     {
       int count = specpdl_ptr - specpdl;
 
@@ -1446,11 +1443,11 @@
       record_unwind_protect (un_autoload, Vautoload_queue);
       Vautoload_queue = Qt;
 
-      Fload (NULL (file_name) ? Fsymbol_name (feature) : file_name,
+      Fload (NILP (file_name) ? Fsymbol_name (feature) : file_name,
 	     Qnil, Qt, Qnil);
 
       tem = Fmemq (feature, Vfeatures);
-      if (NULL (tem))
+      if (NILP (tem))
 	error ("Required feature %s was not provided",
 	       XSYMBOL (feature)->name->data );
 
--- a/src/frame.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/frame.c	Mon Jan 13 21:48:08 1992 +0000
@@ -163,7 +163,7 @@
     {
       XWINDOW (mini_window)->buffer = Qt;
       Fset_window_buffer (mini_window,
-			  (NULL (Vminibuffer_list)
+			  (NILP (Vminibuffer_list)
 			   ? get_minibuffer (0)
 			   : Fcar (Vminibuffer_list)));
     }
@@ -190,7 +190,7 @@
   register struct screen *s;
 
   /* Choose the minibuffer window to use.  */
-  if (NULL (mini_window))
+  if (NILP (mini_window))
     {
       if (XTYPE (Vdefault_minibuffer_screen) != Lisp_Screen)
 	error ("default-minibuffer-screen must be set when creating minibufferless screens.");
@@ -207,7 +207,7 @@
   /* Install the chosen minibuffer window, with proper buffer.  */
   s->minibuffer_window = mini_window;
   Fset_window_buffer (mini_window,
-		      (NULL (Vminibuffer_list)
+		      (NILP (Vminibuffer_list)
 		       ? get_minibuffer (0)
 		       : Fcar (Vminibuffer_list)));
   return s;
@@ -246,7 +246,7 @@
   /* Put the proper buffer in that window.  */
 
   Fset_window_buffer (mini_window,
-		      (NULL (Vminibuffer_list)
+		      (NILP (Vminibuffer_list)
 		       ? get_minibuffer (0)
 		       : Fcar (Vminibuffer_list)));
   return s;
@@ -289,7 +289,7 @@
 #ifdef HAVE_X_WINDOWS
 #ifdef MULTI_SCREEN
   if (XSCREEN (screen)->output_method == output_x_window
-      && NULL (no_enter))
+      && NILP (no_enter))
     {
       Ffocus_screen (screen);
     }
@@ -323,7 +323,7 @@
   (screen)
      Lisp_Object screen;
 {
-  if (NULL (screen))
+  if (NILP (screen))
     XSET (screen, Lisp_Screen, selected_screen);
   else
     CHECK_LIVE_SCREEN (screen, 0);
@@ -337,7 +337,7 @@
   (screen)
      Lisp_Object screen;
 {
-  if (NULL (screen))
+  if (NILP (screen))
     XSET (screen, Lisp_Screen, selected_screen);
   else
     CHECK_LIVE_SCREEN (screen, 0);
@@ -381,7 +381,7 @@
 
 	    /* Decide whether this screen is eligible to be returned,
 	       according to minibuf.  */
-	    if ((NULL (minibuf) && ! SCREEN_MINIBUF_ONLY_P (XSCREEN (s)))
+	    if ((NILP (minibuf) && ! SCREEN_MINIBUF_ONLY_P (XSCREEN (s)))
 		|| XTYPE (minibuf) != Lisp_Window
 		|| EQ (SCREEN_MINIBUF_WINDOW (XSCREEN (s)), minibuf)
 		|| EQ (s, screen))
@@ -420,18 +420,18 @@
 	  if (XTYPE (scr) != Lisp_Screen)
 	    abort ();
 
-	  if (EQ (screen, scr) && !NULL (prev))
+	  if (EQ (screen, scr) && !NILP (prev))
 	    return prev;
 
 	  /* Decide whether this screen is eligible to be returned,
 	     according to minibuf.  */
-	  if ((NULL (minibuf) && ! SCREEN_MINIBUF_ONLY_P (XSCREEN (scr)))
+	  if ((NILP (minibuf) && ! SCREEN_MINIBUF_ONLY_P (XSCREEN (scr)))
 	      || XTYPE (minibuf) != Lisp_Window
 	      || EQ (SCREEN_MINIBUF_WINDOW (XSCREEN (scr)), minibuf))
 	    prev = scr;
 	}
 
-      if (NULL (prev))
+      if (NILP (prev))
 	/* We went through the whole screen list without finding a single
 	   acceptable screen.  Return the original screen.  */
 	prev = screen;
@@ -450,7 +450,7 @@
 {
   Lisp_Object tail;
 
-  if (NULL (screen))
+  if (NILP (screen))
     XSET (screen, Lisp_Screen, selected_screen);
   else
     CHECK_LIVE_SCREEN (screen, 0);
@@ -760,7 +760,7 @@
 {
   CHECK_LIVE_SCREEN (screen, 0);
 
-  if (NULL (focus_screen))
+  if (NILP (focus_screen))
     focus_screen = screen;
   else
     CHECK_LIVE_SCREEN (focus_screen, 1);
@@ -941,7 +941,7 @@
   register struct screen *s;
 
   CHECK_NUMBER (rows, 0);
-  if (NULL (screen))
+  if (NILP (screen))
     s = selected_screen;
   else
     {
@@ -955,7 +955,7 @@
 	x_set_window_size (s, s->width, XINT (rows));
     }
   else
-    change_screen_size (s, XINT (rows), 0, !NULL (pretend));
+    change_screen_size (s, XINT (rows), 0, !NILP (pretend));
   return Qnil;
 }
 
@@ -968,7 +968,7 @@
 {
   register struct screen *s;
   CHECK_NUMBER (cols, 0);
-  if (NULL (screen))
+  if (NILP (screen))
     s = selected_screen;
   else
     {
@@ -982,7 +982,7 @@
 	x_set_window_size (s, XINT (cols), s->height);
     }
   else
-    change_screen_size (selected_screen, 0, XINT (cols), !NULL (pretend));
+    change_screen_size (selected_screen, 0, XINT (cols), !NILP (pretend));
   return Qnil;
 }
 
--- a/src/frame.h	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/frame.h	Mon Jan 13 21:48:08 1992 +0000
@@ -55,10 +55,13 @@
   int cursor_x;
   int cursor_y;
 
-  /* Actual cursor position of this screen.
+  /* Actual cursor position of this screen, and the character under it.
      (Not used for terminal screens.)  */
   int phys_cursor_x;
   int phys_cursor_y;
+  /* This is handy for undrawing the cursor, because current_glyphs is
+     not always accurate when in do_scrolling.  */
+  GLYPH phys_cursor_glyph;
 
   /* Size of this screen, in units of characters.  */
   int height;
@@ -120,7 +123,7 @@
   /* Nonzero if this screen should be redrawn.  */
   char garbaged;
 
-  /* True if screen actually has a  minibuffer window on it.
+  /* True if screen actually has a minibuffer window on it.
      0 if using a minibuffer window that isn't on this screen.  */
   char has_minibuffer;
      
@@ -152,9 +155,14 @@
 
 #define WINDOW_SCREEN(w) (w)->screen
 
+#define SCREENP(s) (XTYPE(s) == Lisp_Screen)
+#define SCREEN_LIVE_P(s) ((s)->display.nothing != 0)
 #define SET_SCREEN_GARBAGED(s) (screen_garbaged = 1, s->garbaged = 1)
 #define SCREEN_IS_TERMCAP(s) ((s)->output_method == output_termcap)
 #define SCREEN_IS_X(s) ((s)->output_method == output_x_window)
+#define SCREEN_MINIBUF_ONLY_P(s) \
+  EQ (SCREEN_ROOT_WINDOW (s), SCREEN_MINIBUF_WINDOW (s))
+#define SCREEN_HAS_MINIBUF(s) ((s)->has_minibuffer)
 #define SCREEN_CURRENT_GLYPHS(s) (s)->current_glyphs
 #define SCREEN_DESIRED_GLYPHS(s) (s)->desired_glyphs
 #define SCREEN_TEMP_GLYPHS(s) (s)->temp_glyphs
@@ -172,7 +180,6 @@
 #define SCREEN_MINIBUF_WINDOW(s) (s)->minibuffer_window
 #define SCREEN_ROOT_WINDOW(s) (s)->root_window
 #define SCREEN_SELECTED_WINDOW(s) (s)->selected_window
-#define SCREENP(s) (XTYPE(s) == Lisp_Screen)
 #define SET_GLYPHS_SCREEN(glyphs,screen) ((glyphs)->screen = (screen))
 #define SCREEN_INSERT_COST(s) (s)->insert_line_cost    
 #define SCREEN_DELETE_COST(s) (s)->delete_line_cost    
@@ -182,9 +189,20 @@
 #define SCREEN_SCROLL_BOTTOM_VPOS(s) (s)->scroll_bottom_vpos
 #define SCREEN_FOCUS_SCREEN(s) (s)->focus_screen
 
-#define CHECK_SCREEN(x, i) \
-  { if (XTYPE ((x)) != Lisp_Screen) x = wrong_type_argument (Qscreenp, (x)); }
-extern Lisp_Object Qscreenp;
+#define CHECK_SCREEN(x, i)				\
+  {							\
+    if (! SCREENP (x))					\
+      x = wrong_type_argument (Qscreenp, (x));		\
+  }
+
+#define CHECK_LIVE_SCREEN(x, i)				\
+  {							\
+    if (! SCREENP (x)					\
+	|| ! SCREEN_LIVE_P (XSCREEN (x)))		\
+      x = wrong_type_argument (Qlive_screen_p, (x));	\
+  }
+
+extern Lisp_Object Qscreenp, Qlive_screen_p;
 
 extern struct screen *selected_screen;
 extern struct screen *last_nonminibuf_screen;
@@ -195,7 +213,6 @@
 extern struct screen *make_screen_without_minibuffer ();
 
 extern Lisp_Object Vscreen_list;
-extern Lisp_Object Vglobal_minibuffer_screen;
 extern Lisp_Object Vdefault_screen_alist;
 
 extern Lisp_Object Vterminal_screen;
@@ -212,8 +229,13 @@
 #define XSCREEN(s) selected_screen
 #define WINDOW_SCREEN(w) selected_screen
 
+#define SCREENP(s) (XTYPE(s) == Lisp_Screen)
+#define SCREEN_LIVE_P(s) 1
 #define SET_SCREEN_GARBAGED(s) (screen_garbaged = 1)
 #define SCREEN_IS_TERMCAP(s) 1
+#define SCREEN_IS_X(s) 0
+#define SCREEN_IS_MINIBUF_ONLY(s) 0
+#define SCREEN_HAS_MINIBUF(s) 1
 #define SCREEN_CURRENT_GLYPHS(s) current_glyphs
 #define SCREEN_DESIRED_GLYPHS(s) desired_glyphs
 #define SCREEN_TEMP_GLYPHS(s) temp_glyphs
@@ -231,7 +253,6 @@
 #define SCREEN_MINIBUF_WINDOW(s) minibuf_window
 #define SCREEN_ROOT_WINDOW(s) root_window
 #define SCREEN_SELECTED_WINDOW(s) selected_window
-#define SCREENP(s) 0
 #define SET_GLYPHS_SCREEN(glyphs,screen)
 #define SCREEN_INSERT_COST(screen)  insert_line_cost    
 #define SCREEN_DELETE_COST(screen)  delete_line_cost    
--- a/src/hftctl.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/hftctl.c	Mon Jan 13 21:48:08 1992 +0000
@@ -9,8 +9,8 @@
 /*    #include <sys/hft.h>                                     */
 /*                                                             */
 /*    int hftctl(fildes, request, arg )                        */
-/*    int fildes, request ;                                    */
-/*    char *arg ;                                              */
+/*    int fildes, request;                                     */
+/*    char *arg;                                               */
 /*                                                             */
 /* Description:                                                */
 /*                                                             */
@@ -49,222 +49,241 @@
 #include <sys/ioctl.h>
 #include <sys/signal.h>
 #include <sys/devinfo.h>
+#include <termios.h>
 #include <termio.h>
 #include <sys/hft.h>
-#include <termios.h>
 #include <sys/tty.h>
 /* #include <sys/pty.h> */
 #define REMOTE 0x01
 
 #undef ioctl
-static char     SCCSid[] = "com/gnuemacs/src,3.1,9021-90/05/03-5/3/90" ;
+static char     SCCSid[] = "com/gnuemacs/src,3.1,9021-90/05/03-5/3/90";
 
 /*************** LOCAL DEFINES **********************************/
 
-typedef int     (*FUNC)() ;     /* pointer to a function        */
+typedef int    (*FUNC)();     /* pointer to a function        */
 
 #define QDEV   ((HFQPDEVCH<<8)|HFQPDEVCL)
 #define QLOC   ((HFQLOCCH<<8)|HFQLOCCL)
 #define QPS    ((HFQPRESCH<<8)|HFQPRESCL)
 
+#ifndef TCGETS 
+#define TCGETS TCGETA
+#endif
+#ifndef TCSETS
+#define TCSETS TCSETA
+#endif
+
 /*************** EXTERNAL / GLOBAL DATA AREA ********************/
 
-       int              hfqry() ;
-       int              hfskbd() ;
-       char            *malloc() ;
+       int              hfqry();
+       int              hfskbd();
+       char            *malloc();
 
-extern int              errno ;
-static jmp_buf          hftenv ;
-static int              is_ack_vtd ;
-static FUNC             sav_alrm ;
+extern int              errno;
+static jmp_buf          hftenv;
+static int              is_ack_vtd;
+static FUNC             sav_alrm;
 static struct hfctlreq  req =
 			{ 0x1b,'[','x',0,0,0,21,HFCTLREQCH,HFCTLREQCL};
 static struct hfctlack  ACK =
 			{ 0x1b,'[','x',0,0,0,21,HFCTLACKCH,HFCTLACKCL};
 
-       /* FUNC             signal() ; */
+       /* FUNC             signal(); */
 
 /*************** LOCAL MACROS ***********************************/
 
 #define HFTYPE(p)   ((p->hf_typehi<<8)|(p->hf_typelo))
 
-#define BYTE4(p)    ( (p)[0]<<24 | (p)[1]<<16 | (p)[2]<<8 | (p)[3] )
+#define BYTE4(p)    ((p)[0]<<24 | (p)[1]<<16 | (p)[2]<<8 | (p)[3])
 
 					/* read a buffer        */
 #define RD_BUF(f,p,l) \
-        while ( (l) ) \
-          if ( ( j = read((f),(p),(l)) ) < 0 ) \
-             if ( errno != EINTR ) return (-1) ; \
-             else continue ; \
-          else { (l)-=j ; (p)+=j ; }
+        while ((l)) \
+          if ((j = read((f),(p),(l))) < 0) \
+             if (errno != EINTR) return (-1); \
+             else continue; \
+          else { (l) -= j; (p) += j; }
+
+/*************** function prototypes ***************************/
+#ifdef __STDC__
+static GT_ACK (int fd, int req, char *buf);
+static WR_REQ (int fd, int request, int cmdlen, char *cmd, int resplen);
+static hft_alrm(int sig);
+#else
+static GT_ACK ();
+static WR_REQ ();
+static hft_alrm ();
+#endif
 
 /*************** HFTCTL FUNCTION *******************************/
 
-hftctl( fd, request, arg )
-        int     fd ;
-        int     request ;
-        union {
-        struct hfintro *intro ;
-        struct hfquery *query ;
-        char           *c ;
-        }       arg ;
+hftctl (fd, request, arg)
+     int     fd;
+     int     request;
+     union {
+       struct hfintro *intro;
+       struct hfquery *query;
+       char           *c;
+     } arg;
 {
 
-        int             i ;
-        int             fd_flag ;       /* fcntl flags          */
-register union {
- struct hfintro         *cmd ;          /* p.cmd - intro des.   */
- struct hfqphdevc       *ph ;           /* p.ph  - physical dev.*/
-        char            *c ;            /* p.c   - char ptr     */
-        }               p ;             /* general pointer      */
-        int             pty_new ;       /* pty modes            */
-        int             pty_old ;
-        int             retcode ;
-        struct termios   term_new ;      /* terminal attributes  */
-        struct termios   term_old ;
-	struct devinfo	devInfo ;	/* defined in sys/devinfo.h */
+  int             i;
+  int             fd_flag;	/* fcntl flags          */
+  register union {
+    struct hfintro         *cmd; /* p.cmd - intro des.   */
+    struct hfqphdevc       *ph;	/* p.ph  - physical dev.*/
+    char            *c;		/* p.c   - char ptr     */
+  }               p;		/* general pointer      */
+  int             pty_new;	/* pty modes            */
+  int             pty_old;
+  int             retcode;
+  struct termios   term_new;	/* terminal attributes  */
+  struct termios   term_old;
+  struct devinfo	devInfo; /* defined in sys/devinfo.h */
 
 
-if ( ioctl( fd, IOCINFO, &devInfo ) == -1 ) return(-1) ;
+  if (ioctl (fd, IOCINFO, &devInfo) == -1) return(-1);
 
-if ( devInfo.devtype != DD_PSEU )	/* is it a pty? */
-   return (ioctl(fd, request, arg) ) ;	/* no, do IOCTL */
+  if (devInfo.devtype != DD_PSEU) /* is it a pty? */
+    return (ioctl(fd, request, arg)); /* no, do IOCTL */
 
-                                /******* START PTY **************/
-                                /**  Pty found, possible HFT    */
-                                /** set new file des as raw     */
-                                /** as you can.                 */
-                                /********************************/
+  /******* START PTY **************/
+  /**  Pty found, possible HFT    */
+  /** set new file des as raw     */
+  /** as you can.                 */
+  /********************************/
 
-                                /* Get current state of file    */
-                                /* descriptor & save            */
-if ( ( fd_flag = fcntl( fd, F_GETFL, 0 ) ) == -1 ) return (-1) ;
-if ( ioctl( fd, TCGETS, &term_old ) == -1 ) return (-1) ;
-                                /* set terminal attr to raw     */
-                                /* and to delay on read         */
-pty_new = pty_old | REMOTE ;
-memcpy( &term_new, &term_old, sizeof( term_new ) ) ;
-term_new.c_iflag = 0 ;
-term_new.c_oflag = 0 ;
-term_new.c_lflag = 0 ;
-/* term_new.c_line  = 0 ; */
-for ( i = 1 ; i <= 5 ; i++ )
-term_new.c_cc[i] = 0 ;
-term_new.c_cc[0] = -1 ;
-ioctl( fd, TCSETS, &term_new ) ;
-if ( fcntl( fd, F_SETFL, fd_flag & ~O_NDELAY ) == -1 )
-   return(-1) ;
-                                /* call spacific function       */
-if ( request == HFSKBD )
-   retcode = hfskbd( fd, request, arg.c) ;
-else /* assume HFQUERY */
-   retcode = hfqry( fd, request, arg.c) ;
+  /* Get current state of file    */
+  /* descriptor & save            */
+  if ((fd_flag = fcntl (fd, F_GETFL, 0)) == -1) return (-1);
+  if (ioctl (fd, TCGETS, &term_old) == -1) return (-1);
+  /* set terminal attr to raw     */
+  /* and to delay on read         */
+  pty_new = pty_old | REMOTE;
+  memcpy (&term_new, &term_old, sizeof (term_new));
+  term_new.c_iflag = 0;
+  term_new.c_oflag = 0;
+  term_new.c_lflag = 0;
+  /* term_new.c_line  = 0; */
+  for (i = 1; i <= 5; i++)
+    term_new.c_cc[i] = 0;
+  term_new.c_cc[0] = -1;
+  ioctl (fd, TCSETS, &term_new);
+  if (fcntl (fd, F_SETFL, fd_flag & ~O_NDELAY) == -1)
+    return(-1);
+  /* call spacific function       */
+  if (request == HFSKBD)
+    retcode = hfskbd (fd, request, arg.c);
+  else				/* assume HFQUERY */
+    retcode = hfqry (fd, request, arg.c);
 
-fcntl( fd, F_SETFL, fd_flag ) ; /* reset terminal to original   */
-ioctl( fd, TCSETS, &term_old ) ;
+  fcntl (fd, F_SETFL, fd_flag); /* reset terminal to original   */
+  ioctl (fd, TCSETS, &term_old);
 
 
-return( retcode ) ;             /* return error                 */
+  return (retcode);             /* return error                 */
 }
 
 /*************** HFSKBD  FUNCTION ******************************/
-static hfskbd(fd, request, arg )
-        int     fd ;
-        int     request ;
-        struct hfbuf *arg ;
+static int
+hfskbd (fd, request, arg)
+        int     fd;
+        int     request;
+        struct hfbuf *arg;
 {
-WR_REQ(fd, request, arg->hf_buflen, arg->hf_bufp,0) ;
-return( GT_ACK(fd, request, arg->hf_bufp) ) ;
+  WR_REQ(fd, request, arg->hf_buflen, arg->hf_bufp,0);
+  return (GT_ACK(fd, request, arg->hf_bufp));
 }
 
 /*************** HFQUERY FUNCTION ******************************/
-static hfqry(fd, request, arg )
-        int     fd ;
-        int     request ;
-        struct hfquery *arg ;
+static int
+hfqry (fd, request, arg)
+        int     fd;
+        int     request;
+        struct hfquery *arg;
 {
-WR_REQ(fd, request, arg->hf_cmdlen, arg->hf_cmd, arg->hf_resplen ) ;
-return( GT_ACK(fd, request, arg->hf_resp ) ) ;
+  WR_REQ(fd, request, arg->hf_cmdlen, arg->hf_cmd, arg->hf_resplen);
+  return (GT_ACK(fd, request, arg->hf_resp));
 }
 
 
 /*************** GT_ACK FUNCTION ******************************/
-static GT_ACK(fd, req, buf )
-        int     fd ;
-        int     req ;
-        char   *buf ;
+static int
+GT_ACK (fd, req, buf)
+        int     fd;
+        int     req;
+        char   *buf;
 {
-
-        struct hfctlack ack ;
-        int             i = sizeof( ack ) ;
-        int             j = 0 ;
-        union {
-        char            *c ;
-        struct hfctlack *ack ;
-        }               p ;
-
-        int             hft_alrm() ;
+  struct hfctlack ack;
+  int             i = sizeof (ack);
+  int             j = 0;
+  union {
+    char            *c;
+    struct hfctlack *ack;
+  }               p;
 
-is_ack_vtd = 0 ;                        /* flag no ACT VTD yet         */
+  is_ack_vtd = 0;		/* flag no ACT VTD yet         */
 
-if ( setjmp( hftenv ) )                 /* set environment in case     */
-   {                                    /* of time out                 */
-   errno=ENODEV ;                       /* if time out, set errno      */
-   return( -1 ) ;                       /* flag error                  */
-   }
+  if (setjmp (hftenv))		/* set environment in case     */
+    {				/* of time out                 */
+      errno = ENODEV;		/* if time out, set errno      */
+      return (-1);		/* flag error                  */
+    }
 
-alarm(3) ;                              /* time out in 3 secs          */
-sav_alrm = signal( SIGALRM, hft_alrm ) ;/* prepare to catch time out   */
+  alarm(3);			/* time out in 3 secs          */
+  sav_alrm = signal (SIGALRM, hft_alrm); /* prepare to catch time out   */
 
-p.ack = &ack ;
-while ( ! is_ack_vtd )                  /* do until valid ACK VTD      */
-  {
-  RD_BUF(fd, p.c, i ) ;                 /* read until a ACK VTD is fill*/
+  p.ack = &ack;
+  while (! is_ack_vtd)		/* do until valid ACK VTD      */
+    {
+      RD_BUF(fd, p.c, i);	/* read until a ACK VTD is fill*/
 
-  if ( ! memcmp( &ack, &ACK, sizeof( HFINTROSZ ) ) /* the ACK intro &  */
-       && ( ack.hf_request == req ) )   /* is it the response we want ?*/
-     {                                  /* yes, ACK VTD found          */
-     is_ack_vtd = 1 ;                   /* quickly, flag it            */
-     break ;                            /* get the %$%#@ out of here   */
-     }
+      if (! memcmp (&ack, &ACK, sizeof (HFINTROSZ)) /* the ACK intro &  */
+	  && (ack.hf_request == req)) /* is it the response we want ?*/
+	{			/* yes, ACK VTD found          */
+	  is_ack_vtd = 1;	/* quickly, flag it            */
+	  break;		/* get the %$%#@ out of here   */
+	}
 
-  p.ack = &ack ;                        /* no, then skip 1st           */
-  ++p.c ;                               /* char and start over         */
-  i = sizeof( ack ) - 1 ;               /* one less ESC to cry over    */
+      p.ack = &ack;		/* no, then skip 1st           */
+      ++p.c;			/* char and start over         */
+      i = sizeof (ack) - 1;	/* one less ESC to cry over    */
 
-  while( ( *p.c != 0x1b ) && i )        /* scan for next ESC           */
-     { ++p.c ; --i ; }                  /* if any                      */
+      while ((*p.c != 0x1b) && i) /* scan for next ESC           */
+	{ ++p.c; --i; }		/* if any                      */
 
-  ( i ? memcpy( &ack, p.c, i ) : 0 ) ;  /* if any left over, then move */
-  p.ack = &ack ;                        /* ESC to front of ack struct  */
-  p.c += i ;                            /* skip over whats been read   */
-  i = sizeof( ack ) - i ;               /* set whats left to be read   */
-  }                                     /***** TRY AGAIN               */
+      (i ? memcpy (&ack, p.c, i) : 0); /* if any left over, then move */
+      p.ack = &ack;		/* ESC to front of ack struct  */
+      p.c += i;			/* skip over whats been read   */
+      i = sizeof (ack) - i;	/* set whats left to be read   */
+    }				/***** TRY AGAIN               */
 
-alarm(0) ;                              /* ACK VTD received, reset alrm*/
-signal( SIGALRM, sav_alrm ) ;           /* reset signal                */
+  alarm(0);			/* ACK VTD received, reset alrm*/
+  signal (SIGALRM, sav_alrm);	/* reset signal                */
 
-if ( i = ack.hf_arg_len )               /* any data following ?        */
-   {                                    /* yes,                        */
-   RD_BUF(fd,buf,i) ;                   /* read until it is received   */
-   }
+  if (i = ack.hf_arg_len)	/* any data following ?        */
+    {				/* yes,                        */
+      RD_BUF(fd,buf,i);		/* read until it is received   */
+    }
 
-if ( errno = ack.hf_retcode )           /* set errno based on returned */
-   return (-1) ;                         /* code, if 0, then no error   */
-else
-   return (0) ;                        /* if set, then error returned */
+  if (errno = ack.hf_retcode)	/* set errno based on returned */
+    return (-1);		/* code, if 0, then no error   */
+  else
+    return (0);			/* if set, then error returned */
 }
 
 /*************** HFT_ALRM FUNCTION ******************************/
-static hft_alrm(sig)                    /* Function hft_alrm - handle  */
-        int             sig ;           /* alarm signal               */
+static int
+hft_alrm (sig)                    /* Function hft_alrm - handle  */
+        int sig;		/* alarm signal               */
 {
-signal( SIGALRM, sav_alrm ) ;           /* reset to previous          */
+  signal (SIGALRM, sav_alrm);	/* reset to previous          */
 
-if ( is_ack_vtd )                       /* has ack vtd arrived ?      */
-   return(0) ;                          /* yes, then continue         */
-else                                    /* no, then return with error */
-   longjmp( hftenv, -1 ) ;
+  if (is_ack_vtd)		/* has ack vtd arrived ?      */
+    return(0);			/* yes, then continue         */
+  else				/* no, then return with error */
+    longjmp (hftenv, -1);
 
 }
 
@@ -278,42 +297,43 @@
 /***                                                               ***/
 /*********************************************************************/
 
-static WR_REQ(fd, request, cmdlen, cmd, resplen )
-	int             fd ;
-	int             request ;
-	int             cmdlen ;
-	char           *cmd ;
-	int             resplen ;
+static int
+WR_REQ (fd, request, cmdlen, cmd, resplen)
+	int             fd;
+	int             request;
+	int             cmdlen;
+	char           *cmd;
+	int             resplen;
 {
-	struct {
-	char            *c ;
-	struct hfctlreq *req ;
-	}              p ;
-	int            size ;
+  struct {
+    char            *c;
+    struct hfctlreq *req;
+  }              p;
+  int            size;
 
-	req.hf_request = request ;
-	req.hf_arg_len = cmdlen ;
-	req.hf_rsp_len = resplen ;
+  req.hf_request = request;
+  req.hf_arg_len = cmdlen;
+  req.hf_rsp_len = resplen;
 
-if ( cmdlen )                           /* if arg structure to pass    */
-   {
-   size = sizeof( struct hfctlreq ) + cmdlen ;
-   if ( ( p.c = malloc(size) ) == NULL ) /* malloc one area            */
-      return( -1 ) ;
+  if (cmdlen)			/* if arg structure to pass    */
+    {
+      size = sizeof (struct hfctlreq) + cmdlen;
+      if ((p.c = malloc(size)) == NULL) /* malloc one area            */
+	return (-1);
 
-   memcpy( p.c, &req, sizeof( req ) ) ; /* copy CTL REQ struct         */
-   memcpy( p.c + sizeof( req ), cmd, cmdlen ) ; /* copy arg struct     */
-   }
-else
-   {
-   p.req = &req ;                       /* otherwise use only CTL REQ  */
-   size = sizeof( req ) ;
-   }
+      memcpy (p.c, &req, sizeof (req)); /* copy CTL REQ struct         */
+      memcpy (p.c + sizeof (req), cmd, cmdlen); /* copy arg struct     */
+    }
+  else
+    {
+      p.req = &req;		/* otherwise use only CTL REQ  */
+      size = sizeof (req);
+    }
 
-					/* write request to terminal   */
-if ( write(fd,p.c,size) == -1 ) return (-1) ;
-if ( p.req != &req )                    /* free if allocated           */
-   free( p.c ) ;
-return (0) ;
+  /* write request to terminal   */
+  if (write(fd,p.c,size) == -1) return (-1);
+  if (p.req != &req)		/* free if allocated           */
+    free (p.c);
+  return (0);
 
 }
--- a/src/keymap.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/keymap.c	Mon Jan 13 21:48:08 1992 +0000
@@ -155,7 +155,7 @@
   (object)
      Lisp_Object object;
 {
-  return (NULL (get_keymap_1 (object, 0)) ? Qnil : Qt);
+  return (NILP (get_keymap_1 (object, 0)) ? Qnil : Qt);
 }
 
 /* Check that OBJECT is a keymap (after dereferencing through any
@@ -232,7 +232,7 @@
 
     /* A dense keymap indexed by a character?  */
     if (XTYPE (idx) == Lisp_Int
-	&& ! NULL (table))
+	&& ! NILP (table))
       return XVECTOR (table)->contents[XFASTINT (idx)];
 
     /* This lookup will not involve a vector reference.  */
@@ -269,7 +269,7 @@
       tem = Fkeymapp (map);
 
       /* If the contents are (KEYMAP . ELEMENT), go indirect.  */
-      if (!NULL (tem))
+      if (!NILP (tem))
 	object = access_keymap (map, Fcdr (object));
       
       /* If the keymap contents looks like (STRING . DEFN),
@@ -306,7 +306,7 @@
     Lisp_Object table = keymap_table (keymap);
 
     /* A dense keymap indexed by a character?  */
-    if (XTYPE (idx) == Lisp_Int	&& !NULL (table))
+    if (XTYPE (idx) == Lisp_Int	&& !NILP (table))
       XVECTOR (table)->contents[XFASTINT (idx)] = def;
 
     /* Must be a sparse keymap, or a dense keymap indexed by a symbol.  */
@@ -315,7 +315,7 @@
 	/* Point to the pointer to the start of the assoc-list part
 	   of the keymap.  */
 	register Lisp_Object *assoc_head
-	  = (NULL (table)
+	  = (NILP (table)
 	     ? & XCONS (keymap)->cdr
 	     : & XCONS (XCONS (keymap)->cdr)->cdr);
 	register Lisp_Object defining_pair;
@@ -328,7 +328,7 @@
 	/* Point to the pair where idx is bound, if any.  */
 	defining_pair = Fassq (idx, *assoc_head);
 
-	if (NULL (defining_pair))
+	if (NILP (defining_pair))
 	  *assoc_head = Fcons (Fcons (idx, def), *assoc_head);
 	else
 	  Fsetcdr (defining_pair, def);
@@ -367,7 +367,7 @@
 
 	  for (i = 0; i < DENSE_TABLE_SIZE; i++)
 	    if (XTYPE (XVECTOR (copy)->contents[i]) != Lisp_Symbol)
-	      if (! NULL (Fkeymapp (XVECTOR (table)->contents[i])))
+	      if (! NILP (Fkeymapp (XVECTOR (table)->contents[i])))
 		XVECTOR (table)->contents[i]
 		  = Fcopy_keymap (XVECTOR (table)->contents[i]);
 	  XCONS (tail)->car = table;
@@ -384,7 +384,7 @@
       elt = XCONS (tail)->car;
       if (CONSP (elt)
 	  && XTYPE (XCONS (elt)->cdr) != Lisp_Symbol
-	  && ! NULL (Fkeymapp (XCONS (elt)->cdr)))
+	  && ! NILP (Fkeymapp (XCONS (elt)->cdr)))
 	XCONS (elt)->cdr = Fcopy_keymap (XCONS (elt)->cdr);
 
       tail = XCONS (tail)->cdr;
@@ -461,14 +461,14 @@
 
       cmd = get_keyelt (access_keymap (keymap, c));
 
-      if (NULL (cmd))
+      if (NILP (cmd))
 	{
 	  cmd = Fmake_sparse_keymap ();
 	  store_in_keymap (keymap, c, cmd);
 	}
 
       tem = Fkeymapp (cmd);
-      if (NULL (tem))
+      if (NILP (tem))
 	error ("Key sequence %s uses invalid prefix characters",
 	       XSTRING (key)->data);
 
@@ -533,7 +533,7 @@
 	return cmd;
 
       tem = Fkeymapp (cmd);
-      if (NULL (tem))
+      if (NILP (tem))
 	return make_number (idx);
 
       keymap = get_keymap (cmd);
@@ -568,6 +568,11 @@
 
 /* Global, local, and minor mode keymap stuff.				*/
 
+/* We can't put these variables inside current_minor_maps, since under
+   DGUX they dump as pure.  Bleah.  */
+static Lisp_Object *cmm_modes, *cmm_maps;
+static int cmm_size;
+
 /* Store a pointer to an array of the keymaps of the currently active
    minor modes in *buf, and return the number of maps it contains.
 
@@ -588,9 +593,6 @@
 current_minor_maps (modeptr, mapptr)
      Lisp_Object **modeptr, **mapptr;
 {
-  static Lisp_Object *modes, *maps;
-  static int size;
-
   int i = 0;
   Lisp_Object alist, assoc, var;
 
@@ -599,39 +601,39 @@
        alist = XCONS (alist)->cdr)
     if (CONSP (assoc = XCONS (alist)->car)
 	&& XTYPE (var = XCONS (assoc)->car) == Lisp_Symbol
-	&& ! NULL (Fboundp (var))
-	&& ! NULL (Fsymbol_value (var)))
+	&& ! NILP (Fboundp (var))
+	&& ! NILP (Fsymbol_value (var)))
       {
-	if (i >= size)
+	if (i >= cmm_size)
 	  {
 	    Lisp_Object *newmodes, *newmaps;
 
-	    if (maps)
+	    if (cmm_maps)
 	      {
-		newmodes = (Lisp_Object *) realloc (modes, size *= 2);
-		newmaps  = (Lisp_Object *) realloc (maps,  size);
+		newmodes = (Lisp_Object *) realloc (cmm_modes, cmm_size *= 2);
+		newmaps  = (Lisp_Object *) realloc (cmm_maps,  cmm_size);
 	      }
 	    else
 	      {
-		newmodes = (Lisp_Object *) malloc (size = 30);
-		newmaps  = (Lisp_Object *) malloc (size);
+		newmodes = (Lisp_Object *) malloc (cmm_size = 30);
+		newmaps  = (Lisp_Object *) malloc (cmm_size);
 	      }
 
 	    if (newmaps && newmodes)
 	      {
-		modes = newmodes;
-		maps = newmaps;
+		cmm_modes = newmodes;
+		cmm_maps = newmaps;
 	      }
 	    else
 	      break;
 	  }
-	modes[i] = var;
-	maps [i] = XCONS (assoc)->cdr;
+	cmm_modes[i] = var;
+	cmm_maps [i] = XCONS (assoc)->cdr;
 	i++;
       }
 
-  if (modeptr) *modeptr = modes;
-  if (mapptr)  *mapptr  = maps;
+  if (modeptr) *modeptr = cmm_modes;
+  if (mapptr)  *mapptr  = cmm_maps;
   return i;
 }
 
@@ -647,22 +649,22 @@
 
   nmaps = current_minor_maps (0, &maps);
   for (i = 0; i < nmaps; i++)
-    if (! NULL (maps[i]))
+    if (! NILP (maps[i]))
       {
 	value = Flookup_key (maps[i], key);
-	if (! NULL (value) && XTYPE (value) != Lisp_Int)
+	if (! NILP (value) && XTYPE (value) != Lisp_Int)
 	  return value;
       }
 
-  if (! NULL (current_buffer->keymap))
+  if (! NILP (current_buffer->keymap))
     {
       value = Flookup_key (current_buffer->keymap, key);
-      if (! NULL (value) && XTYPE (value) != Lisp_Int)
+      if (! NILP (value) && XTYPE (value) != Lisp_Int)
 	return value;
     }
 
   value = Flookup_key (current_global_map, key);
-  if (! NULL (value) && XTYPE (value) != Lisp_Int)
+  if (! NILP (value) && XTYPE (value) != Lisp_Int)
     return value;
   
   return Qnil;
@@ -677,7 +679,7 @@
 {
   register Lisp_Object map;
   map = current_buffer->keymap;
-  if (NULL (map))
+  if (NILP (map))
     return Qnil;
   return Flookup_key (map, keys);
 }
@@ -711,11 +713,11 @@
   nmaps = current_minor_maps (&modes, &maps);
 
   for (i = j = 0; i < nmaps; i++)
-    if (! NULL (maps[i])
-	&& ! NULL (binding = Flookup_key (maps[i], key))
+    if (! NILP (maps[i])
+	&& ! NILP (binding = Flookup_key (maps[i], key))
 	&& XTYPE (binding) != Lisp_Int)
       {
-	if (! NULL (get_keymap_1 (binding, 0)))
+	if (! NILP (get_keymap_1 (binding, 0)))
 	  maps[j++] = Fcons (modes[i], binding);
 	else if (j == 0)
 	  return Fcons (Fcons (modes[i], binding), Qnil);
@@ -754,7 +756,7 @@
 {
   register Lisp_Object map;
   map = current_buffer->keymap;
-  if (NULL (map))
+  if (NILP (map))
     {
       map = Fmake_sparse_keymap ();
       current_buffer->keymap = map;
@@ -785,7 +787,7 @@
   (keys)
      Lisp_Object keys;
 {
-  if (!NULL (current_buffer->keymap))
+  if (!NILP (current_buffer->keymap))
     Flocal_set_key (keys, Qnil);
   return Qnil;
 }
@@ -802,7 +804,7 @@
   Lisp_Object map;
   map = Fmake_sparse_keymap ();
   Ffset (name, map);
-  if (!NULL (mapvar))
+  if (!NILP (mapvar))
     Fset (mapvar, map);
   else
     Fset (name, map);
@@ -825,7 +827,7 @@
   (keymap)
      Lisp_Object keymap;
 {
-  if (!NULL (keymap))
+  if (!NILP (keymap))
     keymap = get_keymap (keymap);
 
   current_buffer->keymap = keymap;
@@ -880,7 +882,7 @@
      This is a breadth-first traversal, where tail is the queue of
      nodes, and maps accumulates a list of all nodes visited.  */
 
-  while (!NULL (tail))
+  while (!NILP (tail))
     {
       register Lisp_Object thisseq = Fcar (Fcar (tail));
       register Lisp_Object thismap = Fcdr (Fcar (tail));
@@ -908,14 +910,14 @@
 		  register Lisp_Object cmd;
 
 		  cmd = get_keyelt (XVECTOR (table)->contents[i]);
-		  if (NULL (cmd)) continue;
+		  if (NILP (cmd)) continue;
 		  tem = Fkeymapp (cmd);
-		  if (!NULL (tem))
+		  if (!NILP (tem))
 		    {
 		      cmd = get_keymap (cmd);
 		      /* Ignore keymaps that are already added to maps.  */
 		      tem = Frassq (cmd, maps);
-		      if (NULL (tem))
+		      if (NILP (tem))
 			{
 			  /* If the last key in thisseq is meta-prefix-char,
 			     turn it into a meta-ized keystroke.  We know
@@ -960,12 +962,12 @@
 
 	      /* Ignore definitions that aren't keymaps themselves.  */
 	      tem = Fkeymapp (cmd);
-	      if (!NULL (tem))
+	      if (!NILP (tem))
 		{
 		  /* Ignore keymaps that have been seen already.  */
 		  cmd = get_keymap (cmd);
 		  tem = Frassq (cmd, maps);
-		  if (NULL (tem))
+		  if (NILP (tem))
 		    {
 		      /* let elt be the event defined by this map entry.  */
 		      elt = XCONS (elt)->car;
@@ -1171,10 +1173,10 @@
   register Lisp_Object maps;
   Lisp_Object found;
 
-  if (NULL (global_keymap))
+  if (NILP (global_keymap))
     global_keymap = current_global_map;
 
-  if (!NULL (local_keymap))
+  if (!NILP (local_keymap))
     maps = nconc2 (Faccessible_keymaps (get_keymap (local_keymap)),
 		   Faccessible_keymaps (get_keymap (global_keymap)));
   else
@@ -1182,7 +1184,7 @@
 
   found = Qnil;
 
-  for (; !NULL (maps); maps = Fcdr (maps))
+  for (; !NILP (maps); maps = Fcdr (maps))
     {
       register this = Fcar (Fcar (maps)); /* Key sequence to reach map */
       register map = Fcdr (Fcar (maps)); /* The map that it reaches */
@@ -1245,7 +1247,7 @@
 	    break;
 
 	  /* Search through indirections unless that's not wanted.  */
-	  if (NULL (noindirect))
+	  if (NILP (noindirect))
 	    binding = get_keyelt (binding);
 
 	  /* End this iteration if this element does not match
@@ -1255,7 +1257,7 @@
 	    {
 	      Lisp_Object tem;
 	      tem = Fequal (binding, definition);
-	      if (NULL (tem))
+	      if (NILP (tem))
 		continue;
 	    }
 	  else
@@ -1281,16 +1283,16 @@
 
 	     Either nil or number as value from Flookup_key
 	     means undefined.  */
-	  if (!NULL (local_keymap))
+	  if (!NILP (local_keymap))
 	    {
 	      binding = Flookup_key (local_keymap, sequence);
-	      if (!NULL (binding) && XTYPE (binding) != Lisp_Int)
+	      if (!NILP (binding) && XTYPE (binding) != Lisp_Int)
 		{
 		  if (XTYPE (definition) == Lisp_Cons)
 		    {
 		      Lisp_Object tem;
 		      tem = Fequal (binding, definition);
-		      if (NULL (tem))
+		      if (NILP (tem))
 			continue;
 		    }
 		  else
@@ -1301,7 +1303,7 @@
 
 	  /* It is a true unshadowed match.  Record it.  */
 
-	  if (!NULL (firstonly))
+	  if (!NILP (firstonly))
 	    return sequence;
 	  found = Fcons (sequence, found);
 	}
@@ -1392,7 +1394,7 @@
   }
 
   start1 = XBUFFER (descbuf)->keymap;
-  if (!NULL (start1))
+  if (!NILP (start1))
     {
       insert_string ("Local Bindings:\n");
       insert_string (heading);
@@ -1428,13 +1430,13 @@
   maps = Faccessible_keymaps (startmap);
   GCPRO1 (maps);
 
-  for (; !NULL (maps); maps = Fcdr (maps))
+  for (; !NILP (maps); maps = Fcdr (maps))
     {
       elt = Fcar (maps);
       sh = Fcar (elt);
 
       /* If there is no shadow keymap given, don't shadow.  */
-      if (NULL (shadow))
+      if (NILP (shadow))
 	sh = Qnil;
 
       /* If the sequence by which we reach this keymap is zero-length,
@@ -1460,7 +1462,7 @@
 	 show through), describe the map.  Otherwise, sh is a command
 	 that completely shadows the current map, and we shouldn't
 	 bother.  */
-      if (NULL (sh) || !NULL (Fkeymapp (sh)))
+      if (NILP (sh) || !NILP (Fkeymapp (sh)))
 	describe_map (Fcdr (elt), Fcar (elt), partial, sh);
     }
 
@@ -1484,7 +1486,7 @@
   else
     {
       tem1 = Fkeymapp (definition);
-      if (!NULL (tem1))
+      if (!NILP (tem1))
 	insert_string ("Prefix Command\n");
       else
 	insert_string ("??\n");
@@ -1503,7 +1505,7 @@
 {
   register Lisp_Object keysdesc;
 
-  if (!NULL (keys) && Flength (keys) > 0)
+  if (!NILP (keys) && Flength (keys) > 0)
     keysdesc = concat2 (Fkey_description (keys),
 			build_string (" "));
   else
@@ -1560,24 +1562,24 @@
       tem2 = get_keyelt (Fcdr_safe (Fcar (alist)));
 
       /* Don't show undefined commands or suppressed commands.  */
-      if (NULL (tem2)) continue;
+      if (NILP (tem2)) continue;
       if (XTYPE (tem2) == Lisp_Symbol && partial)
 	{
 	  this = Fget (tem2, suppress);
-	  if (!NULL (this))
+	  if (!NILP (this))
 	    continue;
 	}
 
       /* Don't show a command that isn't really visible
 	 because a local definition of the same key shadows it.  */
 
-      if (!NULL (shadow))
+      if (!NILP (shadow))
 	{
 	  Lisp_Object tem;
 
 	  XVECTOR (kludge)->contents[0] = tem1;
 	  tem = Flookup_key (shadow, kludge);
-	  if (!NULL (tem)) continue;
+	  if (!NILP (tem)) continue;
 	}
 
       if (first)
@@ -1586,7 +1588,7 @@
 	  first = 0;
 	}
 
-      if (!NULL (elt_prefix))
+      if (!NILP (elt_prefix))
 	insert1 (elt_prefix);
 
       /* THIS gets the string to describe the character TEM1.  */
@@ -1651,26 +1653,26 @@
       QUIT;
       tem1 = get_keyelt (XVECTOR (vector)->contents[i]);
 
-      if (NULL (tem1)) continue;      
+      if (NILP (tem1)) continue;      
 
       /* Don't mention suppressed commands.  */
       if (XTYPE (tem1) == Lisp_Symbol && partial)
 	{
 	  this = Fget (tem1, suppress);
-	  if (!NULL (this))
+	  if (!NILP (this))
 	    continue;
 	}
 
       /* If this command in this map is shadowed by some other map,
 	 ignore it.  */
-      if (!NULL (shadow))
+      if (!NILP (shadow))
 	{
 	  Lisp_Object tem;
 	  
 	  XVECTOR (kludge)->contents[0] = make_number (i);
 	  tem = Flookup_key (shadow, kludge);
 
-	  if (!NULL (tem)) continue;
+	  if (!NILP (tem)) continue;
 	}
 
       if (first)
@@ -1680,7 +1682,7 @@
 	}
 
       /* Output the prefix that applies to every entry in this map.  */
-      if (!NULL (elt_prefix))
+      if (!NILP (elt_prefix))
 	insert1 (elt_prefix);
 
       /* Get the string to describe the character I, and print it.  */
@@ -1702,7 +1704,7 @@
       if (i != XINT (dummy))
 	{
 	  insert (" .. ", 4);
-	  if (!NULL (elt_prefix))
+	  if (!NILP (elt_prefix))
 	    insert1 (elt_prefix);
 
 	  XFASTINT (dummy) = i;
@@ -1729,9 +1731,9 @@
   register Lisp_Object tem;
 
   tem = Fstring_match (string, Fsymbol_name (symbol), Qnil);
-  if (!NULL (tem) && !NULL (apropos_predicate))
+  if (!NILP (tem) && !NILP (apropos_predicate))
     tem = call1 (apropos_predicate, symbol);
-  if (!NULL (tem))
+  if (!NILP (tem))
     apropos_accumulate = Fcons (symbol, apropos_accumulate);
 }
 
--- a/src/lread.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/lread.c	Mon Jan 13 21:48:08 1992 +0000
@@ -122,7 +122,7 @@
 
   tem = call0 (readcharfun);
 
-  if (NULL (tem))
+  if (NILP (tem))
     return -1;
   return XINT (tem);
 }
@@ -250,13 +250,13 @@
      since it would try to load a directory as a Lisp file */
   if (XSTRING (str)->size > 0)
     {
-      fd = openp (Vload_path, str, !NULL (nosuffix) ? "" : ".elc:.el:",
+      fd = openp (Vload_path, str, !NILP (nosuffix) ? "" : ".elc:.el:",
 		  &found, 0);
     }
 
   if (fd < 0)
     {
-      if (NULL (noerror))
+      if (NILP (noerror))
 	while (1)
 	  Fsignal (Qfile_error, Fcons (build_string ("Cannot open load file"),
 				       Fcons (str, Qnil)));
@@ -286,7 +286,7 @@
       error ("Failure to create stdio stream for %s", XSTRING (str)->data);
     }
 
-  if (NULL (nomessage))
+  if (NILP (nomessage))
     message ("Loading %s...", XSTRING (str)->data);
 
   GCPRO1 (str);
@@ -303,11 +303,11 @@
 
   /* Run any load-hooks for this file.  */
   temp = Fassoc (str, Vafter_load_alist);
-  if (!NULL (temp))
+  if (!NILP (temp))
     Fprogn (Fcdr (temp));
   UNGCPRO;
 
-  if (!noninteractive && NULL (nomessage))
+  if (!noninteractive && NILP (nomessage))
     message ("Loading %s...done", XSTRING (str)->data);
   return Qt;
 }
@@ -373,7 +373,7 @@
   if (complete_filename_p (str))
     absolute = 1;
 
-  for (; !NULL (path); path = Fcdr (path))
+  for (; !NILP (path); path = Fcdr (path))
     {
       char *nsuffix;
 
@@ -472,7 +472,7 @@
       if (c < 0) break;
       if (c == ' ' || c == '\t' || c == '\n' || c == '\f') continue;
 
-      if (!NULL (Vpurify_flag) && c == '(')
+      if (!NILP (Vpurify_flag) && c == '(')
 	{
 	  record_unwind_protect (unreadpure, Qnil);
 	  val = read_list (-1, readcharfun);
@@ -513,14 +513,14 @@
   int count = specpdl_ptr - specpdl;
   Lisp_Object tem;
 
-  if (NULL (printflag))
+  if (NILP (printflag))
     tem = Qsymbolp;
   else
     tem = printflag;
   specbind (Qstandard_output, tem);
   record_unwind_protect (save_excursion_restore, save_excursion_save ());
   SET_PT (BEGV);
-  readevalloop (Fcurrent_buffer (), 0, Feval, !NULL (printflag));
+  readevalloop (Fcurrent_buffer (), 0, Feval, !NILP (printflag));
   return unbind_to (count, Qnil);
 }
 
@@ -540,20 +540,20 @@
   int count = specpdl_ptr - specpdl;
   Lisp_Object tem;
 
-  if (NULL (printflag))
+  if (NILP (printflag))
     tem = Qsymbolp;
   else
     tem = printflag;
   specbind (Qstandard_output, tem);
 
-  if (NULL (printflag))
+  if (NILP (printflag))
     record_unwind_protect (save_excursion_restore, save_excursion_save ());
   record_unwind_protect (save_restriction_restore, save_restriction_save ());
 
   /* This both uses b and checks its type.  */
   Fgoto_char (b);
   Fnarrow_to_region (make_number (BEGV), e);
-  readevalloop (Fcurrent_buffer (), 0, Feval, !NULL (printflag));
+  readevalloop (Fcurrent_buffer (), 0, Feval, !NILP (printflag));
 
   return unbind_to (count, Qnil);
 }
@@ -575,7 +575,7 @@
 {
   extern Lisp_Object Fread_minibuffer ();
 
-  if (NULL (readcharfun))
+  if (NILP (readcharfun))
     readcharfun = Vstandard_input;
   if (EQ (readcharfun, Qt))
     readcharfun = Qread_char;
@@ -604,7 +604,7 @@
 
   CHECK_STRING (string,0);
 
-  if (NULL (end))
+  if (NILP (end))
     endval = XSTRING (string)->size;
   else
     { CHECK_NUMBER (end,2);
@@ -613,7 +613,7 @@
 	args_out_of_range (string, end);
     }
 
-  if (NULL (start))
+  if (NILP (start))
     startval = 0;
   else
     { CHECK_NUMBER (start,1);
@@ -659,7 +659,7 @@
   switch (c)
     {
     case 'a':
-      return '\a';
+      return '\007';
     case 'b':
       return '\b';
     case 'e':
@@ -859,7 +859,7 @@
 	/* If purifying, and string starts with \ newline,
 	   return zero instead.  This is for doc strings
 	   that we are really going to find in share-lib/DOC.nn.nn  */
-	if (!NULL (Vpurify_flag) && NULL (Vdoc_file_name) && cancel)
+	if (!NILP (Vpurify_flag) && NILP (Vdoc_file_name) && cancel)
 	  return make_number (0);
 
 	if (read_pure)
@@ -1060,7 +1060,7 @@
 	  if (XINT (elt) == '.')
 	    {
 	      GCPRO2 (val, tail);
-	      if (!NULL (tail))
+	      if (!NILP (tail))
 		XCONS (tail)->cdr = read0 (readcharfun);
 	      else
 		val = read0 (readcharfun);
@@ -1075,7 +1075,7 @@
       tem = (read_pure && flag <= 0
 	     ? pure_cons (elt, Qnil)
 	     : Fcons (elt, Qnil));
-      if (!NULL (tail))
+      if (!NILP (tail))
 	XCONS (tail)->cdr = tem;
       else
 	val = tem;
@@ -1120,7 +1120,7 @@
   tem = oblookup (obarray, str, len);
   if (XTYPE (tem) == Lisp_Symbol)
     return tem;
-  return Fintern ((!NULL (Vpurify_flag)
+  return Fintern ((!NILP (Vpurify_flag)
 		   ? make_pure_string (str, len)
 		   : make_string (str, len)),
 		  obarray);
@@ -1136,7 +1136,7 @@
 {
   register Lisp_Object tem, sym, *ptr;
 
-  if (NULL (obarray)) obarray = Vobarray;
+  if (NILP (obarray)) obarray = Vobarray;
   obarray = check_obarray (obarray);
 
   CHECK_STRING (str, 0);
@@ -1145,7 +1145,7 @@
   if (XTYPE (tem) != Lisp_Int)
     return tem;
 
-  if (!NULL (Vpurify_flag))
+  if (!NILP (Vpurify_flag))
     str = Fpurecopy (str);
   sym = Fmake_symbol (str);
 
@@ -1167,7 +1167,7 @@
 {
   register Lisp_Object tem;
 
-  if (NULL (obarray)) obarray = Vobarray;
+  if (NILP (obarray)) obarray = Vobarray;
   obarray = check_obarray (obarray);
 
   CHECK_STRING (str, 0);
@@ -1270,7 +1270,7 @@
 {
   Lisp_Object tem;
 
-  if (NULL (obarray)) obarray = Vobarray;
+  if (NILP (obarray)) obarray = Vobarray;
   obarray = check_obarray (obarray);
 
   map_obarray (obarray, mapatoms_1, function);
@@ -1452,11 +1452,11 @@
     }
 
   /* Warn if dirs in the *standard* path don't exist.  */
-  for (; !NULL (normal_path); normal_path = XCONS (normal_path)->cdr)
+  for (; !NILP (normal_path); normal_path = XCONS (normal_path)->cdr)
     {
       Lisp_Object dirfile;
       dirfile = Fcar (normal_path);
-      if (!NULL (dirfile))
+      if (!NILP (dirfile))
 	{
 	  dirfile = Fdirectory_file_name (dirfile);
 	  if (access (XSTRING (dirfile)->data, 0) < 0)
@@ -1468,7 +1468,7 @@
   if (egetenv ("EMACSLOADPATH"))
     Vload_path = decode_env_path ("EMACSLOADPATH", normal);
 #ifndef CANNOT_DUMP
-  if (!NULL (Vpurify_flag))
+  if (!NILP (Vpurify_flag))
     Vload_path = Fcons (build_string ("../lisp"), Vload_path);
 #endif
 
--- a/src/macros.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/macros.c	Mon Jan 13 21:48:08 1992 +0000
@@ -64,7 +64,7 @@
     error ("Already defining kbd macro");
 
   update_mode_lines++;
-  if (NULL (append))
+  if (NILP (append))
     {
       kbd_macro_ptr = kbd_macro_buffer;
       kbd_macro_end = kbd_macro_buffer;
@@ -97,7 +97,7 @@
   if (!defining_kbd_macro)
       error ("Not defining kbd macro.");
 
-  if (NULL (arg))
+  if (NILP (arg))
     XFASTINT (arg) = 1;
   else
     CHECK_NUMBER (arg, 0);
@@ -164,7 +164,7 @@
 {
   if (defining_kbd_macro)
     error ("Can't execute anonymous macro while defining one");
-  else if (NULL (Vlast_kbd_macro))
+  else if (NILP (Vlast_kbd_macro))
     error ("No kbd macro has been defined");
   else
     Fexecute_kbd_macro (Vlast_kbd_macro, prefix);
@@ -197,7 +197,7 @@
   int repeat = 1;
   struct gcpro gcpro1;
 
-  if (!NULL (prefixarg))
+  if (!NILP (prefixarg))
     prefixarg = Fprefix_numeric_value (prefixarg),
     repeat = XINT (prefixarg);
 
--- a/src/ralloc.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/ralloc.c	Mon Jan 13 21:48:08 1992 +0000
@@ -97,7 +97,7 @@
     }
 
     if (EXCEEDS_ELISP_PTR (address))
-      (*warnfunction) ("Warning: memory in use exceeds lisp pointer size");
+      memory_full ();
 }
 
 /* Obtain SIZE bytes of space.  If enough space is not presently available
--- a/src/sunfns.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/sunfns.c	Mon Jan 13 21:48:08 1992 +0000
@@ -107,7 +107,7 @@
   char *cp;
   static int already_initialized = 0;
 
-  if ((! already_initialized) || (!NULL(force))) {
+  if ((! already_initialized) || (!NILP(force))) {
     cp = getenv("WINDOW_GFX");
     if (cp != 0) win_fd = open(cp, 2);
     if (win_fd > 0)
@@ -213,7 +213,7 @@
   /*
    *	If the icon is null, we just restore the DefaultCursor
    */
-  if (NULL(Icon)) 
+  if (NILP(Icon)) 
     CurrentCursor = DefaultCursor;
   else {
     /*
--- a/src/syntax.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/syntax.c	Mon Jan 13 21:48:08 1992 +0000
@@ -46,7 +46,7 @@
 {
   register Lisp_Object tem;
   while (tem = Fsyntax_table_p (obj),
-	 NULL (tem))
+	 NILP (tem))
     obj = wrong_type_argument (Qsyntax_table_p, obj, 0);
   return obj;
 }   
@@ -79,9 +79,9 @@
   XFASTINT (size) = 0400;
   XFASTINT (val) = 0;
   val = Fmake_vector (size, val);
-  if (!NULL (table))
+  if (!NILP (table))
     table = check_syntax_table (table);
-  else if (NULL (Vstandard_syntax_table))
+  else if (NILP (Vstandard_syntax_table))
     /* Can only be null during initialization */
     return val;
   else table = Vstandard_syntax_table;
@@ -195,7 +195,7 @@
 
   CHECK_NUMBER (c, 0);
   CHECK_STRING (newentry, 1);
-  if (NULL (syntax_table))
+  if (NILP (syntax_table))
     syntax_table = current_buffer->syntax_table;
   else
     syntax_table = check_syntax_table (syntax_table);
@@ -899,7 +899,7 @@
   immediate_quit = 1;
   QUIT;
 
-  if (NULL (oldstate))
+  if (NILP (oldstate))
     {
       depth = 0;
       state.instring = -1;
@@ -908,7 +908,7 @@
   else
     {
       tem = Fcar (oldstate);
-      if (!NULL (tem))
+      if (!NILP (tem))
 	depth = XINT (tem);
       else
 	depth = 0;
@@ -917,15 +917,15 @@
       oldstate = Fcdr (oldstate);
       oldstate = Fcdr (oldstate);
       tem = Fcar (oldstate);
-      state.instring = !NULL (tem) ? XINT (tem) : -1;
+      state.instring = !NILP (tem) ? XINT (tem) : -1;
 
       oldstate = Fcdr (oldstate);
       tem = Fcar (oldstate);
-      state.incomment = !NULL (tem);
+      state.incomment = !NILP (tem);
 
       oldstate = Fcdr (oldstate);
       tem = Fcar (oldstate);
-      start_quoted = !NULL (tem);
+      start_quoted = !NILP (tem);
     }
   state.quoted = 0;
   mindepth = depth;
@@ -1125,7 +1125,7 @@
   struct lisp_parse_state state;
   int target;
 
-  if (!NULL (targetdepth))
+  if (!NILP (targetdepth))
     {
       CHECK_NUMBER (targetdepth, 3);
       target = XINT (targetdepth);
@@ -1135,7 +1135,7 @@
 
   validate_region (&from, &to);
   state = *scan_sexps_forward (XINT (from), XINT (to),
-			       target, !NULL (stopbefore), oldstate);
+			       target, !NILP (stopbefore), oldstate);
 
   SET_PT (state.location);
   
--- a/src/termhooks.h	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/termhooks.h	Mon Jan 13 21:48:08 1992 +0000
@@ -45,37 +45,30 @@
 
 extern int (*read_socket_hook) ();
 
-/* Hook for Emacs to call to tell the window-system-specific code to
-   enable/disable low-level tracking.  The value of ENABLE tells the
-   window system event handler whether it should notice or ignore
-   subsequent mouse movement and mouse button releases.
-
-   If this is 0, Emacs should assume that there is no mouse (or at
-   least no mouse tracking) available.
+/* Return the current position of the mouse.  This should clear
+   mouse_moved until the next motion event arrives.  */
+extern void (*mouse_position_hook) ( /* SCREEN_PTR *s,
+					Lisp_Object *x,
+					Lisp_Object *y,
+					Lisp_Object *time */ );
 
-   If called with ENABLE non-zero, the window system event handler
-   should call set_pointer_loc with the new mouse co-ordinates
-   whenever the mouse moves, and enqueue a mouse button event for
-   button releases as well as button presses.
-
-   If called with ENABLE zero, the window system event handler should
-   ignore mouse movement events, and not enqueue events for mouse
-   button releases.  */
-extern int (*mouse_tracking_enable_hook) ( /* int ENABLE */ );
+/* The window system handling code should set this if the mouse has
+   moved since the last call to the mouse_position_hook.  Calling that
+   hook should clear this.  */
+extern int mouse_moved;
 
 /* When a screen's focus redirection is changed, this hook tells the
    window system code to re-decide where to put the highlight.  Under
-   X, this means that the system lies about where the focus is.  */
+   X, this means that Emacs lies about where the focus is.  */
 extern void (*screen_rehighlight_hook) ( /* void */ );
 
 /* If nonzero, send all terminal output characters to this stream also.  */
-
 extern FILE *termscript;
 
-#ifdef XINT
 /* Expedient hack: only provide the below definitions to files that
    are prepared to handle lispy things.  XINT is defined iff lisp.h
-   has been included in the file before this file.  */
+   has been included before this file.  */
+#ifdef XINT
 
 /* The keyboard input buffer is an array of these structures.  Each one
    represents some sort of input event - a keystroke, a mouse click, or
@@ -93,8 +86,9 @@
 				   was typed.
 				   Note that this includes meta-keys, and
 				   the modifiers field of the event
-				   is unused.  */
-
+				   is unused.
+				   .timestamp gives a timestamp (in
+				   milliseconds) for the keystroke.  */
     non_ascii_keystroke,	/* .code is a number identifying the
 				   function key.  A code N represents
 				   a key whose name is
@@ -104,7 +98,9 @@
 				   .modifiers holds the state of the
 				   modifier keys.
 				   .screen is the screen in which the key
-				   was typed.  */
+				   was typed.
+				   .timestamp gives a timestamp (in
+				   milliseconds) for the keystroke.  */
     mouse_click,		/* The button number is in .code.
 				   .modifiers holds the state of the
 				   modifier keys.
--- a/src/undo.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/undo.c	Mon Jan 13 21:48:08 1992 +0000
@@ -127,7 +127,7 @@
   if (EQ (current_buffer->undo_list, Qt))
     return Qnil;
   tem = Fcar (current_buffer->undo_list);
-  if (!NULL (tem))
+  if (!NILP (tem))
     current_buffer->undo_list = Fcons (Qnil, current_buffer->undo_list);
   return Qnil;
 }
@@ -197,7 +197,7 @@
 	 either before or after it.  The lower threshold, MINSIZE,
 	 tells us to truncate after it.  If its size pushes past
 	 the higher threshold MAXSIZE as well, we truncate before it.  */
-      if (NULL (elt))
+      if (NILP (elt))
 	{
 	  if (size_so_far > maxsize)
 	    break;
@@ -222,11 +222,11 @@
     }
 
   /* If we scanned the whole list, it is short enough; don't change it.  */
-  if (NULL (next))
+  if (NILP (next))
     return list;
 
   /* Truncate at the boundary where we decided to truncate.  */
-  if (!NULL (last_boundary))
+  if (!NILP (last_boundary))
     {
       XCONS (last_boundary)->cdr = Qnil;
       return list;
@@ -249,7 +249,7 @@
   /* If the head of the list is a boundary, it is the boundary
      preceding this command.  Get rid of it and don't count it.  */
   tem = Fcar (list);
-  if (NULL (tem))
+  if (NILP (tem))
     list = Fcdr (list);
 #endif
 
@@ -260,7 +260,7 @@
 	  Lisp_Object next, car, cdr;
 	  next = Fcar (list);
 	  list = Fcdr (list);
-	  if (NULL (next))
+	  if (NILP (next))
 	    break;
 	  car = Fcar (next);
 	  cdr = Fcdr (next);
--- a/src/unexaix.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/unexaix.c	Mon Jan 13 21:48:08 1992 +0000
@@ -5,8 +5,8 @@
   when Emacs was dumped, the dumped data won't work.
   No one has been able to prevent the address from varying.
 
-  The following comments should be in etc/MACHINES if this dumping
-  is ever made to work:
+  The following comments should be in share-lib/MACHINES if this
+  dumping is ever made to work:
 
   Note that Emacs can store the pure Lisp data in a shared segment on
   this machine, but only if you put this command in one of the boot
--- a/src/unexec.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/unexec.c	Mon Jan 13 21:48:08 1992 +0000
@@ -74,6 +74,13 @@
 * COFF
 
 Define this if your system uses COFF for executables.
+
+* COFF_ENCAPSULATE
+
+Define this if you are using the GNU coff encapsulated a.out format.
+This is closer to a.out than COFF. You should *not* define COFF if
+you define COFF_ENCAPSULATE
+
 Otherwise we assume you use Berkeley format.
 
 * NO_REMAP
@@ -165,7 +172,13 @@
 
 #ifndef CANNOT_UNEXEC /* most of rest of file */
 
+#ifdef COFF_ENCAPSULATE
+int need_coff_header = 1;
+#include <coff-encap/a.out.encap.h> /* The location might be a poor assumption */
+#else
 #include <a.out.h>
+#endif
+
 /* Define getpagesize () if the system does not.
    Note that this may depend on symbols defined in a.out.h
  */
@@ -173,7 +186,7 @@
 
 #ifndef makedev			/* Try to detect types.h already loaded */
 #include <sys/types.h>
-#endif
+#endif /* makedev */
 #include <stdio.h>
 #include <sys/stat.h>
 #include <errno.h>
@@ -218,7 +231,7 @@
 
 #else /* not HPUX */
 
-#if defined (USG) && !defined (IBMAIX) && !defined (IRIS)
+#if defined (USG) && !defined (IBMAIX) && !defined (IRIS) && !defined (COFF_ENCAPSULATE)
 static struct bhdr hdr, ohdr;
 #define a_magic fmagic
 #define a_text tsize
@@ -241,6 +254,11 @@
 static int unexec_text_start;
 static int unexec_data_start;
 
+#ifdef COFF_ENCAPSULATE
+/* coffheader is defined in the GNU a.out.encap.h file.  */
+struct coffheader coffheader;
+#endif
+
 #endif /* not COFF */
 
 static int pagemask;
@@ -624,6 +642,16 @@
   /* Get symbol table info from header of a.out file if given one. */
   if (a_out >= 0)
     {
+#ifdef COFF_ENCAPSULATE
+      if (read (a_out, &coffheader, sizeof coffheader) != sizeof coffheader)
+	{
+	  PERROR(a_name);
+	}
+      if (coffheader.f_magic != COFF_MAGIC)
+	{
+	  ERROR1("%s doesn't have legal coff magic number\n", a_name);
+	}
+#endif
       if (read (a_out, &ohdr, sizeof hdr) != sizeof hdr)
 	{
 	  PERROR (a_name);
@@ -637,7 +665,14 @@
     }
   else
     {
+#ifdef COFF_ENCAPSULATE
+      /* We probably could without too much trouble. The code is in gld
+       * but I don't have that much time or incentive.
+       */
+      ERROR0 ("can't build a COFF file from scratch yet");
+#else
       bzero (hdr, sizeof hdr);
+#endif
     }
 
   unexec_text_start = (long) start_of_text ();
@@ -666,6 +701,32 @@
 
 #endif /* not NO_REMAP */
 
+#ifdef COFF_ENCAPSULATE
+  /* We are encapsulating BSD format within COFF format.  */
+  {
+    struct coffscn *tp, *dp, *bp;
+    tp = &coffheader.scns[0];
+    dp = &coffheader.scns[1];
+    bp = &coffheader.scns[2];
+    tp->s_size = hdr.a_text + sizeof(struct exec);
+    dp->s_paddr = data_start;
+    dp->s_vaddr = data_start;
+    dp->s_size = hdr.a_data;
+    bp->s_paddr = dp->s_vaddr + dp->s_size;
+    bp->s_vaddr = bp->s_paddr;
+    bp->s_size = hdr.a_bss;
+    coffheader.tsize = tp->s_size;
+    coffheader.dsize = dp->s_size;
+    coffheader.bsize = bp->s_size;
+    coffheader.text_start = tp->s_vaddr;
+    coffheader.data_start = dp->s_vaddr;
+  }
+  if (write (new, &coffheader, sizeof coffheader) != sizeof coffheader)
+    {
+      PERROR(new_name);
+    }
+#endif /* COFF_ENCAPSULATE */
+
   if (write (new, &hdr, sizeof hdr) != sizeof hdr)
     {
       PERROR (new_name);
--- a/src/window.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/window.c	Mon Jan 13 21:48:08 1992 +0000
@@ -182,7 +182,7 @@
   register struct buffer *buf;
   struct position posval;
 
-  if (NULL (pos))
+  if (NILP (pos))
     posint = point;
   else
     {
@@ -190,7 +190,7 @@
       posint = XINT (pos);
     }
 
-  if (NULL (window))
+  if (NILP (window))
     window = selected_window;
   else
     CHECK_WINDOW (window, 1);
@@ -232,7 +232,7 @@
 decode_window (window)
      register Lisp_Object window;
 {
-  if (NULL (window))
+  if (NILP (window))
     return XWINDOW (selected_window);
 
   CHECK_WINDOW (window, 0);
@@ -433,7 +433,7 @@
 {
   int part;
 
-  if (NULL (screen))
+  if (NILP (screen))
     XSET (screen, Lisp_Screen, selected_screen);
   else
     CHECK_LIVE_SCREEN (screen, 0);
@@ -519,7 +519,7 @@
   set_marker_restricted (w->start, pos, w->buffer);
   /* this is not right, but much easier than doing what is right. */
   w->start_at_line_beg = Qnil;
-  if (NULL (noforce))
+  if (NILP (noforce))
     w->force_start = Qt;
   w->update_mode_line = Qt;
   XFASTINT (w->last_modified) = 0;
@@ -549,7 +549,7 @@
 {
   register struct window *w = decode_window (window);
 
-  if (NULL (arg))
+  if (NILP (arg))
     w->dedicated = Qnil;
   else
     {
@@ -652,15 +652,15 @@
   p->height = o->height;
 
   p->next = tem = o->next;
-  if (!NULL (tem))
+  if (!NILP (tem))
     XWINDOW (tem)->prev = replacement;
 
   p->prev = tem = o->prev;
-  if (!NULL (tem))
+  if (!NILP (tem))
     XWINDOW (tem)->next = replacement;
 
   p->parent = tem = o->parent;
-  if (!NULL (tem))
+  if (!NILP (tem))
     {
       if (EQ (XWINDOW (tem)->vchild, old))
 	XWINDOW (tem)->vchild = replacement;
@@ -682,14 +682,14 @@
   register struct window *p;
   register struct window *par;
 
-  if (NULL (window))
+  if (NILP (window))
     window = selected_window;
   else
     CHECK_WINDOW (window, 0);
 
   p = XWINDOW (window);
   parent = p->parent;
-  if (NULL (parent))
+  if (NILP (parent))
     error ("Attempt to delete minibuffer or sole ordinary window");
   par = XWINDOW (parent);
 
@@ -701,7 +701,7 @@
   tem = p->buffer;
   /* tem is null for dummy parent windows
      (which have inferiors but not any contents themselves) */
-  if (!NULL (tem))
+  if (!NILP (tem))
     {
       unshow_buffer (p);
       unchain_marker (p->pointm);
@@ -710,11 +710,11 @@
     }
 
   tem = p->next;
-  if (!NULL (tem))
+  if (!NILP (tem))
     XWINDOW (tem)->prev = p->prev;
 
   tem = p->prev;
-  if (!NULL (tem))
+  if (!NILP (tem))
     XWINDOW (tem)->next = p->next;
 
   if (EQ (window, par->hchild))
@@ -724,7 +724,7 @@
 
   /* Find one of our siblings to give our space to.  */
   sib = p->prev;
-  if (NULL (sib))
+  if (NILP (sib))
     {
       /* If p gives its space to its next sibling, that sibling needs
 	 to have its top/left side pulled back to where p's is.
@@ -736,11 +736,11 @@
     }
 
   /* Stretch that sibling.  */
-  if (!NULL (par->vchild))
+  if (!NILP (par->vchild))
     set_window_height (sib,
 		       XFASTINT (XWINDOW (sib)->height) + XFASTINT (p->height),
 		       1);
-  if (!NULL (par->hchild))
+  if (!NILP (par->hchild))
     set_window_width (sib,
 		      XFASTINT (XWINDOW (sib)->width) + XFASTINT (p->width),
 		      1);
@@ -749,9 +749,9 @@
      put the child into the parent's place.  */
 
   tem = par->hchild;
-  if (NULL (tem))
+  if (NILP (tem))
     tem = par->vchild;
-  if (NULL (XWINDOW (tem)->next))
+  if (NILP (XWINDOW (tem)->next))
     replace_window (parent, tem);
   return Qnil;
 }
@@ -783,7 +783,7 @@
   register Lisp_Object tem;
   Lisp_Object start_window;
 
-  if (NULL (window))
+  if (NILP (window))
     window = selected_window;
   else
     CHECK_WINDOW (window, 0);
@@ -792,12 +792,12 @@
 
   /* minibuf == nil may or may not include minibuffers.
      Decide if it does.  */
-  if (NULL (minibuf))
+  if (NILP (minibuf))
     minibuf = (minibuf_level ? Qt : Qlambda);
 
   /* all_screens == nil doesn't specify which screens to include.
      Decide which screens it includes.  */
-  if (NULL (all_screens))
+  if (NILP (all_screens))
     all_screens = (EQ (minibuf, Qt)
 		   ? (SCREEN_MINIBUF_WINDOW
 		      (XSCREEN
@@ -813,8 +813,8 @@
     {
       /* Find a window that actually has a next one.  This loop
 	 climbs up the tree.  */
-      while (tem = XWINDOW (window)->next, NULL (tem))
-	if (tem = XWINDOW (window)->parent, !NULL (tem))
+      while (tem = XWINDOW (window)->next, NILP (tem))
+	if (tem = XWINDOW (window)->parent, !NILP (tem))
 	  window = tem;
 	else
 	  {
@@ -822,7 +822,7 @@
 	       Which other screens are acceptable?  */
 	    tem = WINDOW_SCREEN (XWINDOW (window));
 #ifdef MULTI_SCREEN
-	    if (! NULL (all_screens))
+	    if (! NILP (all_screens))
 	      tem = next_screen (tem, all_screens);
 #endif
 	    tem = SCREEN_ROOT_WINDOW (XSCREEN (tem));
@@ -836,9 +836,9 @@
 	 recurse on that.  Otherwise, we've found the window we want.  */
       while (1)
 	{
-	  if (!NULL (XWINDOW (window)->hchild))
+	  if (!NILP (XWINDOW (window)->hchild))
 	    window = XWINDOW (window)->hchild;
-	  else if (!NULL (XWINDOW (window)->vchild))
+	  else if (!NILP (XWINDOW (window)->vchild))
 	    window = XWINDOW (window)->vchild;
 	  else break;
 	}
@@ -880,7 +880,7 @@
   register Lisp_Object tem;
   Lisp_Object start_window;
 
-  if (NULL (window))
+  if (NILP (window))
     window = selected_window;
   else
     CHECK_WINDOW (window, 0);
@@ -889,12 +889,12 @@
 
   /* minibuf == nil may or may not include minibuffers.
      Decide if it does.  */
-  if (NULL (minibuf))
+  if (NILP (minibuf))
     minibuf = (minibuf_level ? Qt : Qlambda);
 
   /* all_screens == nil doesn't specify which screens to include.
      Decide which screens it includes.  */
-  if (NULL (all_screens))
+  if (NILP (all_screens))
     all_screens = (EQ (minibuf, Qt)
 		   ? (SCREEN_MINIBUF_WINDOW
 		      (XSCREEN
@@ -910,8 +910,8 @@
     {
       /* Find a window that actually has a previous one.  This loop
 	 climbs up the tree.  */
-      while (tem = XWINDOW (window)->prev, NULL (tem))
-	if (tem = XWINDOW (window)->parent, !NULL (tem))
+      while (tem = XWINDOW (window)->prev, NILP (tem))
+	if (tem = XWINDOW (window)->parent, !NILP (tem))
 	  window = tem;
 	else
 	  {
@@ -919,7 +919,7 @@
 	       Which screens are acceptable?  */
 	    tem = WINDOW_SCREEN (XWINDOW (window));
 #ifdef MULTI_SCREEN
-	    if (! NULL (all_screens))
+	    if (! NILP (all_screens))
 	      tem = next_screen (tem, all_screens);
 #endif
 	    tem = SCREEN_ROOT_WINDOW (XSCREEN (tem));
@@ -932,12 +932,12 @@
 	 recurse on that.  Otherwise, we've found the window we want.  */
       while (1)
 	{
-	  if (!NULL (XWINDOW (window)->hchild))
+	  if (!NILP (XWINDOW (window)->hchild))
 	    window = XWINDOW (window)->hchild;
-	  else if (!NULL (XWINDOW (window)->vchild))
+	  else if (!NILP (XWINDOW (window)->vchild))
 	    window = XWINDOW (window)->vchild;
 	  else break;
-	  while (tem = XWINDOW (window)->next, !NULL (tem))
+	  while (tem = XWINDOW (window)->next, !NILP (tem))
 	    window = tem;
 	}
     }
@@ -1018,7 +1018,7 @@
      on all screens, screen is 0.  */
   if (SCREENP (screens))
     screen = XSCREEN (screens);
-  else if (NULL (screens))
+  else if (NILP (screens))
     screen = selected_screen;
   else
     screen = 0;
@@ -1063,7 +1063,7 @@
 
 	  case GET_LRU_WINDOW:
 	    /* t as arg means consider only full-width windows */
-	    if (!NULL (obj) && XFASTINT (XWINDOW (w)->width) != screen->width)
+	    if (!NILP (obj) && XFASTINT (XWINDOW (w)->width) != screen->width)
 	      break;
 #if 0
 	    /* Ignore invisible and iconified screens.  */
@@ -1073,9 +1073,9 @@
 #endif
 	    /* Ignore dedicated windows and minibuffers.  */
 	    if (MINI_WINDOW_P (XWINDOW (w))
-		|| !NULL (XWINDOW (w)->dedicated))
+		|| !NILP (XWINDOW (w)->dedicated))
 	      break;
-	    if (NULL (best_window)
+	    if (NILP (best_window)
 		|| (XFASTINT (XWINDOW (best_window)->use_time)
 		    > XFASTINT (XWINDOW (w)->use_time)))
 	      best_window = w;
@@ -1091,10 +1091,10 @@
 	      {
 		/* If we're deleting the buffer displayed in the only window
 		   on the screen, find a new buffer to display there.  */
-		if (NULL (XWINDOW (w)->parent))
+		if (NILP (XWINDOW (w)->parent))
 		  {
 		    Lisp_Object new_buffer = Fother_buffer (obj);
-		    if (NULL (new_buffer))
+		    if (NILP (new_buffer))
 		      new_buffer
 			= Fget_buffer_create (build_string ("*scratch*"));
 		    Fset_window_buffer (w, new_buffer);
@@ -1114,12 +1114,12 @@
 #endif
 	    /* Ignore dedicated windows and minibuffers.  */
 	    if (MINI_WINDOW_P (XWINDOW (w))
-		|| !NULL (XWINDOW (w)->dedicated))
+		|| !NILP (XWINDOW (w)->dedicated))
 	      break;
 	    {
 	      struct window *best_window_ptr = XWINDOW (best_window);
 	      struct window *w_ptr = XWINDOW (w);
-	      if (NULL (best_window) ||
+	      if (NILP (best_window) ||
 		  (XFASTINT (w_ptr->height) * XFASTINT (w_ptr->width))
 		  > (XFASTINT (best_window_ptr->height)
 		     * XFASTINT (best_window_ptr->width)))
@@ -1132,7 +1132,7 @@
 	      {
 		/* Find another buffer to show in this window.  */
 		Lisp_Object another_buffer = Fother_buffer (obj);
-		if (NULL (another_buffer))
+		if (NILP (another_buffer))
 		  another_buffer
 		    = Fget_buffer_create (build_string ("*scratch*"));
 		Fset_window_buffer (w, another_buffer);
@@ -1158,7 +1158,7 @@
   register Lisp_Object w;
   /* First try for a window that is full-width */
   w = window_loop (GET_LRU_WINDOW, Qt, 0, screens);
-  if (!NULL (w) && !EQ (w, selected_window))
+  if (!NILP (w) && !EQ (w, selected_window))
     return w;
   /* If none of them, try the rest */
   return window_loop (GET_LRU_WINDOW, Qnil, 0, screens);
@@ -1201,7 +1201,7 @@
   struct buffer *obuf = current_buffer;
   int top;
 
-  if (NULL (window))
+  if (NILP (window))
     window = selected_window;
   else
     CHECK_WINDOW (window, 0);
@@ -1226,7 +1226,7 @@
   (buffer)
      Lisp_Object buffer;
 {
-  if (!NULL (buffer))
+  if (!NILP (buffer))
     {
       buffer = Fget_buffer (buffer);
       CHECK_BUFFER (buffer, 0);
@@ -1242,7 +1242,7 @@
   (buffer)
      Lisp_Object buffer;
 {
-  if (!NULL (buffer))
+  if (!NILP (buffer))
     {
       buffer = Fget_buffer (buffer);
       CHECK_BUFFER (buffer, 0);
@@ -1268,7 +1268,7 @@
   Lisp_Object child;
 
   if (!nodelete
-      && ! NULL (w->parent)
+      && ! NILP (w->parent)
       && height < window_min_height)
     {
       Fdelete_window (window);
@@ -1278,19 +1278,19 @@
   XFASTINT (w->last_modified) = 0;
   windows_or_buffers_changed++;
   XFASTINT (w->height) = height;
-  if (!NULL (w->hchild))
+  if (!NILP (w->hchild))
     {
-      for (child = w->hchild; !NULL (child); child = XWINDOW (child)->next)
+      for (child = w->hchild; !NILP (child); child = XWINDOW (child)->next)
 	{
 	  XWINDOW (child)->top = w->top;
 	  set_window_height (child, height, nodelete);
 	}
     }
-  else if (!NULL (w->vchild))
+  else if (!NILP (w->vchild))
     {
       lastbot = top = XFASTINT (w->top);
       lastobot = 0;
-      for (child = w->vchild; !NULL (child); child = c->next)
+      for (child = w->vchild; !NILP (child); child = c->next)
 	{
 	  c = XWINDOW (child);
 
@@ -1310,7 +1310,7 @@
 	}
       /* Now delete any children that became too small.  */
       if (!nodelete)
-	for (child = w->vchild; !NULL (child); child = XWINDOW (child)->next)
+	for (child = w->vchild; !NILP (child); child = XWINDOW (child)->next)
 	  {
 	    set_window_height (child, XINT (XWINDOW (child)->height), 0);
 	  }
@@ -1339,19 +1339,19 @@
   XFASTINT (w->last_modified) = 0;
   windows_or_buffers_changed++;
   XFASTINT (w->width) = width;
-  if (!NULL (w->vchild))
+  if (!NILP (w->vchild))
     {
-      for (child = w->vchild; !NULL (child); child = XWINDOW (child)->next)
+      for (child = w->vchild; !NILP (child); child = XWINDOW (child)->next)
 	{
 	  XWINDOW (child)->left = w->left;
 	  set_window_width (child, width, nodelete);
 	}
     }
-  else if (!NULL (w->hchild))
+  else if (!NILP (w->hchild))
     {
       lastright = left = XFASTINT (w->left);
       lastoright = 0;
-      for (child = w->hchild; !NULL (child); child = c->next)
+      for (child = w->hchild; !NILP (child); child = c->next)
 	{
 	  c = XWINDOW (child);
 
@@ -1370,7 +1370,7 @@
 	}
       /* Delete children that became too small */
       if (!nodelete)
-	for (child = w->hchild; !NULL (child); child = XWINDOW (child)->next)
+	for (child = w->hchild; !NILP (child); child = XWINDOW (child)->next)
 	  {
 	    set_window_width (child, XINT (XWINDOW (child)->width), 0);
 	  }
@@ -1391,16 +1391,16 @@
   buffer = Fget_buffer (buffer);
   CHECK_BUFFER (buffer, 1);
 
-  if (NULL (XBUFFER (buffer)->name))
+  if (NILP (XBUFFER (buffer)->name))
     error ("Attempt to display deleted buffer");
 
   tem = w->buffer;
-  if (NULL (tem))
+  if (NILP (tem))
     error ("Window is deleted");
   else if (! EQ (tem, Qt))	/* w->buffer is t when the window
 				   is first being set up.  */
     {
-      if (!NULL (w->dedicated) && !EQ (tem, buffer))
+      if (!NILP (w->dedicated) && !EQ (tem, buffer))
 	error ("Window is dedicated to %s\n", tem);
 
       unshow_buffer (w);
@@ -1436,7 +1436,7 @@
 
   w = XWINDOW (window);
 
-  if (NULL (w->buffer))
+  if (NILP (w->buffer))
     error ("Trying to select deleted window or non-leaf window");
 
   XFASTINT (w->use_time) = ++window_select_count;
@@ -1494,16 +1494,16 @@
   buffer = Fget_buffer (buffer);
   CHECK_BUFFER (buffer, 0);
 
-  if (!NULL (Vdisplay_buffer_function))
+  if (!NILP (Vdisplay_buffer_function))
     return call2 (Vdisplay_buffer_function, buffer, not_this_window);
 
-  if (NULL (not_this_window)
+  if (NILP (not_this_window)
       && XBUFFER (XWINDOW (selected_window)->buffer) == XBUFFER (buffer))
     return selected_window;
 
   window = Fget_buffer_window (buffer, Qnil);
-  if (!NULL (window)
-      && (NULL (not_this_window) || !EQ (window, selected_window)))
+  if (!NILP (window)
+      && (NILP (not_this_window) || !EQ (window, selected_window)))
     return window;
 
 #ifdef MULTI_SCREEN
@@ -1539,7 +1539,7 @@
 
       window = Fget_largest_window (screens);
 
-      if (!NULL (window)
+      if (!NILP (window)
 	  && window_height (window) >= split_height_threshold
 	  &&
 	  (XFASTINT (XWINDOW (window)->width)
@@ -1637,16 +1637,16 @@
   register struct window *o, *p;
   register int size;
 
-  if (NULL (window))
+  if (NILP (window))
     window = selected_window;
   else
     CHECK_WINDOW (window, 0);
 
   o = XWINDOW (window);
 
-  if (NULL (chsize))
+  if (NILP (chsize))
     {
-      if (!NULL (horflag))
+      if (!NILP (horflag))
 	/* Round odd size up, since this is for the left-hand window,
 	   and it will lose a column for the separators.  */
 	size = ((XFASTINT (o->width) + 1) & -2) >> 1;
@@ -1670,13 +1670,13 @@
   if (window_min_height < 2)
     window_min_height = 2;
 
-  if (NULL (horflag))
+  if (NILP (horflag))
     {
       if (size < window_min_height
 	  || size + window_min_height > XFASTINT (o->height))
 	args_out_of_range_3 (window, chsize, horflag);
-      if (NULL (o->parent)
-	  || NULL (XWINDOW (o->parent)->vchild))
+      if (NILP (o->parent)
+	  || NILP (XWINDOW (o->parent)->vchild))
 	{
 	  make_dummy_parent (window);
 	  new = o->parent;
@@ -1688,8 +1688,8 @@
       if (size < window_min_width
 	  || size + window_min_width > XFASTINT (o->width))
 	args_out_of_range_3 (window, chsize, horflag);
-      if (NULL (o->parent)
-	  || NULL (XWINDOW (o->parent)->hchild))
+      if (NILP (o->parent)
+	  || NILP (XWINDOW (o->parent)->hchild))
 	{
 	  make_dummy_parent (window);
 	  new = o->parent;
@@ -1707,7 +1707,7 @@
 
   p->screen = o->screen;
   p->next = o->next;
-  if (!NULL (p->next))
+  if (!NILP (p->next))
     XWINDOW (p->next)->prev = new;
   p->prev = window;
   o->next = new;
@@ -1718,7 +1718,7 @@
 
   /* Apportion the available screen space among the two new windows */
 
-  if (!NULL (horflag))
+  if (!NILP (horflag))
     {
       p->height = o->height;
       p->top = o->top;
@@ -1745,7 +1745,7 @@
      register Lisp_Object n, side;
 {
   CHECK_NUMBER (n, 0);
-  change_window_height (XINT (n), !NULL (side));
+  change_window_height (XINT (n), !NILP (side));
   return Qnil;
 }
 
@@ -1756,7 +1756,7 @@
      register Lisp_Object n, side;
 {
   CHECK_NUMBER (n, 0);
-  change_window_height (-XINT (n), !NULL (side));
+  change_window_height (-XINT (n), !NILP (side));
   return Qnil;
 }
 
@@ -1813,14 +1813,14 @@
     {
       p = XWINDOW (window);
       parent = p->parent;
-      if (NULL (parent))
+      if (NILP (parent))
 	{
 	  if (widthflag)
 	    error ("No other window to side of this one");
 	  break;
 	}
-      if (widthflag ? !NULL (XWINDOW (parent)->hchild)
-	  : !NULL (XWINDOW (parent)->vchild))
+      if (widthflag ? !NILP (XWINDOW (parent)->hchild)
+	  : !NILP (XWINDOW (parent)->vchild))
 	break;
       window = parent;
     }
@@ -1828,7 +1828,7 @@
   sizep = &CURSIZE (p);
 
   if (*sizep + delta < MINSIZE (p)
-      && !NULL (XWINDOW (window)->parent))
+      && !NILP (XWINDOW (window)->parent))
     {
       Fdelete_window (window);
       return;
@@ -1837,9 +1837,9 @@
   {
     register int maxdelta;
 
-    maxdelta = (!NULL (parent) ? (*sizefun) (parent) - *sizep
-		: !NULL (p->next) ? (*sizefun) (p->next) - MINSIZE (p->next)
-		: !NULL (p->prev) ? (*sizefun) (p->prev) - MINSIZE (p->prev)
+    maxdelta = (!NILP (parent) ? (*sizefun) (parent) - *sizep
+		: !NILP (p->next) ? (*sizefun) (p->next) - MINSIZE (p->next)
+		: !NILP (p->prev) ? (*sizefun) (p->prev) - MINSIZE (p->prev)
 		/* This is a screen with only one window, a minibuffer-only
 		   or a minibufferless screen.  */
 		: (delta = 0));
@@ -1854,7 +1854,7 @@
       return;
   }
 
-  if (!NULL (p->next) &&
+  if (!NILP (p->next) &&
       (*sizefun) (p->next) - delta >= MINSIZE (p->next))
     {
       (*setsizefun) (p->next, (*sizefun) (p->next) - delta, 0);
@@ -1864,7 +1864,7 @@
 	 but it propagates the new top edge to its children */
       (*setsizefun) (p->next, (*sizefun) (p->next), 0);
     }
-  else if (!NULL (p->prev) &&
+  else if (!NILP (p->prev) &&
 	   (*sizefun) (p->prev) - delta >= MINSIZE (p->prev))
     {
       (*setsizefun) (p->prev, (*sizefun) (p->prev) - delta, 0);
@@ -1919,8 +1919,8 @@
   if (MINI_WINDOW_P (w))
     return ht;
 
-  if (!NULL (w->parent) || !NULL (w->vchild) || !NULL (w->hchild)
-      || !NULL (w->next) || !NULL (w->prev)
+  if (!NILP (w->parent) || !NILP (w->vchild) || !NILP (w->hchild)
+      || !NILP (w->next) || !NILP (w->prev)
       || SCREEN_WANTS_MODELINE_P (XSCREEN (WINDOW_SCREEN (w))))
     return ht - 1;
 
@@ -1945,7 +1945,7 @@
   XFASTINT (tem) = point;
   tem = Fpos_visible_in_window_p (tem, window);
 
-  if (NULL (tem))
+  if (NILP (tem))
     {
       Fvertical_motion (make_number (- ht / 2));
       XFASTINT (tem) = point;
@@ -2012,7 +2012,7 @@
 	    - next_screen_context_lines);
   defalt = direction * (defalt < 1 ? 1 : defalt);
 
-  if (NULL (n))
+  if (NILP (n))
     window_scroll (selected_window, defalt);
   else if (EQ (n, Qminus))
     window_scroll (selected_window, - defalt);
@@ -2066,13 +2066,13 @@
   register int count = specpdl_ptr - specpdl;
 
   if (MINI_WINDOW_P (XWINDOW (selected_window))
-      && !NULL (Vminibuf_scroll_window))
+      && !NILP (Vminibuf_scroll_window))
     window = Vminibuf_scroll_window;
   /* If buffer is specified, scroll that buffer.  */
-  else if (!NULL (Vother_window_scroll_buffer))
+  else if (!NILP (Vother_window_scroll_buffer))
     {
       window = Fget_buffer_window (Vother_window_scroll_buffer, Qnil);
-      if (NULL (window))
+      if (NILP (window))
 	window = Fdisplay_buffer (Vother_window_scroll_buffer, Qt);
     }
   else
@@ -2092,7 +2092,7 @@
   Fset_buffer (w->buffer);
   SET_PT (marker_position (w->pointm));
 
-  if (NULL (n))
+  if (NILP (n))
     window_scroll (window, ht - next_screen_context_lines);
   else if (EQ (n, Qminus))
     window_scroll (window, next_screen_context_lines - ht);
@@ -2117,7 +2117,7 @@
      register Lisp_Object arg;
 {
 
-  if (NULL (arg))
+  if (NILP (arg))
     XFASTINT (arg) = XFASTINT (XWINDOW (selected_window)->width) - 2;
   else
     arg = Fprefix_numeric_value (arg);
@@ -2134,7 +2134,7 @@
   (arg)
      register Lisp_Object arg;
 {
-  if (NULL (arg))
+  if (NILP (arg))
     XFASTINT (arg) = XFASTINT (XWINDOW (selected_window)->width) - 2;
   else
     arg = Fprefix_numeric_value (arg);
@@ -2158,7 +2158,7 @@
   register int ht = window_internal_height (w);
   register int opoint = point;
 
-  if (NULL (n))
+  if (NILP (n))
     {
       extern int screen_garbaged;
 
@@ -2203,7 +2203,7 @@
   register int height = window_internal_height (w);
   register int start;
 
-  if (NULL (arg))
+  if (NILP (arg))
     XFASTINT (arg) = height / 2;
   else
     {
@@ -2310,7 +2310,7 @@
 
   windows_or_buffers_changed++;
   new_current_buffer = data->current_buffer;
-  if (NULL (XBUFFER (new_current_buffer)->name))
+  if (NILP (XBUFFER (new_current_buffer)->name))
     new_current_buffer = Qnil;
 
   /* Mark all windows now on screen as "deleted".
@@ -2328,12 +2328,12 @@
       w = XWINDOW (p->window);
       w->next = Qnil;
 
-      if (!NULL (p->parent))
+      if (!NILP (p->parent))
 	w->parent = SAVED_WINDOW_N (saved_windows, XFASTINT (p->parent))->window;
       else
 	w->parent = Qnil;
 
-      if (!NULL (p->prev))
+      if (!NILP (p->prev))
 	{
 	  w->prev = SAVED_WINDOW_N (saved_windows, XFASTINT (p->prev))->window;
 #ifdef MULTI_SCREEN
@@ -2347,7 +2347,7 @@
       else
 	{
 	  w->prev = Qnil;
-	  if (!NULL (w->parent))
+	  if (!NILP (w->parent))
 	    {
 	      if (EQ (p->width, XWINDOW (w->parent)->width))
 		{
@@ -2370,11 +2370,11 @@
       XFASTINT (w->last_modified) = 0;
 
       /* Reinstall the saved buffer and pointers into it.  */
-      if (NULL (p->buffer))
+      if (NILP (p->buffer))
 	w->buffer = p->buffer;
       else
 	{
-	  if (!NULL (XBUFFER (p->buffer)->name))
+	  if (!NILP (XBUFFER (p->buffer)->name))
 	    /* If saved buffer is alive, install it.  */
 	    {
 	      w->buffer = p->buffer;
@@ -2388,7 +2388,7 @@
 		  XBUFFER (p->buffer) == current_buffer)
 		Fgoto_char (w->pointm);
 	    }
-	  else if (NULL (XBUFFER (w->buffer)->name))
+	  else if (NILP (XBUFFER (w->buffer)->name))
 	    /* Else if window's old buffer is dead too, get a live one.  */
 	    {
 	      w->buffer = Fcdr (Fcar (Vbuffer_alist));
@@ -2423,7 +2423,7 @@
   if (s == selected_screen)
     {
       Fselect_window (data->current_window);
-      if (!NULL (new_current_buffer))
+      if (!NILP (new_current_buffer))
 	Fset_buffer (new_current_buffer);
       else
 	Fset_buffer (XWINDOW (selected_window)->buffer);
@@ -2442,11 +2442,11 @@
 {
   register int count = 1;
   w->buffer = Qnil;
-  if (!NULL (w->next))
+  if (!NILP (w->next))
     delete_all_subwindows (XWINDOW (w->next));
-  if (!NULL (w->vchild))
+  if (!NILP (w->vchild))
     delete_all_subwindows (XWINDOW (w->vchild));
-  if (!NULL (w->hchild))
+  if (!NILP (w->hchild))
     delete_all_subwindows (XWINDOW (w->hchild));
 }
 
@@ -2455,11 +2455,11 @@
      register struct window *window;
 {
   register int count = 1;
-  if (!NULL (window->next))
+  if (!NILP (window->next))
     count += count_windows (XWINDOW (window->next));
-  if (!NULL (window->vchild))
+  if (!NILP (window->vchild))
     count += count_windows (XWINDOW (window->vchild));
-  if (!NULL (window->hchild))
+  if (!NILP (window->hchild))
     count += count_windows (XWINDOW (window->hchild));
   return count;
 }
@@ -2474,7 +2474,7 @@
   register struct window *w;
   register Lisp_Object tem;
 
-  for (;!NULL (window); window = w->next)
+  for (;!NILP (window); window = w->next)
     {
       p = SAVED_WINDOW_N (vector, i);
       w = XWINDOW (window);
@@ -2488,7 +2488,7 @@
       p->height = w->height;
       p->hscroll = w->hscroll;
       p->display_table = w->display_table;
-      if (!NULL (w->buffer))
+      if (!NILP (w->buffer))
 	{
 	  /* Save w's value of point in the window configuration.
 	     If w is the selected window, then get the value of point
@@ -2516,19 +2516,19 @@
 	  p->start_at_line_beg = Qnil;
 	}
 
-      if (NULL (w->parent))
+      if (NILP (w->parent))
 	p->parent = Qnil;
       else
 	p->parent = XWINDOW (w->parent)->temslot;
 
-      if (NULL (w->prev))
+      if (NILP (w->prev))
 	p->prev = Qnil;
       else
 	p->prev = XWINDOW (w->prev)->temslot;
 
-      if (!NULL (w->vchild))
+      if (!NILP (w->vchild))
 	i = save_window_save (w->vchild, vector, i);
-      if (!NULL (w->hchild))
+      if (!NILP (w->hchild))
 	i = save_window_save (w->hchild, vector, i);
     }
 
@@ -2552,7 +2552,7 @@
   register int i;
   SCREEN_PTR s;
 
-  if (NULL (screen))
+  if (NILP (screen))
     s = selected_screen;
   else
     {
--- a/src/xdisp.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/xdisp.c	Mon Jan 13 21:48:08 1992 +0000
@@ -221,18 +221,20 @@
       Fmake_screen_visible (WINDOW_SCREEN (XWINDOW (minibuf_window)));
 #endif
 
+      {
 #ifdef NO_ARG_ARRAY
-      int a[3];
-      a[0] = a1;
-      a[1] = a2;
-      a[2] = a3;
+	int a[3];
+	a[0] = a1;
+	a[1] = a2;
+	a[2] = a3;
 
-      doprnt (SCREEN_MESSAGE_BUF (selected_screen),
-	      SCREEN_WIDTH (selected_screen), m, 0, 3, a);
+	doprnt (SCREEN_MESSAGE_BUF (selected_screen),
+		SCREEN_WIDTH (selected_screen), m, 0, 3, a);
 #else
-      doprnt (SCREEN_MESSAGE_BUF (selected_screen),
-	      SCREEN_WIDTH (selected_screen), m, 0, 3, &a1);
+	doprnt (SCREEN_MESSAGE_BUF (selected_screen),
+		SCREEN_WIDTH (selected_screen), m, 0, 3, &a1);
 #endif				/* NO_ARG_ARRAY */
+      }
 
       echo_area_glyphs = SCREEN_MESSAGE_BUF (selected_screen);
 
@@ -391,12 +393,12 @@
 
   tlbufpos = this_line_bufpos;
   tlendpos = this_line_endpos;
-  if (!all_windows && tlbufpos > 0 && NULL (w->update_mode_line)
+  if (!all_windows && tlbufpos > 0 && NILP (w->update_mode_line)
       && SCREEN_VISIBLE_P (XSCREEN (w->screen))
       /* Make sure recorded data applies to current buffer, etc */
       && this_line_buffer == current_buffer
       && current_buffer == XBUFFER (w->buffer)
-      && NULL (w->force_start)
+      && NILP (w->force_start)
       /* Point must be on the line that we have info recorded about */
       && point >= tlbufpos
       && point <= Z - tlendpos
@@ -557,7 +559,7 @@
   if (pause)
     {
       this_line_bufpos = 0;
-      if (!NULL (last_arrow_position))
+      if (!NILP (last_arrow_position))
 	{
 	  last_arrow_position = Qt;
 	  last_arrow_string = Qt;
@@ -643,11 +645,11 @@
 {
   register struct window *w;
 
-  for (;!NULL (window); window = w->next)
+  for (;!NILP (window); window = w->next)
     {
       w = XWINDOW (window);
 
-      if (!NULL (w->buffer))
+      if (!NILP (w->buffer))
 	XFASTINT (w->last_modified)
 	  = !flag ? 0
 	    : XBUFFER (w->buffer) == current_buffer
@@ -655,9 +657,9 @@
       w->window_end_valid = Qt;
       w->update_mode_line = Qnil;
 
-      if (!NULL (w->vchild))
+      if (!NILP (w->vchild))
 	mark_window_display_accurate (w->vchild, flag);
-      if (!NULL (w->hchild))
+      if (!NILP (w->hchild))
 	mark_window_display_accurate (w->hchild, flag);
     }
 
@@ -680,7 +682,7 @@
 redisplay_windows (window)
      Lisp_Object window;
 {
-  for (; !NULL (window); window = XWINDOW (window)->next)
+  for (; !NILP (window); window = XWINDOW (window)->next)
     redisplay_window (window, 0);
 }
 
@@ -708,17 +710,17 @@
 
   /* If this is a combination window, do its children; that's all.  */
 
-  if (!NULL (w->vchild))
+  if (!NILP (w->vchild))
     {
       redisplay_windows (w->vchild);
       return;
     }
-  if (!NULL (w->hchild))
+  if (!NILP (w->hchild))
     {
       redisplay_windows (w->hchild);
       return;
     }
-  if (NULL (w->buffer))
+  if (NILP (w->buffer))
     abort ();
   
   height = window_internal_height (w);
@@ -770,12 +772,12 @@
       SET_PT (marker_position (w->pointm));
       if (point < BEGV)
 	{
-	  point = BEGV;
+	  SET_PT (BEGV);
 	  Fset_marker (w->pointm, make_number (point), Qnil);
 	}
       else if (point > (ZV - 1))
 	{
-	  point = ZV;
+	  SET_PT (ZV);
 	  Fset_marker (w->pointm, make_number (point), Qnil);
 	}
     }
@@ -788,7 +790,7 @@
 
   /* Handle case where place to start displaying has been specified,
      unless the specified location is outside the visible range.  */
-  if (!NULL (w->force_start))
+  if (!NILP (w->force_start))
     {
       w->update_mode_line = Qt;
       w->force_start = Qnil;
@@ -862,7 +864,7 @@
     }
   /* If current starting point was originally the beginning of a line
      but no longer is, find a new starting point.  */
-  else if (!NULL (w->start_at_line_beg)
+  else if (!NILP (w->start_at_line_beg)
 	   && !(startp == BEGV
 		|| FETCH_CHAR (startp - 1) == '\n'))
     {
@@ -943,7 +945,7 @@
 done:
   /* If window not full width, must redo its mode line
      if the window to its side is being redone */
-  if ((!NULL (w->update_mode_line)
+  if ((!NILP (w->update_mode_line)
        || (!just_this_one && width < SCREEN_WIDTH (s) - 1))
       && height != XFASTINT (w->height))
     display_mode_line (w);
@@ -1432,7 +1434,7 @@
   register GLYPH *p1prev;
   SCREEN_PTR s = XSCREEN (w->screen);
   int tab_width = XINT (current_buffer->tab_width);
-  int ctl_arrow = !NULL (current_buffer->ctl_arrow);
+  int ctl_arrow = !NILP (current_buffer->ctl_arrow);
   int width = XFASTINT (w->width) - 1
     - (XFASTINT (w->width) + XFASTINT (w->left) != SCREEN_WIDTH (s));
   struct position val;
@@ -1442,13 +1444,13 @@
   int truncate = hscroll
     || (truncate_partial_width_windows
 	&& XFASTINT (w->width) < SCREEN_WIDTH (s))
-    || !NULL (current_buffer->truncate_lines);
+    || !NILP (current_buffer->truncate_lines);
   int selective
     = XTYPE (current_buffer->selective_display) == Lisp_Int
       ? XINT (current_buffer->selective_display)
-	: !NULL (current_buffer->selective_display) ? -1 : 0;
+	: !NILP (current_buffer->selective_display) ? -1 : 0;
 #ifndef old
-  int selective_e = selective && !NULL (current_buffer->selective_display_ellipses);
+  int selective_e = selective && !NILP (current_buffer->selective_display_ellipses);
 #endif
   register struct screen_glyphs *desired_glyphs = SCREEN_DESIRED_GLYPHS (s);
   register struct Lisp_Vector *dp = window_display_table (w);
@@ -1768,7 +1770,7 @@
   if (SCREEN_IS_X (s)
       && ! SCREEN_MINIBUF_ONLY_P (s)
       && w == XWINDOW (s->selected_window)
-      && (NULL (Fstring_equal (XBUFFER (w->buffer)->name, s->name))))
+      && (NILP (Fstring_equal (XBUFFER (w->buffer)->name, s->name))))
     x_set_name (s, XBUFFER (w->buffer)->name, Qnil);
 #endif
 }
@@ -1875,7 +1877,7 @@
       {
 	register Lisp_Object tem;
 	tem = Fboundp (elt);
-	if (!NULL (tem))
+	if (!NILP (tem))
 	  {
 	    tem = Fsymbol_value (elt);
 	    /* If value is a string, output that string literally:
@@ -1911,17 +1913,17 @@
 	      goto invalid;
 	    /* elt is now the cdr, and we know it is a cons cell.
 	       Use its car if CAR has a non-nil value.  */
-	    if (!NULL (tem))
+	    if (!NILP (tem))
 	      {
 		tem = Fsymbol_value (car);
-		if (!NULL (tem))
+		if (!NILP (tem))
 		  { elt = XCONS (elt)->car; goto tail_recurse; }
 	      }
 	    /* Symbol's value is nil (or symbol is unbound)
 	       Get the cddr of the original list
 	       and if possible find the caddr and use that.  */
 	    elt = XCONS (elt)->cdr;
-	    if (NULL (elt))
+	    if (NILP (elt))
 	      break;
 	    else if (XTYPE (elt) != Lisp_Cons)
 	      goto invalid;
@@ -2015,7 +2017,7 @@
     case 'f': 
       obj = current_buffer->filename;
 #if 0
-      if (NULL (obj))
+      if (NILP (obj))
 	return "[none]";
       else if (XTYPE (obj) == Lisp_String && XSTRING (obj)->size > maxwidth)
 	{
@@ -2037,7 +2039,7 @@
       break;
 
     case '*':
-      if (!NULL (current_buffer->read_only))
+      if (!NILP (current_buffer->read_only))
 	return "%";
       if (MODIFF > current_buffer->save_modified)
 	return "*";
@@ -2047,7 +2049,7 @@
       /* status of process */
 #ifdef subprocesses
       obj = Fget_buffer_process (Fcurrent_buffer ());
-      if (NULL (obj))
+      if (NILP (obj))
 	return "no process";
       obj = Fsymbol_name (Fprocess_status (obj));
       break;
--- a/src/xfns.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/xfns.c	Mon Jan 13 21:48:08 1992 +0000
@@ -479,10 +479,10 @@
     return WHITE_PIX_DEFAULT;
 
 #ifdef HAVE_X11
-  if (XFASTINT (x_screen_planes) <= 2)
+  if (XFASTINT (x_screen_planes) == 1)
     return def;
 #else
-  if (DISPLAY_CELLS <= 2)
+  if (DISPLAY_CELLS == 1)
     return def;
 #endif
 
@@ -956,7 +956,7 @@
     return;
 
   BLOCK_INPUT;
-  if (NULL (arg))
+  if (NILP (arg))
     result = x_text_icon (s, 0);
   else
     result = x_bitmap_icon (s, 0);
@@ -1327,14 +1327,14 @@
   char *class_key;
 
   CHECK_STRING (attribute, 0);
-  if (!NULL (name))
+  if (!NILP (name))
     CHECK_STRING (name, 1);
-  if (!NULL (class))
+  if (!NILP (class))
     CHECK_STRING (class, 2);
-  if (NULL (name) != NULL (class))
+  if (NILP (name) != NILP (class))
     error ("x-get-resource: must specify both NAME and CLASS or neither");
 
-  if (NULL (name))
+  if (NILP (name))
     {
       name_key = (char *) alloca (XSTRING (invocation_name)->size + 1
 				  + XSTRING (attribute)->size + 1);
@@ -1424,7 +1424,6 @@
      enum resource_types type;
 {
   register Lisp_Object tem;
-  int i;
 
   tem = Fassq (param, alist);
   if (EQ (tem, Qnil))
@@ -1437,13 +1436,27 @@
 	 component name.  */
       if (XTYPE (screen_name) == Lisp_String)
 	{
+	  int i;
+
 	  sterile_name = make_uninit_string (XSTRING (screen_name)->size);
-
-	  for (i = 0; i < XSTRING (sterile_name)->size; i++)
+	  for (i = 0; i < XSTRING (screen_name)->size; i++)
 	    {
 	      int c = XSTRING (screen_name)->data[i];
-	      if (c == ':' || c == '.' || c == '*' || isspace (c))
-		c = '_';
+
+	      switch (c)
+		{
+		case ':':
+		case '.':
+		case '*':
+		case ' ':
+		case '\t':
+		case '\n':
+		  c = '_';
+		  break;
+		default:
+		  break;
+		}
+
 	      XSTRING (sterile_name)->data[i] = c;
 	    }
 	}
@@ -1452,9 +1465,9 @@
 
       tem = Fx_get_resource (build_string (attribute),
 			     sterile_name,
-			     (NULL (sterile_name) ? Qnil : screen_class));
-
-      if (NULL (tem))
+			     (NILP (sterile_name) ? Qnil : screen_class));
+
+      if (NILP (tem))
 	return Qnil;
 
       switch (type)
@@ -1677,7 +1690,7 @@
 		     screen_visual, /* set in Fx_open_connection */
 		     attribute_mask, &attributes);
 
-  class_hints.res_name = s->name;
+  class_hints.res_name = (char *) XSTRING (s->name)->data;
   class_hints.res_class = EMACS_CLASS;
   XSetClassHint (x_current_display, s->display.x->window_desc, &class_hints);
 
@@ -1823,13 +1836,13 @@
 
 DEFUN ("x-create-screen", Fx_create_screen, Sx_create_screen,
        1, 1, 0,
-  "Make a new X window, which is considered a \"screen\" in Emacs terms.\n\
+  "Make a new X window, which is called a \"screen\" in Emacs terms.\n\
 Return an Emacs screen object representing the X window.\n\
 ALIST is an alist of screen parameters.\n\
 The value of ``x-screen-defaults'' is an additional alist\n\
 of default parameters which apply when not overridden by ALIST.\n\
 If the parameters specify that the screen should not have a minibuffer,\n\
-then ``global-minibuffer-screen'' must be a screen whose minibuffer can\n\
+then ``default-minibuffer-screen'' must be a screen whose minibuffer can\n\
 be shared by the new screen.")
   (parms)
      Lisp_Object parms;
@@ -1846,7 +1859,7 @@
     error ("X windows are not in use or not initialized");
 
   name = x_get_arg (parms, intern ("name"), Qnil, "Title", string);
-  if (NULL (name))
+  if (NILP (name))
     name = build_string (x_id_name);
   if (XTYPE (name) != Lisp_String)
     error ("x-create-screen: name parameter must be a string");
@@ -1859,10 +1872,10 @@
       s = make_minibuffer_screen ();
       minibuffer_only = 1;
     }
-  else if (! EQ (tem, Qnil))
+  else if (EQ (tem, Qnil) || EQ (tem, Qt))
+    s = make_screen (1);
+  else
     s = make_screen_without_minibuffer (tem);
-  else
-    s = make_screen (1);
 
   /* Set the name; the functions to which we pass s expect the
      name to be set.  */
@@ -1873,6 +1886,9 @@
   s->display.x = (struct x_display *) xmalloc (sizeof (struct x_display));
   bzero (s->display.x, sizeof (struct x_display));
 
+  /* Note that the screen has no physical cursor right now.  */
+  s->phys_cursor_x = -1;
+
   /* Extract the window parameters from the supplied values
      that are needed to determine window geometry.  */
   x_default_parameter (s, parms, "font",
@@ -1882,7 +1898,7 @@
   x_default_parameter (s, parms, "border-width",
 		      make_number (2), "BorderWidth", number);
   x_default_parameter (s, parms, "internal-border-width",
-		      make_number (4), "InternalBorderWidth", number);
+		      make_number (1), "InternalBorderWidth", number);
 
   /* Also do the stuff which must be set before the window exists. */
   x_default_parameter (s, parms, "foreground-color",
@@ -2066,7 +2082,7 @@
 			 (XTYPE (tem) == Lisp_String
 			  ? (char *) XSTRING (tem)->data : ""),
 			 XSTRING (s->name)->data,
-			 !NULL (hscroll), !NULL (vscroll));
+			 !NILP (hscroll), !NILP (vscroll));
 	}
       else
 	{
@@ -2099,10 +2115,10 @@
 
       pixelwidth = (width * FONT_WIDTH (s->display.x->font)
 		    + 2 * s->display.x->internal_border_width
-		    + (!NULL (vscroll) ? VSCROLL_WIDTH : 0));
+		    + (!NILP (vscroll) ? VSCROLL_WIDTH : 0));
       pixelheight = (height * FONT_HEIGHT (s->display.x->font)
 		     + 2 * s->display.x->internal_border_width
-		     + (!NULL (hscroll) ? HSCROLL_HEIGHT : 0));
+		     + (!NILP (hscroll) ? HSCROLL_HEIGHT : 0));
       
       BLOCK_INPUT;
       s->display.x->window_desc
@@ -2158,9 +2174,9 @@
 
   Fmodify_screen_parameters (screen, parms);
 
-  if (!NULL (vscroll))
+  if (!NILP (vscroll))
     install_vertical_scrollbar (s, pixelwidth, pixelheight);
-  if (!NULL (hscroll))
+  if (!NILP (hscroll))
     install_horizontal_scrollbar (s, pixelwidth, pixelheight);
 
   /* Make the window appear on the screen and enable display.  */
@@ -2178,7 +2194,7 @@
   (screen)
      Lisp_Object screen;
 {
-  CHECK_SCREEN (screen, 0);
+  CHECK_LIVE_SCREEN (screen, 0);
 
   if (SCREEN_IS_X (XSCREEN (screen)))
     {
@@ -2291,7 +2307,7 @@
      struct screen *s;
      Lisp_Object val, oldval;
 {
-  if (!NULL (val))
+  if (!NILP (val))
     {
       if (s->display.x->window_desc != 0)
 	{
@@ -2325,7 +2341,7 @@
      struct screen *s;
      Lisp_Object val, oldval;
 {
-  if (!NULL (val))
+  if (!NILP (val))
     {
       if (s->display.x->window_desc != 0)
 	{
@@ -2878,7 +2894,7 @@
   (screen)
      Lisp_Object screen;
 {
-  CHECK_SCREEN (screen, 0);
+  CHECK_LIVE_SCREEN (screen, 0);
   return make_number (XSCREEN (screen)->display.x->pixel_width);
 }
 
@@ -2887,7 +2903,7 @@
   (screen)
      Lisp_Object screen;
 {
-  CHECK_SCREEN (screen, 0);
+  CHECK_LIVE_SCREEN (screen, 0);
   return make_number (XSCREEN (screen)->display.x->pixel_height);
 }
 
@@ -2929,7 +2945,7 @@
 {
   register int x0, y0, x1, y1, top, left, n_chars, n_lines;
 
-  CHECK_SCREEN (screen, 0);
+  CHECK_LIVE_SCREEN (screen, 0);
   CHECK_NUMBER (X0, 0);
   CHECK_NUMBER (Y0, 1);
   CHECK_NUMBER (X1, 2);
@@ -3528,7 +3544,7 @@
 	  int len = SCREEN_CURRENT_GLYPHS (s)->used[x_mouse_y];
 	  int p = SCREEN_CURRENT_GLYPHS (s)->bufp[x_mouse_y];
 	  int tab_width = XINT (b->tab_width);
-	  int ctl_arrow_p = !NULL (b->ctl_arrow);
+	  int ctl_arrow_p = !NILP (b->ctl_arrow);
 	  unsigned char c;
 	  int mode_line_vpos = XFASTINT (w->height) + XFASTINT (w->top) - 1;
 	  int in_mode_line = 0;
@@ -3692,38 +3708,6 @@
 }
 #endif
 
-x_read_mouse_position (s, x, y)
-     struct screen *s;
-     int *x, *y;
-{
-  Window w;
-  int ix, iy;
-  int ibw = s->display.x->internal_border_width;
-
-#ifdef HAVE_X11
-  Window root_window;
-  int root_x, root_y;
-  unsigned int keys_and_buttons;
-
-  BLOCK_INPUT;
-  if (XQueryPointer (x_current_display, s->display.x->window_desc,
-       	      &root_window, &w, &root_x, &root_y, &ix, &iy,
-       	      &keys_and_buttons) == False)
-    {
-      UNBLOCK_INPUT;
-      error ("Pointer not on same screen as window.");
-    }
-  UNBLOCK_INPUT;
-#else
-  BLOCK_INPUT;
-  XQueryMouse (s->display.x->window_desc, &ix, &iy, &w);
-  UNBLOCK_INPUT;
-#endif /* not HAVE_X11 */
-
-  x_mouse_x = *x = (ix - ibw) / FONT_WIDTH (s->display.x->font);
-  x_mouse_y = *y = (iy - ibw) / FONT_HEIGHT (s->display.x->font);
-}
-
 #if 0
 
 #ifdef HAVE_X11
@@ -3920,7 +3904,7 @@
 	    }
 	}
       
-      if (!NULL (arg))
+      if (!NILP (arg))
 	return Qnil;
 
       /* Wait till we get another mouse event.  */
@@ -3990,7 +3974,7 @@
   if (keysym == NoSymbol)
     error ("Keysym does not exist");
 
-  if (NULL (modifiers))
+  if (NILP (modifiers))
     XRebindKeysym (x_current_display, keysym, modifier_list, 0,
 		   XSTRING (newstring)->data, XSTRING (newstring)->size);
   else
@@ -3998,7 +3982,7 @@
       register Lisp_Object rest, mod;
       register int i = 0;
 
-      for (rest = modifiers; !NULL (rest); rest = Fcdr (rest))
+      for (rest = modifiers; !NILP (rest); rest = Fcdr (rest))
 	{
 	  if (i == 16)
 	    error ("Can't have more than 16 modifiers");
@@ -4040,7 +4024,7 @@
   for (i = 0; i <= 15; strings = Fcdr (strings), i++)
     {
       item = Fcar (strings);
-      if (!NULL (item))
+      if (!NILP (item))
 	{
 	  CHECK_STRING (item, 2);
 	  strsize = XSTRING (item)->size;
@@ -4080,7 +4064,7 @@
   int i, strsize;
   
   CHECK_NUMBER (keycode, 1);
-  if (!NULL (shift_mask))
+  if (!NILP (shift_mask))
     CHECK_NUMBER (shift_mask, 2);
   CHECK_STRING (newstring, 3);
   strsize = XSTRING (newstring)->size;
@@ -4089,7 +4073,7 @@
 
   keysym = ((unsigned) (XINT (keycode))) & 255;
 
-  if (NULL (shift_mask))
+  if (NILP (shift_mask))
     {
       for (i = 0; i <= 15; i++)
 	XRebindCode (keysym, i<<11, rawstring, strsize);
@@ -4123,7 +4107,7 @@
   for (i = 0; i <= 15; strings = Fcdr (strings), i++)
     {
       item = Fcar (strings);
-      if (!NULL (item))
+      if (!NILP (item))
 	{
 	  CHECK_STRING (item, 2);
 	  strsize = XSTRING (item)->size;
--- a/src/xmenu.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/xmenu.c	Mon Jan 13 21:48:08 1992 +0000
@@ -320,7 +320,7 @@
   *items = (int *) xmalloc (i * sizeof (int));
   *names = (char ***) xmalloc (i * sizeof (char **));
 
-  for (i=0, tail = menu; !NULL (tail); tail = Fcdr (tail), i++)
+  for (i=0, tail = menu; !NILP (tail); tail = Fcdr (tail), i++)
     {
        item = Fcdr (Fcar (tail));
        if (XTYPE (item) != Lisp_Cons) (void) wrong_type_argument (Qlistp, item);
@@ -358,7 +358,7 @@
   *vector = (Lisp_Object *) xmalloc (i * sizeof (Lisp_Object));
   *names = (char **) xmalloc (i * sizeof (char *));
 
-  for (i=0, tail = pane; !NULL (tail); tail = Fcdr (tail), i++)
+  for (i=0, tail = pane; !NILP (tail); tail = Fcdr (tail), i++)
     {
        item = Fcar (tail);
        if (XTYPE (item) != Lisp_Cons) (void) wrong_type_argument (Qlistp, item);
--- a/src/xrdb.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/xrdb.c	Mon Jan 13 21:48:08 1992 +0000
@@ -26,13 +26,14 @@
 #include <sys/param.h>
 #include <pwd.h>
 #include <sys/stat.h>
+#include <sys/types.h>
 
 #ifdef emacs
 #include "config.h"
 #endif
 
 extern char *getenv ();
-extern int getuid ();
+extern uid_t getuid ();
 extern struct passwd *getpwuid ();
 extern struct passwd *getpwnam ();
 
--- a/src/xterm.c	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/xterm.c	Mon Jan 13 21:48:08 1992 +0000
@@ -30,7 +30,6 @@
 #ifdef HAVE_X_WINDOWS
 
 #include "lisp.h"
-#undef NULL
 
 /* On 4.3 this loses if it comes after xterm.h.  */
 #include <signal.h>
@@ -368,6 +367,7 @@
    where display update commands will take effect.
    This does not affect the place where the cursor-box is displayed.  */
 
+static
 XTcursor_to (row, col)
      register int row, col;
 {
@@ -401,8 +401,6 @@
      int hl;
      FONT_TYPE *font;
 {
-  char buf[s->width];
-  register char *cp = buf;
   register int len;
   Window window = s->display.x->window_desc;
   GC drawing_gc =   (hl == 2 ? s->display.x->cursor_gc
--- a/src/xterm.h	Mon Jan 13 21:48:03 1992 +0000
+++ b/src/xterm.h	Mon Jan 13 21:48:08 1992 +0000
@@ -158,7 +158,8 @@
 #define BLOCK_INPUT (x_input_blocked++)
 
 /* End critical section. */
-#define UNBLOCK_INPUT (x_input_blocked--, (x_input_blocked < 0 ? abort () : 0))
+#define UNBLOCK_INPUT \
+  (x_input_blocked--, (x_input_blocked < 0 ? (abort (), 0) : 0))
 
 #define TOTALLY_UNBLOCK_INPUT (x_input_blocked = 0)
 #define UNBLOCK_INPUT_RESIGNAL UNBLOCK_INPUT