Sophie

Sophie

distrib > * > 2008.0 > x86_64 > by-pkgid > c6d8198fd3a861c932152544cde921fd > files > 9

vile-9.5r-1mdv2008.0.src.rpm

# vile 9.5f - patch 2005/02/19 - Thomas Dickey <dickey@invisible-island.net>
# ------------------------------------------------------------------------------
# CHANGES                  |   65 ++++++
# COPYING                  |    4 
# MANIFEST                 |    5 
# README                   |    4 
# ansi.c                   |    5 
# borland.c                |    5 
# curses.c                 |    5 
# descrip.mms              |   28 ++
# display.c                |   15 +
# doc/macros.doc           |   29 ++-
# dumbterm.c               |    5 
# edef.h                   |    7 
# estruct.h                |    9 
# eval.c                   |   56 ++++-
# exec.c                   |   42 ++++
# file.c                   |   10 -
# filters/bat-filt.l       |   10 -
# filters/cpp.key          |    3 
# filters/filters.rc       |    7 
# filters/htmlfilt.l       |   21 +-
# filters/makefile.2nd     |   12 -
# filters/sh-filt.l        |    5 
# macros/modes.rc          |   35 +++
# main.c                   |   95 +---------
# makefile.blc             |   46 ++--
# makefile.djg             |    4 
# makefile.icc             |   13 -
# makefile.in              |  109 ++++++++---
# makefile.wnt             |   57 ++----
# modes.c                  |   81 ++++++--
# modetbl                  |    8 
# ntconio.c                |   11 -
# ntwinio.c                |   37 ++-
# os2vio.c                 |    5 
# patchlev.h               |    2 
# proto.h                  |    7 
# random.c                 |   20 +-
# revlist                  |  107 +++++------
# spawn.c                  |   24 +-
# statevar.c               |   50 ++++-
# tbuff.c                  |    9 
# tcap.c                   |    5 
# termio.c                 |  424 +++------------------------------------------
# test_io.c                |    5 
# version.c                |    4 
# vile-9.5.spec            |   14 +
# vile-9.5f/filters/cs.key |  108 +++++++++++
# vile-9.5f/nullterm.c     |  243 +++++++++++++++++++++++++
# vile.hlp                 |   16 +
# vmsbuild.com             |  395 +++++++++++++++++++++++++++--------------
# vmsvt.c                  |  328 ++++++++++++++++++++++++++--------
# w32cmd.c                 |   10 -
# w32ole.cpp               |   16 +
# x11.c                    |  120 +++++-------
# 54 files changed, 1721 insertions(+), 1039 deletions(-)
# ------------------------------------------------------------------------------
# Please remove the following file before applying this patch.
# (You can feed this patch to 'sh' to do so.)

rm -f makefile.emx
exit

Index: CHANGES
--- vile-9.5e+/CHANGES	2006-01-10 01:20:29.000000000 +0000
+++ vile-9.5f/CHANGES	2006-02-20 00:54:02.000000000 +0000
@@ -1,5 +1,70 @@
 Changes for vile 9.6 (released ??? ??? ?? ????)
 
+ 20060219 (f)
+	> Clark Morgan:
+	+ update vile.hlp for %n and %N title format changes.
+	> Tom Dickey:
+	+ fix sh-filt.l for parameter substitutions containing an escaped
+	  quote, e.g.,
+		VERSION=${VERSION#*VERSION \"}
+		VERSION=${VERSION%\"*}
+	+ add csmode (for C# ".cs" files) and cs.key, using vile-c-filter for
+	  parsing.
+	+ modify ntwinio.c to invoke build_recent_file_and_folder_menus() in
+	  the WM_INITMENUPOPUP event rather than WM_SYSCOMMAND.  This makes
+	  winvile initialize the recent-folders and recent-files if one uses a
+	  right-click on the title of the window.
+	+ change winvile's registry subkey for recent-folders and recent-files
+	  to match environment variable settings from 9.4r, e.g., change
+		"Software\winvile\MRUFiles"
+	  to
+		"Software\VI Like Emacs\MRUFiles"
+	+ add new symbols $return and $_ which can be used to implement simple
+	  functions (request by William James).
+	+ fix filters/makefile.2nd to allow build for gcov
+	+ improve majormodes for complex fences by initializing the (non-string)
+	  buffer mode values for submode groups according to the values in
+	  the submode.  This makes ignorecase work as expected in the complex
+	  fence matching for vbmode.
+	+ add complex fences to vbmode.
+	+ minor fix to bat-filt.l to avoid highlighting ".bat" as a string in
+		call foo.bat
+	+ change htmlfilt.l to highlight character- and URI-references as
+	  numbers to make them distinct from strings with ordinary text.
+	+ add makefile rules for installing/uninstalling files from doc
+	  directory:
+		install-doc
+		uninstall-doc
+	  as well as installing/uninstalling macros
+		install-macros
+		uninstall-macros
+		uninstall-perl
+	+ correct logic for goto-char, broken in 9.4za (report by William
+	  James).
+	+ fix change to cpp.key in 9.5e, which put the C keywords in the wrong
+	  table.
+	+ add spell.rc to makefile.wnt install rule.
+	+ add test_io.exe rule to vmsbuild.com
+	+ add TERM.clean(), TERM.unclean(), TERM.openup() to help move diverse
+	  code out of termio.c
+	+ modify var_TITLEFORMAT() only call set_editor_title() when setting
+	  $title-format, and modify get_statevar_val() to handle some limited
+	  recursion just in case there are other cases where it could be called
+	  from the statevar.c module while retrieving a value.  This fixes a
+	  bug introduced in 9.5e (report by Clark Morgan).
+	+ update title when doing a "cd", in case it uses %r substitution.
+	+ change %n in modeline substitutions to use file name (pathleaf)
+	  rather than relative path (shorten_path).  Use %r for the latter.
+	  (request by Clark Morgan).
+	+ move VMS-specific code from termio.c to vmsvt.c
+	+ remove unused start_debug_log() and mallocdbg() from main.c
+	+ correct typo in ifdef for Visual Studio C++ 6.0 ifdef in w32ole.cpp
+	  from 9.5e changes.
+	+ move 9.5c check for stdout not a tty on startup to allow "vile -V"
+	  to pipe to other programs.
+	+ split-out nullterm.c
+	+ add test_io stub, to help isolate dependencies of the I/O drivers.
+
  20060109 (e)
 	> Clark Morgan:
 	+ improved winvile's "flash".
Index: COPYING
--- vile-9.5e+/COPYING	1999-11-04 22:52:36.000000000 +0000
+++ vile-9.5f/COPYING	2006-02-18 22:32:51.000000000 +0000
@@ -4,8 +4,8 @@
 has been made to ensure that this later code has been removed or 
 rewritten, returning vile's original basis to public domain status.  
 the current version of vile, however, is _not_ in the public domain -- 
-it is released under the provisions of the GNU General Public License, 
-below. 
+it is released under the provisions of the specific version of
+the GNU General Public License, below.
 
 -------------------------------------------------
 		    GNU GENERAL PUBLIC LICENSE
Index: MANIFEST
--- vile-9.5e+/MANIFEST	2006-01-10 01:29:03.000000000 +0000
+++ vile-9.5f/MANIFEST	2006-02-20 01:03:11.000000000 +0000
@@ -1,4 +1,4 @@
-MANIFEST for vile, version v9_5e
+MANIFEST for vile, version v9_5f
 --------------------------------------------------------------------------------
 MANIFEST                        this file
 CHANGES                         Change-log for VILE
@@ -64,7 +64,6 @@
 main.c                          main program of VILE
 makefile.blc                    makefile for Win32 with Borland C++
 makefile.djg                    makefile for DJGCC
-makefile.emx                    makefile for EMX (OS/2) with gcc and gmake
 makefile.icc                    makefile for C Set++ 2.x (OS/2)
 makefile.in                     used by 'configure' to generate a makefile
 makefile.wnt                    makefile for Win32 with Microsoft Visual C++
@@ -79,6 +78,7 @@
 npopen.c                        pipe-command support
 ntconio.c                       Win32 console terminal driver
 ntwinio.c                       GUI terminal driver for WinNT
+nullterm.c                      null device-driver
 oneliner.c                      commands that operate upon single lines
 opers.c                         operator-commands (that use motions)
 os2keys.h                       function-key definitions for OS/2
@@ -186,6 +186,7 @@
 filters/c.key                   keywords for C
 filters/cfg-filt.l              syntax filter for Lynx config file.
 filters/cpp.key                 C++ keywords
+filters/cs.key                  keywords for C#
 filters/csh.key                 keywords for csh/tcsh syntax highlighting filter
 filters/css-filt.l              syntax filter for CSS files
 filters/css.key                 keywords for css mode
Index: README
Prereq:  1.93 
--- vile-9.5e+/README	2005-07-25 23:29:24.000000000 +0000
+++ vile-9.5f/README	2006-01-11 21:25:35.000000000 +0000
@@ -62,7 +62,7 @@
 	ftp://ftp.phred.org/pub/vile/patches/
 
 In addition, we have distributed copies at other sites, including
-metalabs.unc.edu (Linux), hobbes.nmsu.edu (OS/2) and the VMS Freeware
+metalabs.unc.edu, hobbes.nmsu.edu (OS/2) and the VMS Freeware
 CDROM's.
 
 ------------------------------------------------------
@@ -1156,5 +1156,5 @@
     + modify vmsbuild.com and descrip.mms to work with IA64.
 
 -------------------------------
-$Header: /usr/build/vile/vile/RCS/README,v 1.93 2005/07/25 23:29:24 tom Exp $
+$Header: /usr/build/vile/vile/RCS/README,v 1.94 2006/01/11 21:25:35 tom Exp $
 -------------------------------
Index: ansi.c
Prereq:  1.46 
--- vile-9.5e+/ansi.c	2005-11-23 12:19:35.000000000 +0000
+++ vile-9.5f/ansi.c	2006-01-12 23:37:34.000000000 +0000
@@ -4,7 +4,7 @@
  * "termio.c". It compiles into nothing if not an ANSI device.
  *
  *
- * $Header: /usr/build/vile/vile/RCS/ansi.c,v 1.46 2005/11/23 12:19:35 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/ansi.c,v 1.48 2006/01/12 23:37:34 tom Exp $
  */
 
 #include	"estruct.h"
@@ -345,6 +345,9 @@
     nullterm_kopen,
     nullterm_kclose,
     ansiclose,
+    ttclean,
+    ttunclean,
+    nullterm_openup,
     ttgetc,
     ttputc,
     tttypahead,
Index: borland.c
Prereq:  1.34 
--- vile-9.5e+/borland.c	2005-11-30 01:25:29.000000000 +0000
+++ vile-9.5f/borland.c	2006-01-12 23:37:34.000000000 +0000
@@ -9,7 +9,7 @@
  * Note: Visual flashes are not yet supported.
  *
  *
- * $Header: /usr/build/vile/vile/RCS/borland.c,v 1.34 2005/11/30 01:25:29 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/borland.c,v 1.36 2006/01/12 23:37:34 tom Exp $
  *
  */
 
@@ -506,6 +506,9 @@
     borclose,
     borkopen,
     borkclose,
+    ttclean,
+    ttunclean,
+    nullterm_openup,
     borttgetc,
     borputc,
     bortttypahead,
Index: curses.c
Prereq:  1.25 
--- vile-9.5e+/curses.c	2005-11-23 19:15:44.000000000 +0000
+++ vile-9.5f/curses.c	2006-01-12 23:37:34.000000000 +0000
@@ -1,7 +1,7 @@
 /*
  * A terminal driver using the curses library
  *
- * $Header: /usr/build/vile/vile/RCS/curses.c,v 1.25 2005/11/23 19:15:44 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/curses.c,v 1.27 2006/01/12 23:37:34 tom Exp $
  */
 
 #include	"estruct.h"
@@ -399,6 +399,9 @@
     curs_close,
     curs_kopen,
     curs_kclose,
+    ttclean,
+    ttunclean,
+    nullterm_openup,
     curs_getc,
     curs_putc,
     curs_typahead,
Index: descrip.mms
Prereq:  1.46 
--- vile-9.5e+/descrip.mms	2004-11-02 22:55:11.000000000 +0000
+++ vile-9.5f/descrip.mms	2006-01-12 21:23:53.000000000 +0000
@@ -5,7 +5,7 @@
 # estruct.h to make sure the correct one is #defined as "1", and the others
 # all as "0".
 #
-# $Header: /usr/build/vile/vile/RCS/descrip.mms,v 1.46 2004/11/02 22:55:11 tom Exp $
+# $Header: /usr/build/vile/vile/RCS/descrip.mms,v 1.48 2006/01/12 21:23:53 tom Exp $
 
 # Editor Configuration Note
 # -------------------------
@@ -81,6 +81,7 @@
 	modes.c \
 	msgs.c \
 	npopen.c \
+	nullterm.c \
 	oneliner.c \
 	opers.c \
 	path.c \
@@ -133,6 +134,7 @@
 	modes.obj,\
 	msgs.obj,\
 	npopen.obj,\
+	nullterm.obj,\
 	oneliner.obj,\
 	opers.obj,\
 	path.obj,\
@@ -158,7 +160,7 @@
 
 all :
 
-        $(MMS)$(MMSQUALIFIERS) $(TARGET)
+	$(MMS)$(MMSQUALIFIERS) $(TARGET)
 
 #
 # I've built on an Alpha with CC_OPTIONS set to
@@ -172,7 +174,7 @@
 # compiler does not suffer from this problem.
 #
 # Configuration where problem was observed:
-#                DEC C V5.6-003 on OpenVMS VAX V7.1
+#	DEC C V5.6-003 on OpenVMS VAX V7.1
 #                                                    --C. Morgan
 #
 .IFDEF __IA64__
@@ -275,6 +277,26 @@
 vms_link.opt :
 	@vmsbuild vms_link_opt
 
+# test-drivers
+
+test_btree.obj :	btree.c
+	$(CC) $(CFLAGS) /Define=("DEBUG_BTREE") btree.c
+test_btree.exe :	test_btree.obj
+	$(LINK) $(LINKFLAGS) test_btree.obj $(OPTIONS)
+
+test_regexp.obj :	regexp.c
+	$(CC) $(CFLAGS) /Define=("DEBUG_REGEXP") regexp.c
+test_regexp.exe :	test_regexp.obj
+	$(LINK) $(LINKFLAGS) test_regexp.obj $(OPTIONS)
+
+TEST_IO_OBJS	= \
+	$(SCREEN).obj, \
+	nullterm.obj, \
+	test_io.obj
+
+test_io.exe :	$(TEST_IO_OBJS)
+	$(LINK) $(LINKFLAGS) $(TEST_IO_OBJS) $(OPTIONS)
+
 # Runs VILE from the current directory (used for testing)
 vile.com :
 	@- if "''f$search("$@")'" .nes. "" then delete $@;*
Index: display.c
Prereq:  1.413 
--- vile-9.5e+/display.c	2005-12-25 21:44:45.000000000 +0000
+++ vile-9.5f/display.c	2006-01-12 23:46:38.000000000 +0000
@@ -5,7 +5,7 @@
  * functions use hints that are left in the windows by the commands.
  *
  *
- * $Header: /usr/build/vile/vile/RCS/display.c,v 1.413 2005/12/25 21:44:45 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/display.c,v 1.415 2006/01/12 23:46:38 tom Exp $
  *
  */
 
@@ -2725,6 +2725,7 @@
 		if (skip)
 		    mlfs_skipfix(&fs);
 		break;
+	    case 'r':
 	    case 'n':
 	    case 'N':
 		mlfs_prefix(&fs, &ms, lchar);
@@ -2735,12 +2736,18 @@
 			vl_strncpy(temp, bp->b_fname, sizeof(temp));
 			temp[sizeof(temp) - 1] = '\0';
 
-			if (fc == 'n') {
+			switch (fc) {
+			case 'r':
 			    p = shorten_path(temp, FALSE);
 			    if (p == 0)
 				p = temp;
-			} else {
+			    break;
+			case 'n':
+			    p = pathleaf(temp);
+			    break;
+			default:
 			    p = temp;
+			    break;
 			}
 			ms = lsprintf(ms, "%s", p);
 		    } else {
@@ -3684,7 +3691,7 @@
 	    kbd_flush();
 	}
 	if (do_crlf) {
-	    kbd_openup();
+	    term.openup();
 	}
 	endofDisplay();
     }
Index: doc/macros.doc
Prereq:  1.95 
--- vile-9.5e+/doc/macros.doc	2005-11-23 16:50:27.000000000 +0000
+++ vile-9.5f/doc/macros.doc	2006-02-16 01:22:49.000000000 +0000
@@ -202,8 +202,8 @@
 
 		store-procedure Filter f="Input" f="Output"
 
-	to begin a macro 'Filter' with two parameters, in/out, internally
-	referenced by $1 and $2.
+	to begin a macro 'Filter' with two parameters, Input and Output,
+	internally referenced by $1 and $2.
 
 	The 'enum' parameter type is special; it requires a second keyword
 	which denotes the symbol table which is used for name-completion.
@@ -231,6 +231,29 @@
 		visual-matches
 		vtflash
 
+    Returning values
+    ----------------
+	Any macro can return a value to a calling script.  This is done
+	using special variables:
+
+		$return	is a symbol that a macro can set to any string.
+
+		$_	is copied from $return when completing a macro.
+			If no string was assigned to $return within the
+			macro, $_ will contain a readable form of the
+			exit status.  These are the standard values used
+			within vile:
+
+				TRUE
+				FALSE
+				ABORT
+				SORTOFTRUE
+
+			$_ may also contain the special symbol ERROR if
+			the macro could not run, e.g., due to too much
+			recursion, or if the exit status was none of the
+			standard values.
+
     Storing macros
     --------------
 	In general, macros are stored in the editor's startup file.
@@ -1474,6 +1497,6 @@
 	========================= end vile.rc =======================
 
 -----------------------------------
-  $Header: /usr/build/vile/vile/doc/RCS/macros.doc,v 1.95 2005/11/23 16:50:27 cmorgan Exp $
+  $Header: /usr/build/vile/vile/doc/RCS/macros.doc,v 1.96 2006/02/16 01:22:49 tom Exp $
 -----------------------------------
 
Index: dumbterm.c
Prereq:  1.19 
--- vile-9.5e+/dumbterm.c	2005-11-23 12:19:35.000000000 +0000
+++ vile-9.5f/dumbterm.c	2006-01-12 23:13:40.000000000 +0000
@@ -1,6 +1,6 @@
 /*	Dumb terminal driver, for I/O before we get into screen mode.
  *
- * $Header: /usr/build/vile/vile/RCS/dumbterm.c,v 1.19 2005/11/23 12:19:35 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/dumbterm.c,v 1.21 2006/01/12 23:13:40 tom Exp $
  *
  */
 
@@ -128,6 +128,9 @@
     0,				/* ...and this, just in case we exit */
     dumb_kopen,
     dumb_kclose,
+    nullterm_clean,
+    nullterm_unclean,
+    nullterm_openup,
     dumb_getc,
     dumb_putc,
     dumb_typahead,
Index: edef.h
Prereq:  1.322 
--- vile-9.5e+/edef.h	2005-11-30 02:18:33.000000000 +0000
+++ vile-9.5f/edef.h	2006-02-16 00:13:49.000000000 +0000
@@ -6,7 +6,7 @@
  */
 
 /*
- * $Header: /usr/build/vile/vile/RCS/edef.h,v 1.322 2005/11/30 02:18:33 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/edef.h,v 1.323 2006/02/16 00:13:49 tom Exp $
  */
 
 #ifndef VILE_EDEF_H
@@ -297,6 +297,11 @@
 decl_init( char out_of_mem[], "Out of Memory" );
 decl_init( char error_val[], "ERROR" );
 
+#if OPT_EVAL
+decl_uninit( TBUFF *this_macro_result ); /* "$result" variable		*/
+decl_uninit( TBUFF *last_macro_result ); /* "$_" variable		*/
+#endif
+
 #if OPT_EVAL || OPT_COLOR
 decl_uninit( TBUFF *tb_curpalette );	/* current colormap palete	*/
 #endif
Index: estruct.h
Prereq:  1.592 
--- vile-9.5e+/estruct.h	2005-12-26 01:29:43.000000000 +0000
+++ vile-9.5f/estruct.h	2006-02-14 23:57:49.000000000 +0000
@@ -12,7 +12,7 @@
 */
 
 /*
- * $Header: /usr/build/vile/vile/RCS/estruct.h,v 1.592 2005/12/26 01:29:43 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/estruct.h,v 1.595 2006/02/14 23:57:49 tom Exp $
  */
 
 #ifndef _estruct_h
@@ -1928,8 +1928,8 @@
 typedef struct {
 	char *shortname;	/* name without "mode" suffix */
 	char *longname;		/* name with "mode" suffix */
-	M_VALUES mm;
-	Q_VALUES mq;
+	M_VALUES mm;		/* majormode-specific flags, e.g., "preamble" */
+	Q_VALUES mq;		/* qualifier values such as "group" */
 	MINORMODE *sm;
 } MAJORMODE;
 
@@ -2343,6 +2343,9 @@
 	void	(*close) (void);	/* Close terminal at end.	*/
 	void	(*kopen) (void);	/* keyboard open		*/
 	void	(*kclose) (void);	/* keyboard close		*/
+	void	(*clean) (int f);	/* cleanup before shell-out	*/
+	void	(*unclean) (void);	/* cleanup after shell-out	*/
+	void	(*openup) (void);	/* open new line for prompt	*/
 	int	(*getch) (void);	/* Get character from keyboard. */
 	OUTC_DCL(*putch) (OUTC_ARGS);	/* Put character to display.	*/
 	int	(*typahead) (void);	/* character ready?		*/
Index: eval.c
Prereq:  1.349 
--- vile-9.5e+/eval.c	2005-12-10 01:38:33.000000000 +0000
+++ vile-9.5f/eval.c	2006-02-16 01:02:34.000000000 +0000
@@ -2,7 +2,7 @@
  *	eval.c -- function and variable evaluation
  *	original by Daniel Lawrence
  *
- * $Header: /usr/build/vile/vile/RCS/eval.c,v 1.349 2005/12/10 01:38:33 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/eval.c,v 1.351 2006/02/16 01:02:34 tom Exp $
  *
  */
 
@@ -39,6 +39,7 @@
     struct PROC_ARGS *nxt_args;
     int num_args;		/* total argument count */
     TBUFF **all_args;
+    TBUFF *result;		/* function can assign to $return */
 } PROC_ARGS;
 
 static PROC_ARGS *arg_stack;
@@ -1306,25 +1307,35 @@
     return ILLEGAL_NUM;
 }
 
-/* get a state variable's value */
+/*
+ * Get a state variable's value.  This function may in turn be called by
+ * the statevar_func[], so it has to manage a stack of results.
+ */
 static char *
 get_statevar_val(int vnum)
 {
-    static TBUFF *result;
+    char *result = error_val;
+    static TBUFF *buffer[9];
+    static unsigned nested;
     int s;
 
-    if (vnum == ILLEGAL_NUM)
-	return error_val;
-
-    tb_init(&result, EOS);
-    s = (*statevar_func[vnum]) (&result, (const char *) NULL);
-
-    if (s == TRUE) {
-	tb_append(&result, EOS);	/* trailing null, just in case... */
-	return tb_values(result);
-    } else {
-	return error_val;
+    if (vnum != ILLEGAL_NUM) {
+	unsigned old_level = nested;
+	unsigned new_level = ((nested < TABLESIZE(buffer) - 1)
+			      ? (nested + 1)
+			      : nested);
+
+	nested = new_level;
+	tb_init(&buffer[nested], EOS);
+	s = (*statevar_func[vnum]) (&buffer[nested], (const char *) NULL);
+
+	if (s == TRUE) {
+	    tb_append(&buffer[nested], EOS);	/* trailing null, just in case... */
+	    result = tb_values(buffer[nested]);
+	}
+	nested = old_level;
     }
+    return result;
 }
 
 /*
@@ -2297,8 +2308,17 @@
 
 	p->nxt_args = arg_stack;
 	p->all_args = all_args;
+
 	arg_stack = p;
 
+	/*
+	 * Remember the caller's $return variable, if any.
+	 * Coming into a macro, we have no value in $return, but can leave $_
+	 * as is.
+	 */
+	p->result = this_macro_result;
+	this_macro_result = 0;
+
 	tb_scopy(&(p->all_args[num_args]), bp->b_bname);
 	if (p->all_args[num_args] == 0) {
 	    fail = TRUE;
@@ -2362,7 +2382,7 @@
 }
 
 /*
- * Pop the list of arguments off our stack
+ * Pop the list of arguments off our stack.
  */
 /* ARGSUSED */
 void
@@ -2373,6 +2393,12 @@
     TRACE(("restore_arguments(%s)\n", bp->b_bname));
 
     if (p != 0) {
+	/*
+	 * Restore the caller's $return variable.
+	 */
+	tb_free(&this_macro_result);
+	this_macro_result = p->result;
+
 	arg_stack = p->nxt_args;
 	while (p->num_args >= 0) {
 	    tb_free(&(p->all_args[p->num_args]));
Index: exec.c
Prereq:  1.281 
--- vile-9.5e+/exec.c	2005-11-23 21:20:59.000000000 +0000
+++ vile-9.5f/exec.c	2006-02-16 01:16:23.000000000 +0000
@@ -4,7 +4,7 @@
  *	original by Daniel Lawrence, but
  *	much modified since then.  assign no blame to him.  -pgf
  *
- * $Header: /usr/build/vile/vile/RCS/exec.c,v 1.281 2005/11/23 21:20:59 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/exec.c,v 1.282 2006/02/16 01:16:23 tom Exp $
  *
  */
 
@@ -2384,6 +2384,7 @@
 int
 dobuf(BUFFER *bp, int limit)
 {
+    TBUFF *macro_result = 0;
     int status = FALSE;
     WHLOOP *whlist;
     int save_vl_msgs;
@@ -2399,7 +2400,7 @@
 	save_cmd_count = cmd_count;
 
 	/* macro arguments are readonly, so we do this once */
-	if (save_arguments(bp) != ABORT) {
+	if ((status = save_arguments(bp)) != ABORT) {
 	    vl_msgs = FALSE;
 
 	    for (counter = 1; counter <= limit; counter++) {
@@ -2427,14 +2428,51 @@
 		    break;
 	    }
 
+	    /*
+	     * If the caller set $return, use that value.
+	     */
+	    if (this_macro_result != 0)
+		tb_copy(&macro_result, this_macro_result);
+
 	    restore_arguments(bp);
 	    vl_msgs = save_vl_msgs;
 	    cmd_count = save_cmd_count;
+	} else {
 	}
     } else {
 	mlwarn("[Too many levels of files]");
+	tb_error(&macro_result);
     }
     dobufnesting--;
+
+    /*
+     * Set $_ from our TBUFF (preferred), or a readable form of the status
+     * codes.  In the latter case, this is not the same as $status, since we
+     * try to show the ABORT and SORTOFTRUE cases as well.
+     */
+    tb_free(&last_macro_result);
+    if (macro_result != 0) {
+	last_macro_result = macro_result;
+    } else {
+	switch (status) {
+	case FALSE:
+	    tb_scopy(&last_macro_result, "FALSE");
+	    break;
+	case TRUE:
+	    tb_scopy(&last_macro_result, "TRUE");
+	    break;
+	case ABORT:
+	    tb_scopy(&last_macro_result, "ABORT");
+	    break;
+	case SORTOFTRUE:
+	    tb_scopy(&last_macro_result, "SORTOFTRUE");
+	    break;
+	default:
+	    tb_error(&last_macro_result);
+	    break;
+	}
+    }
+
     endofDisplay();
 
     return status;
Index: file.c
Prereq:  1.388 
--- vile-9.5e+/file.c	2005-11-15 22:32:22.000000000 +0000
+++ vile-9.5f/file.c	2006-02-15 01:25:01.000000000 +0000
@@ -5,7 +5,7 @@
  * reading and writing of the disk are
  * in "fileio.c".
  *
- * $Header: /usr/build/vile/vile/RCS/file.c,v 1.388 2005/11/15 22:32:22 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/file.c,v 1.390 2006/02/15 01:25:01 tom Exp $
  */
 
 #include "estruct.h"
@@ -255,7 +255,7 @@
 	    beginDisplay();
 	}
 #if SYS_UNIX || SYS_MSDOS
-	ttclean(TRUE);
+	term.clean(TRUE);
 #else
 #ifdef GMDW32PIPES
 	kbd_erase_to_end(0);
@@ -271,7 +271,7 @@
 {
     if (must_clean_pipe) {
 #if SYS_UNIX || SYS_MSDOS
-	ttunclean();		/* may clear the screen as a side-effect */
+	term.unclean();		/* may clear the screen as a side-effect */
 	term.kopen();
 	term.flush();
 	if (Wrote)
@@ -541,7 +541,7 @@
     WINDOW *wp;
     int n;
 
-    for (n = 0; n < MAX_B_VALUES; ++n) {
+    for (n = 0; n < NUM_B_VALUES; ++n) {
 	if (is_local_b_val(bp, n)) {
 	    make_global_b_val(bp, n);
 	}
@@ -2758,7 +2758,7 @@
     }
     term.cursorvis(TRUE);	/* ( this might work ;-) */
     if (signo != SIGHUP && signo != SIGINT) {
-	ttclean(FALSE);
+	term.clean(FALSE);
 #ifdef VILE_ERROR_ABORT
 	ExitProgram(signo);
 #else
Index: filters/bat-filt.l
Prereq:  1.21 
--- vile-9.5e+/filters/bat-filt.l	2005-09-02 23:27:59.000000000 +0000
+++ vile-9.5f/filters/bat-filt.l	2006-02-14 01:27:10.000000000 +0000
@@ -3,7 +3,7 @@
 %{
 
 /*
- * $Header: /usr/build/vile/vile/filters/RCS/bat-filt.l,v 1.21 2005/09/02 23:27:59 tom Exp $
+ * $Header: /usr/build/vile/vile/filters/RCS/bat-filt.l,v 1.22 2006/02/14 01:27:10 tom Exp $
  *
  * Filter to add vile "attribution" sequences to selected bits of DOS (and
  * similar, such as W95, NT) batch file.
@@ -54,6 +54,7 @@
 <INITIAL>{IDENT}		{ char *temp = lowercase_of(yytext);
 				  char *type = strrchr(temp, '.');
 				  char *attr;
+				  int echoing = 0;
 
 				  /* "echo." is a legal "echo", and the "."
 				   * is not echoed.  So we highlight it as
@@ -61,15 +62,16 @@
 				   */
 				  if (type != 0)
 				      *type = '\0';
+				  attr = keyword_attr(temp);
 				  if (!strcmp(temp, "echo")) {
 					BEGIN(ECHOING);
-				  } else if (!strcmp(temp, "rem")) {
+					echoing = 1;
+				  } else if (attr != 0 && Comment_attr == attr) {
 					BEGIN(COMMENT);
 				  } else if (!strcmp(temp, "set")) {
 					setting = 1;
 				  }
-				  attr = keyword_attr(temp);
-				  if (type != 0) {
+				  if (type != 0 && echoing) {
 				      int len = (type - temp) + 1;
 
 				      flt_puts(yytext, len, attr);
Index: filters/cpp.key
Prereq:  1.6 
--- vile-9.5e+/filters/cpp.key	2005-12-23 19:37:33.000000000 +0000
+++ vile-9.5f/filters/cpp.key	2006-01-15 20:28:53.000000000 +0000
@@ -1,4 +1,4 @@
-: $Id: cpp.key,v 1.6 2005/12/23 19:37:33 tom Exp $
+: $Id: cpp.key,v 1.7 2006/01/15 20:28:53 tom Exp $
 asm
 bool:Type
 catch
@@ -31,4 +31,5 @@
 .table cpre
 import
 .default
+.table c
 .include c
Index: filters/cs.key
--- /dev/null	2006-02-19 23:35:28.896544500 +0000
+++ vile-9.5f/filters/cs.key	2006-02-20 00:14:33.000000000 +0000
@@ -0,0 +1,108 @@
+: $Id: cs.key,v 1.1 2006/02/20 00:14:33 tom Exp $
+: C#
+: see "C# Language Specification", October 2002
+: produced by ECMA TC39/TG2
+
+abstract
+as
+base
+break
+case
+catch
+checked
+class
+const
+continue
+default
+delegate
+do
+else
+event
+explicit
+extern
+finally
+for
+foreach
+goto
+if
+implicit
+in
+interface
+internal
+is
+lock
+namespace
+new
+operator
+out
+override
+params
+private
+protected
+public
+readonly
+ref
+return
+sealed
+sizeof
+stackalloc
+static
+string
+struct
+switch
+this
+throw
+true
+try
+typeof
+uint
+ulong
+unchecked
+unsafe
+ushort
+using
+virtual
+void
+volatile
+while
+
+: value types
+.default Type
+bool
+byte
+char
+decimal
+double
+enum
+fixed
+float
+int
+long
+object
+sbyte
+short
+string
+uint
+ulong
+ushort
+void
+
+.default Number
+false
+null
+true
+
+: preprocessing
+.table cpre
+define
+elif
+else
+endif
+endregion
+error
+if
+line
+region
+undef
+warning
+.default
Index: filters/filters.rc
Prereq:  1.203 
--- vile-9.5e+/filters/filters.rc	2005-11-15 23:06:55.000000000 +0000
+++ vile-9.5f/filters/filters.rc	2006-02-19 23:50:48.000000000 +0000
@@ -1,4 +1,4 @@
-; $Id: filters.rc,v 1.203 2005/11/15 23:06:55 tom Exp $
+; $Id: filters.rc,v 1.204 2006/02/19 23:50:48 tom Exp $
 ; majormodes in this file are ordered alphabetically for convenience - the
 ; precedence used by vile is strictly alphabetic, counting case.
 
@@ -16,6 +16,11 @@
 	filtername	'vile-c-filt -k cpp'
 ~endwith
 
+define-mode cs
+~with define-submode cs
+	filtername	'vile-c-filt -k cs'
+~endwith
+
 define-mode csh
 ~with define-submode csh
 	filtername	'vile-sh-filt -k csh'
Index: filters/htmlfilt.l
Prereq:  1.35 
--- vile-9.5e+/filters/htmlfilt.l	2005-09-04 21:10:12.000000000 +0000
+++ vile-9.5f/filters/htmlfilt.l	2006-02-14 00:58:42.000000000 +0000
@@ -1,8 +1,8 @@
-%x HTMLNOTE HTMLCODE JS_NOTE JS_CODE JSP_MODE
+%x HTMLNOTE HTMLCODE HTMLQUOT JS_NOTE JS_CODE JSP_MODE
 
 %{
 /*
- * $Header: /usr/build/vile/vile/filters/RCS/htmlfilt.l,v 1.35 2005/09/04 21:10:12 tom Exp $
+ * $Header: /usr/build/vile/vile/filters/RCS/htmlfilt.l,v 1.36 2006/02/14 00:58:42 tom Exp $
  *
  * Filter to add vile "attribution" sequences to selected bits of HTML input
  * text.
@@ -36,15 +36,14 @@
 HEXNUM		"#"[xX]?[[:xdigit:]]+
 IDENT		[[:alpha:]_][[:alnum:]_-]*
 
-HSTRING		\"([^"])*\"
-QSTRING		\\["]([^"]|\\["])*\\["]
-STRING		{HSTRING}|{QSTRING}
+STRING		\"([^"])*\"
 
 SSTRING		\'(\\.|[^'\\])*\'
 DSTRING		\"(\\.|[^"\\])*\"
 STRINGS		({SSTRING}|{DSTRING})
 
-ESCAPED		&({IDENT}|{HEXNUM});
+URI_REF		"%"[[:xdigit:]][[:xdigit:]]
+CHR_REF		&({IDENT}|{HEXNUM});
 
 %%
 
@@ -71,8 +70,14 @@
 <HTMLNOTE>[-]+[^-\>\n]*	{ flt_bfr_append(yytext, yyleng); }
 <HTMLNOTE>[-]+"->"	{ FinishQuote(INITIAL); }
 
-<INITIAL>{ESCAPED}	|
-<HTMLCODE>{STRING}	{ WriteToken(String_attr); }
+<INITIAL,HTMLCODE>{URI_REF}	|
+<INITIAL,HTMLCODE>{CHR_REF}	{ WriteToken(Number_attr); }
+
+<HTMLCODE>["]		{ BeginQuote(HTMLQUOT, String_attr); }
+<HTMLQUOT>{URI_REF}	|
+<HTMLQUOT>{CHR_REF}	{ flt_bfr_embed(yytext, yyleng, Number_attr); }
+<HTMLQUOT>[^"]		{ flt_bfr_append(yytext, yyleng); }
+<HTMLQUOT>["]		{ FinishQuote(HTMLCODE); }
 
 <HTMLCODE>{REAL}	|
 <HTMLCODE>{INTEGER}	|
Index: filters/makefile.2nd
Prereq:  1.11 
--- vile-9.5e+/filters/makefile.2nd	2005-09-04 19:56:39.000000000 +0000
+++ vile-9.5f/filters/makefile.2nd	2006-02-15 20:23:32.000000000 +0000
@@ -1,4 +1,4 @@
-# $Header: /usr/build/vile/vile/filters/RCS/makefile.2nd,v 1.11 2005/09/04 19:56:39 tom Exp $
+# $Header: /usr/build/vile/vile/filters/RCS/makefile.2nd,v 1.12 2006/02/15 20:23:32 tom Exp $
 #
 
 .SUFFIXES: .l .c .i $o
@@ -102,11 +102,11 @@
 	$(AR) $(AR_OPTS) $@ $(LOBJS)
 	$(RANLIB) $@
 
-atr2ansi$x : atr2ansi$o	unfilter$o ; $(CC) -o $@ atr2ansi$o unfilter$o $(LDFLAGS)
-atr2html$x : atr2html$o	unfilter$o ; $(CC) -o $@ atr2html$o unfilter$o $(LDFLAGS)
-atr2text$x : atr2text$o	unfilter$o ; $(CC) -o $@ atr2text$o unfilter$o $(LDFLAGS)
-vile-crypt$x :	ecrypt$o	; $(CC) -o $@ ecrypt$o $(LDFLAGS)
-vile-manfilt$x : manfilt$o	; $(CC) -o $@ manfilt$o $(LDFLAGS)
+atr2ansi$x : atr2ansi$o	unfilter$o ; $(LINK) -o $@ atr2ansi$o unfilter$o $(LDFLAGS)
+atr2html$x : atr2html$o	unfilter$o ; $(LINK) -o $@ atr2html$o unfilter$o $(LDFLAGS)
+atr2text$x : atr2text$o	unfilter$o ; $(LINK) -o $@ atr2text$o unfilter$o $(LDFLAGS)
+vile-crypt$x :	ecrypt$o	; $(LINK) -o $@ ecrypt$o $(LDFLAGS)
+vile-manfilt$x : manfilt$o	; $(LINK) -o $@ manfilt$o $(LDFLAGS)
 
 $(BINDIR)/atr2ansi$x :		atr2ansi$x		; $(INSTALL) $? $@
 $(BINDIR)/atr2html$x :		atr2html$x		; $(INSTALL) $? $@
Index: filters/sh-filt.l
Prereq:  1.64 
--- vile-9.5e+/filters/sh-filt.l	2005-09-05 14:29:59.000000000 +0000
+++ vile-9.5f/filters/sh-filt.l	2006-02-20 00:45:18.000000000 +0000
@@ -5,7 +5,7 @@
 
 %{
 /*
- * $Header: /usr/build/vile/vile/filters/RCS/sh-filt.l,v 1.64 2005/09/05 14:29:59 tom Exp $
+ * $Header: /usr/build/vile/vile/filters/RCS/sh-filt.l,v 1.65 2006/02/20 00:45:18 tom Exp $
  *
  * Filter to add vile "attribution" sequences to selected bits of Shell script.
  */
@@ -165,8 +165,9 @@
 
 <SUBST>{BACKTIC}	{ handle_backtic(yytext, yyleng); }
 <SUBST>{IDENT2R}	{ flt_bfr_embed(yytext, yyleng, Ident_attr); pop_stk(); }
+<SUBST>\\\"		{ flt_bfr_embed(yytext, yyleng, String_attr); }
 <SUBST>\"		{ push_stk(QUOTED); BeginQuote(QUOTED, String_attr); }
-<SUBST>[^"}]+		{ flt_bfr_embed(yytext, yyleng, ""); }
+<SUBST>[^"}\\]+		{ flt_bfr_embed(yytext, yyleng, ""); }
 
 %%
 
Index: macros/modes.rc
Prereq:  1.33 
--- vile-9.5e+/macros/modes.rc	2006-01-04 23:03:34.000000000 +0000
+++ vile-9.5f/macros/modes.rc	2006-02-20 00:36:05.000000000 +0000
@@ -1,4 +1,4 @@
-; $Id: modes.rc,v 1.33 2006/01/04 23:03:34 cmorgan Exp $
+; $Id: modes.rc,v 1.36 2006/02/20 00:36:05 tom Exp $
 ; majormodes in this file are ordered alphabetically for convenience - the
 ; precedence used by vile is strictly alphabetic, counting case.  Use the
 ; before and after qualifiers to override the precedence.
@@ -141,6 +141,17 @@
 	cindent-chars   &cat ':#' $fences
 ~endwith
 
+; "C#", aka "C-flat" or "C-sharp".
+define-mode cs
+~with define-submode cs
+	suffixes	'\.\(cs\)$'
+	cindent
+	cindent-chars   &cat ':#' $fences
+	tabstop=4
+	shiftwidth=4
+	dos
+~endwith
+
 define-mode csh
 ~with define-submode csh
 	suffixes	'\.\(csh.*\|login\|logout\)$'
@@ -731,9 +742,29 @@
 	dos
 	ignorecase
 	notabinsert
-	sections '^\(Public\|Private\)\s\+\(Sub\|Function\)'
+	fence-if	'^\s*if\>'
+	fence-elif	'^\s*elseif\>'
+	fence-else	'^\s*else\>'
+	fence-fi	'^\s*end\s\+if\>'
+	sections '^\(Public\|Private\)\s\+\(Sub\|Function\|Property\)'
+~elsewith define-submode vb group 'for-loop'
+	fence-if	'^\s*for\>'
+	fence-fi	'^\s*next\>'
+~elsewith define-submode vb group 'while-loop'
+	fence-if	'^\s*while\>'
+	fence-fi	'^\s*wend\>'
+~elsewith define-submode vb group 'sub'
+	fence-if	'^\s*\(\(Public\|Private\)\s\+\)\?sub\>'
+	fence-fi	'^\s*end\s\+sub\>'
+~elsewith define-submode vb group 'function'
+	fence-if	'^\s*\(\(Public\|Private\)\s\+\)\?function\>'
+	fence-fi	'^\s*end\s\+function\>'
+~elsewith define-submode vb group 'property'
+	fence-if	'^\s*\(\(Public\|Private\)\s\+\)\?property\>'
+	fence-fi	'^\s*end\s\+property\>'
 ~endwith
 
+; FIXME this should be the same as vbmode except for the preamble
 define-mode vbs
 ~with define-submode vbs
 	before		"basic"
Index: main.c
Prereq:  1.546 
--- vile-9.5e+/main.c	2005-11-30 01:24:33.000000000 +0000
+++ vile-9.5f/main.c	2006-01-12 22:37:21.000000000 +0000
@@ -22,7 +22,7 @@
  */
 
 /*
- * $Header: /usr/build/vile/vile/RCS/main.c,v 1.546 2005/11/30 01:24:33 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/main.c,v 1.549 2006/01/12 22:37:21 tom Exp $
  */
 
 #define realdef			/* Make global definitions not external */
@@ -91,7 +91,6 @@
 static void main_loop(void);
 static void make_startup_file(char *name);
 static void siginit(int enabled);
-static void start_debug_log(int ac, char **av);
 
 extern const int nametblsize;
 
@@ -247,8 +246,6 @@
     setuid(geteuid());
 #endif
 
-    start_debug_log(argc, argv);
-
     get_executable_dir();
 
     if (strcmp(pathleaf(prog_arg), "view") == 0)
@@ -262,17 +259,6 @@
 #endif
 
     /*
-     * Do not try to pipe results (vile has no ex-mode, which would be used
-     * in this case).
-     */
-#if DISP_TERMCAP || DISP_CURSES || DISP_ANSI
-    if (!isatty(fileno(stdout))) {
-	fprintf(stderr, "vile: ex mode is not implemented\n");
-	ExitProgram(BADEXIT);
-    }
-#endif
-
-    /*
      * Allow for I/O to the command-line before we initialize the screen
      * driver.
      *
@@ -446,6 +432,18 @@
 #endif
 	}
     }
+
+    /*
+     * Do not try to pipe results (vile has no ex-mode, which would be used
+     * in this case).
+     */
+#if DISP_TERMCAP || DISP_CURSES || DISP_ANSI
+    if (!isatty(fileno(stdout))) {
+	fprintf(stderr, "vile: ex mode is not implemented\n");
+	ExitProgram(BADEXIT);
+    }
+#endif
+
 #ifdef VILE_OLE
     if (ole_register) {
 	/*
@@ -1003,7 +1001,7 @@
 #if DISP_X11
     term.close();		/* need this if $xshell left subprocesses */
 #endif
-    ttclean(TRUE);
+    term.clean(TRUE);
 #if SYS_UNIX
     setup_handler(SIGHUP, SIG_IGN);
 #endif
@@ -2649,79 +2647,22 @@
 }
 #endif /* OPT_HEAPSIZE */
 
-#ifdef MALLOCDEBUG
-mallocdbg(int f, int n)
-{
-    int lvl;
-    lvl = malloc_debug(n);
-    mlwrite("malloc debug level was %d", lvl);
-    if (!f) {
-	malloc_debug(lvl);
-    } else if (n > 2) {
-	malloc_verify();
-    }
-    return TRUE;
-}
-#endif
-
-/*
- *	the log file is left open, unbuffered.  thus any code can do
- *
- *	extern FILE *FF;
- *	fprintf(FF, "...", ...);
- *
- *	to log events without disturbing the screen
- */
-
-#ifdef DEBUGLOG
-/* suppress the declaration so that the link will fail if someone uses it */
-FILE *FF;
-#endif
-
-/*ARGSUSED*/
-static void
-start_debug_log(int ac GCC_UNUSED, char **av GCC_UNUSED)
-{
-#ifdef DEBUGLOG
-    int i;
-    FF = fopen("vilelog", "w");
-    setbuf(FF, NULL);
-    for (i = 0; i < ac; i++)
-	(void) fprintf(FF, "arg %d: %s\n", i, av[i]);
-#endif
-}
-
 #if SYS_MSDOS
-
-#if CC_TURBO
 int
 showmemory(int f, int n)
 {
+#if CC_TURBO
     extern long coreleft(void);
     mlforce("Memory left: %ld bytes", coreleft());
-    return TRUE;
-}
-#endif
-
-#if CC_WATCOM
-int
-showmemory(int f, int n)
-{
+#elif CC_WATCOM
     mlforce("Watcom C doesn't provide a very useful 'memory-left' call.");
-    return TRUE;
-}
-#endif
-
-#if CC_DJGPP
-int
-showmemory(int f, int n)
-{
+#elif CC_DJGPP
     mlforce("Memory left: %ld Kb virtual, %ld Kb physical",
 	    _go32_dpmi_remaining_virtual_memory() / 1024,
 	    _go32_dpmi_remaining_physical_memory() / 1024);
+#endif
     return TRUE;
 }
-#endif
 #endif /* SYS_MSDOS */
 
 char *
Index: makefile.blc
Prereq:  1.18 
--- vile-9.5e+/makefile.blc	2004-12-06 19:43:51.000000000 +0000
+++ vile-9.5f/makefile.blc	2006-01-11 00:00:59.000000000 +0000
@@ -1,7 +1,7 @@
 #
 # makefile for vile on WIN32 using Borland C++
 #
-# $Header: /usr/build/vile/vile/RCS/makefile.blc,v 1.18 2004/12/06 19:43:51 tom Exp $
+# $Header: /usr/build/vile/vile/RCS/makefile.blc,v 1.19 2006/01/11 00:00:59 tom Exp $
 #
 # Tested with
 #	Borland C++ 5.5.1
@@ -59,7 +59,7 @@
 	fences.c file.c filec.c \
 	fileio.c finderr.c glob.c globals.c history.c \
 	input.c insert.c itbuff.c isearch.c \
-	line.c modes.c msgs.c oneliner.c opers.c \
+	line.c modes.c msgs.c nullterm.c oneliner.c opers.c \
 	path.c random.c regexp.c \
 	region.c search.c select.c spawn.c statevar.c \
 	tags.c tbuff.c termio.c ucrypt.c undo.c \
@@ -71,7 +71,7 @@
 	fences.obj file.obj filec.obj \
 	fileio.obj finderr.obj glob.obj globals.obj history.obj \
 	input.obj insert.obj itbuff.obj isearch.obj \
-	line.obj modes.obj msgs.obj oneliner.obj opers.obj \
+	line.obj modes.obj msgs.obj nullterm.obj oneliner.obj opers.obj \
 	path.obj random.obj regexp.obj \
 	region.obj search.obj select.obj spawn.obj statevar.obj \
 	tags.obj tbuff.obj termio.obj ucrypt.obj undo.obj \
@@ -125,24 +125,28 @@
 	- del *.obj
 	- del ne*.h
 
-bind.obj:	nefunc.h
-eval.obj:	nevars.h
-exec.obj:	nefunc.h
-externs.obj:	nebind.h nename.h neproto.h nefunc.h
-filec.obj:	dirstuff.h
-glob.obj:	dirstuff.h
-globals.obj:	nefunc.h
-main.obj:	chgdfunc.h nevars.h
-modes.obj:	chgdfunc.h
-opers.obj:	nefunc.h
-path.obj:	dirstuff.h
-random.obj:	nefunc.h
-select.obj:	nefunc.h
-statevar.obj:	nevars.h
-spawn.obj:	nefunc.h
-termio.obj:	nefunc.h
-version.obj:	patchlev.h
-word.obj:	nefunc.h
+$(OBJ) :	$(BUILTHDRS)
+
+api.obj :	api.h
+bind.obj :	btree.h
+btree.obj :	btree.h
+display.obj :	pscreen.h
+filec.obj :	dirstuff.h
+glob.obj :	dirstuff.h
+main.obj :	chgdfunc.h 
+modes.obj :	chgdfunc.h 
+ntwinio.obj :	winvile.h pscreen.h patchlev.h
+path.obj :	dirstuff.h
+perl.obj :	api.h
+random.obj :	dirstuff.h
+statevar.obj :	patchlev.h
+tags.obj :	btree.h
+version.obj :	patchlev.h
+w32cmd.obj :	winvile.h
+w32ole.obj :	w32ole.h winviletlb.h w32reg.h
+w32oo.obj :	dirstuff.h
+w32reg.obj :	w32reg.h
+wvwrap.obj :	w32reg.h w32ole.h winviletlb.h
 
 winvile.res :	winvile.rc winvile.h
 	$(RC) -32 -I$(MAKEDIR)\..\include -DVILE_ICON="$(ICON).ico" -Iicons winvile.rc
Index: makefile.djg
Prereq:  1.34 
--- vile-9.5e+/makefile.djg	2005-11-30 01:17:49.000000000 +0000
+++ vile-9.5f/makefile.djg	2006-01-10 23:59:10.000000000 +0000
@@ -3,7 +3,7 @@
 #
 # T.DANG (dang@cogit.ign.fr)
 #
-# $Header: /usr/build/vile/vile/RCS/makefile.djg,v 1.34 2005/11/30 01:17:49 tom Exp $
+# $Header: /usr/build/vile/vile/RCS/makefile.djg,v 1.35 2006/01/10 23:59:10 tom Exp $
 #
 #
 
@@ -34,7 +34,7 @@
 	csrch.c display.c eval.c exec.c externs.c fences.c file.c filec.c \
 	fileio.c finderr.c glob.c globals.c history.c \
 	input.c insert.c itbuff.c isearch.c \
-	line.c modes.c msgs.c npopen.c oneliner.c opers.c \
+	line.c modes.c msgs.c npopen.c nullterm.c oneliner.c opers.c \
 	path.c random.c regexp.c \
 	region.c search.c select.c spawn.c statevar.c \
 	tags.c tbuff.c termio.c ucrypt.c undo.c \
Index: makefile.icc
Prereq:  1.15 
--- vile-9.5e+/makefile.icc	2005-11-29 20:28:16.000000000 +0000
+++ vile-9.5f/makefile.icc	2006-01-10 23:58:44.000000000 +0000
@@ -1,6 +1,6 @@
 #
 # 'vile' and 'mktbls' makefile for IBM C Set ++ 2.x (OS/2)
-# $Header: /usr/build/vile/vile/RCS/makefile.icc,v 1.15 2005/11/29 20:28:16 tom Exp $
+# $Header: /usr/build/vile/vile/RCS/makefile.icc,v 1.16 2006/01/10 23:58:44 tom Exp $
 #
 
 #
@@ -57,7 +57,6 @@
 mktbls$O: mktbls.c
 
 VILE_DEPS =  \
- version$O \
  basic$O \
  bind$O \
  btree$O \
@@ -77,13 +76,15 @@
  history$O \
  input$O \
  insert$O \
- itbuff$O \
  isearch$O \
+ itbuff$O \
  line$O \
+ main$O \
  map$O \
  modes$O \
  msgs$O \
  npopen$O \
+ nullterm$O \
  oneliner$O \
  opers$O \
  os2pipe$O \
@@ -93,17 +94,17 @@
  region$O \
  search$O \
  select$O \
- statevar$O \
  spawn$O \
+ statevar$O \
  tags$O \
  tbuff$O \
  termio$O \
  ucrypt$O \
  undo$O \
+ version$O \
  window$O \
  word$O \
  wordmov$O \
- main$O \
  $(SCREEN)$O
 
 #		*Explicit Rules*
@@ -169,6 +170,8 @@
 
 npopen$O:	$(VILE_CFG) npopen.c
 
+nullterm$O:	$(VILE_CFG) nullterm.c
+
 oneliner$O:	$(VILE_CFG) oneliner.c
 
 opers$O:	$(VILE_CFG) opers.c 	nefunc.h
Index: makefile.in
Prereq:  1.199 
--- vile-9.5e+/makefile.in	2006-01-09 20:48:25.000000000 +0000
+++ vile-9.5f/makefile.in	2006-02-17 00:50:20.000000000 +0000
@@ -20,7 +20,7 @@
 #
 # gnu autoconf support by kevin buettner, 5/94
 #
-# $Header: /usr/build/vile/vile/RCS/makefile.in,v 1.199 2006/01/09 20:48:25 tom Exp $
+# $Header: /usr/build/vile/vile/RCS/makefile.in,v 1.202 2006/02/17 00:50:20 tom Exp $
 
 SHELL		= /bin/sh
 
@@ -64,6 +64,7 @@
 libdir		= @libdir@
 bindir		= @bindir@
 datadir		= @datadir@/vile
+docdir		= $(datadir)/doc
 perldir		= $(datadir)/perl
 mandir		= @mandir@/man$(manext)
 
@@ -85,10 +86,11 @@
 
 BINDIR		= $(DESTDIR)$(bindir)
 DATADIR		= $(DESTDIR)$(datadir)
+DOCDIR		= $(DESTDIR)$(docdir)
 PERLDIR		= $(DESTDIR)$(perldir)
 MANDIR		= $(DESTDIR)$(mandir)
 
-INSTALL_DIRS    = $(BINDIR) $(DATADIR) $(MANDIR) @EXTRA_INSTALL_DIRS@
+INSTALL_DIRS    = $(BINDIR) $(DATADIR) $(DOCDIR) $(MANDIR) @EXTRA_INSTALL_DIRS@
 
 .SUFFIXES: .c .i $o
 
@@ -101,8 +103,7 @@
 
 # All of the makefiles which should be preserved and distributed
 UNIXMAKIN = makefile.in				# for use with configure
-VMSMAK =   descrip.mms vmsbuild.com		# on VMS
-MSCMAK =	# still waiting for this one	# on DOS, using Microsoft C
+VMSMAK = descrip.mms vmsbuild.com		# on VMS
 DJGPPMAK = makefile.djg				# on DOS, DJGCC v1.09
 NTMAK = makefile.wnt				# on Windows/NT
 BCCNTMAK = makefile.blc				# Borland C on Windows/NT
@@ -112,7 +113,6 @@
 	$(UNIXMAKIN) \
 	$(VMSMAK) \
 	$(DJGPPMAK) \
-	$(MSCMAK) \
 	$(BORMAK) \
 	$(NTMAK) \
 	$(BCCNTMAK) \
@@ -175,7 +175,6 @@
 	$(srcdir)/perl/vileget \
 	$(srcdir)/perl/winops.pm
 
-
 MACRO_SRC = \
 	$(srcdir)/macros/color-ls.rc \
 	$(srcdir)/macros/dates.rc \
@@ -202,15 +201,16 @@
 
 # documentation, such as it is
 DOCS =	\
+	doc/Vileserv.doc \
 	doc/config.doc \
-	doc/hilite.doc \
+	doc/dir.doc \
+	doc/filters.doc \
 	doc/macros.doc \
 	doc/menus.doc \
 	doc/modes.doc \
 	doc/oleauto.doc \
 	doc/perl.doc \
 	doc/visvile.doc \
-	doc/w32modes.doc \
 	vile.1 \
 	vile.hlp
 
@@ -224,7 +224,7 @@
 	display.c dumbterm.c eval.c exec.c externs.c fences.c file.c \
 	filec.c fileio.c finderr.c glob.c globals.c \
 	history.c input.c insert.c isearch.c itbuff.c lckfiles.c line.c map.c \
-	modes.c msgs.c npopen.c oneliner.c opers.c path.c random.c \
+	modes.c msgs.c npopen.c nullterm.c oneliner.c opers.c path.c random.c \
 	regexp.c region.c search.c select.c spawn.c statevar.c tags.c \
 	tbuff.c termio.c ucrypt.c undo.c version.c \
 	watch.c window.c word.c wordmov.c xterm.c
@@ -233,7 +233,7 @@
 
 # this is for work-in-progress files being shared among developers
 #  which don't need to go into general releases yet.
-DEVELOPER_ONLY = NOTES.X11 empty.rc mktbls.bat \
+DEVELOPER_ONLY = \
 	trace.c trace.h \
 	fakevms.c fakevms.h
 
@@ -273,7 +273,7 @@
 	display$o dumbterm$o eval$o exec$o externs$o fences$o file$o \
 	filec$o fileio$o finderr$o glob$o globals$o \
 	input$o insert$o itbuff$o lckfiles$o line$o map$o \
-	modes$o msgs$o oneliner$o opers$o path$o random$o \
+	modes$o msgs$o nullterm$o oneliner$o opers$o path$o random$o \
 	regexp$o region$o search$o tags$o \
 	tbuff$o termio$o undo$o version$o \
 	watch$o window$o word$o wordmov$o @EXTRAOBJS@
@@ -337,6 +337,18 @@
 check: $(TARGET)
 	@echo Sorry, no batch tests available.
 
+INSTALL_DOC_FILES = \
+	$(DOCDIR)/Vileserv.doc \
+	$(DOCDIR)/config.doc \
+	$(DOCDIR)/dir.doc \
+	$(DOCDIR)/filters.doc \
+	$(DOCDIR)/macros.doc \
+	$(DOCDIR)/menus.doc \
+	$(DOCDIR)/modes.doc \
+	$(DOCDIR)/oleauto.doc \
+	$(DOCDIR)/perl.doc \
+	$(DOCDIR)/visvile.doc
+
 INSTALL_MACRO_FILES = \
 	$(DATADIR)/color-ls.rc \
 	$(DATADIR)/dates.rc \
@@ -398,14 +410,27 @@
 	$(INSTALL_FILES)
 	@echo 'Completed installation.'
 
-install-perl : $(INSTALL_PERL_DIRS) $(INSTALL_PERL_FILES)
+install-doc :		$(DOCDIR)		$(INSTALL_DOC_FILES)
+
+install-macros :	$(DATADIR)		$(INSTALL_MACRO_FILES)
 
-installdirs: $(INSTALL_DIRS)
+install-perl :		$(INSTALL_PERL_DIRS)	$(INSTALL_PERL_FILES)
+
+installdirs:		$(INSTALL_DIRS)
 
 uninstall-$(TARGET) \
 uninstall ::
 	- $(RM) $(INSTALL_FILES)
 
+uninstall-doc :
+	- $(RM) $(INSTALL_DOC_FILES)
+
+uninstall-macros :
+	- $(RM) $(INSTALL_MACRO_FILES)
+
+uninstall-perl :
+	- $(RM) $(INSTALL_PERL_FILES)
+
 # The makefile is technically dependent upon the config.status file, but
 # gmake gets overly ambitious and remakes the makefile too often.
 makefile: makefile.in
@@ -595,32 +620,27 @@
 		-typemap ptypemap \
 		$(srcdir)/perl.xs > $@
 
-$(OBJ): estruct.h $(BUILTHDRS)
+$(OBJ): estruct.h edef.h $(BUILTHDRS)
 
 api$o :		api.h
-bind$o :	nefunc.h btree.h
+bind$o :	btree.h
 btree$o :	btree.h
-eval$o :	nevars.h
-exec$o :	neexec.h nefunc.h
-externs$o :	nebind.h nename.h neproto.h nefunc.h
+curses$o :	tcap.h xtermkeys.h
+display$o :	pscreen.h
 filec$o :	dirstuff.h
 glob$o :	dirstuff.h
-globals$o :	nefunc.h
-main$o :	chgdfunc.h nevars.h
-modes$o :	chgdfunc.h nefsms.h
-opers$o :	nefunc.h
+main$o :	chgdfunc.h
+modes$o :	chgdfunc.h
 path$o :	dirstuff.h
 perl$o :	api.h
-random$o :	nefunc.h
-select$o :	nefunc.h
-statevar$o :	nevars.h
-spawn$o :	nefunc.h
+random$o :	dirstuff.h
+statevar$o :	patchlev.h
 tags$o :	btree.h
-tcap$o :	tcap.h
-termio$o :	nefunc.h
+tcap$o :	tcap.h xtermkeys.h
 version$o :	patchlev.h
-word$o :	nefunc.h
-x11$o :		nefunc.h
+x11$o :		pscreen.h
+
+# test-drivers
 
 test_btree$x:	btree.c
 	$(CC) -o $@ -DDEBUG_BTREE $(CPPFLAGS) $(CFLAGS) btree.c $(LDFLAGS)
@@ -628,6 +648,14 @@
 test_regexp$x:	regexp.c
 	$(CC) -o $@ -DDEBUG_REGEXP $(CPPFLAGS) $(CFLAGS) regexp.c $(LDFLAGS)
 
+TEST_IO_OBJS	= \
+	$(SCREEN)$o \
+	nullterm$o \
+	test_io$o
+
+test_io$x :	$(TEST_IO_OBJS)
+	$(CC) -o $@ $(TEST_IO_OBJS) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(LIBS)
+
 # dependency-rules for install/installdirs
 $(BINDIR)/$(TARGET):		$(TARGET)
 	$(INSTALL_PROGRAM)	$(TARGET) $@
@@ -641,6 +669,27 @@
 	sed -e 's/ vile / @TARGET@ /' $(srcdir)/macros/vile-pager >$@
 	chmod 755 $@
 
+$(DOCDIR)/Vileserv.doc:		$(srcdir)/doc/Vileserv.doc
+	$(INSTALL_DATA)		$(srcdir)/doc/Vileserv.doc $@
+$(DOCDIR)/config.doc:		$(srcdir)/doc/config.doc
+	$(INSTALL_DATA)		$(srcdir)/doc/config.doc $@
+$(DOCDIR)/dir.doc:		$(srcdir)/doc/dir.doc
+	$(INSTALL_DATA)		$(srcdir)/doc/dir.doc $@
+$(DOCDIR)/filters.doc:		$(srcdir)/doc/filters.doc
+	$(INSTALL_DATA)		$(srcdir)/doc/filters.doc $@
+$(DOCDIR)/macros.doc:		$(srcdir)/doc/macros.doc
+	$(INSTALL_DATA)		$(srcdir)/doc/macros.doc $@
+$(DOCDIR)/menus.doc:		$(srcdir)/doc/menus.doc
+	$(INSTALL_DATA)		$(srcdir)/doc/menus.doc $@
+$(DOCDIR)/modes.doc:		$(srcdir)/doc/modes.doc
+	$(INSTALL_DATA)		$(srcdir)/doc/modes.doc $@
+$(DOCDIR)/oleauto.doc:		$(srcdir)/doc/oleauto.doc
+	$(INSTALL_DATA)		$(srcdir)/doc/oleauto.doc $@
+$(DOCDIR)/perl.doc:		$(srcdir)/doc/perl.doc
+	$(INSTALL_DATA)		$(srcdir)/doc/perl.doc $@
+$(DOCDIR)/visvile.doc:		$(srcdir)/doc/visvile.doc
+	$(INSTALL_DATA)		$(srcdir)/doc/visvile.doc $@
+
 $(DATADIR)/color-ls.rc:		$(srcdir)/macros/color-ls.rc
 	$(INSTALL_DATA)		$(srcdir)/macros/color-ls.rc $@
 $(DATADIR)/dates.rc:		$(srcdir)/macros/dates.rc
Index: makefile.wnt
Prereq:  1.89 
--- vile-9.5e+/makefile.wnt	2006-01-10 00:20:15.000000000 +0000
+++ vile-9.5f/makefile.wnt	2006-01-15 19:02:35.000000000 +0000
@@ -1,7 +1,7 @@
 #
 # makefile for vile on WIN32 using Microsoft Visual C++
 #
-# $Header: /usr/build/vile/vile/RCS/makefile.wnt,v 1.89 2006/01/10 00:20:15 tom Exp $
+# $Header: /usr/build/vile/vile/RCS/makefile.wnt,v 1.91 2006/01/15 19:02:35 tom Exp $
 #
 #
 !include <ntwin32.mak>
@@ -208,7 +208,7 @@
 	fences.c file.c filec.c \
 	fileio.c finderr.c glob.c globals.c history.c \
 	input.c insert.c itbuff.c isearch.c \
-	line.c modes.c msgs.c oneliner.c opers.c \
+	line.c modes.c msgs.c nullterm.c oneliner.c opers.c \
 	path.c random.c regexp.c \
 	region.c search.c select.c spawn.c statevar.c \
 	tags.c tbuff.c termio.c ucrypt.c undo.c \
@@ -222,7 +222,7 @@
 	fences.obj file.obj filec.obj \
 	fileio.obj finderr.obj glob.obj globals.obj history.obj \
 	input.obj insert.obj itbuff.obj isearch.obj \
-	line.obj modes.obj msgs.obj oneliner.obj opers.obj \
+	line.obj modes.obj msgs.obj nullterm.obj oneliner.obj opers.obj \
 	path.obj random.obj regexp.obj \
 	region.obj search.obj select.obj spawn.obj statevar.obj \
 	tags.obj tbuff.obj termio.obj ucrypt.obj undo.obj \
@@ -315,6 +315,7 @@
 
 TEST_IO_OBJS	= \
 	$(SCREEN).obj \
+	nullterm.obj \
 	test_io.obj
 
 test_io.exe :		$(TEST_IO_OBJS)
@@ -356,6 +357,7 @@
 
 SCRIPTS	= \
 	filters\filters.rc \
+	filters\spell.rc \
 	macros\dates.rc \
 	macros\digraphs.rc \
 	macros\gnugpg.rc \
@@ -384,32 +386,23 @@
 	- !copy $** "$(VILE_STARTUP_PATH)"\$(**F)
 !endif
 
-api.obj:	api.h
-bind.obj:	nefunc.h btree.h
-btree.obj:	btree.h
-eval.obj:	nevars.h
-exec.obj:	neexec.h nefunc.h
-externs.obj:	nebind.h nename.h neproto.h nefunc.h
-filec.obj:	dirstuff.h
-glob.obj:	dirstuff.h
-globals.obj:	nefunc.h
-main.obj:	chgdfunc.h nevars.h
-modes.obj:	chgdfunc.h nefsms.h
-ntwinio.obj:	winvile.h pscreen.h patchlev.h
-opers.obj:	nefunc.h
-path.obj:	dirstuff.h
-perl.obj:	api.h
-random.obj:	nefunc.h
-select.obj:	nefunc.h
-spawn.obj:	nefunc.h
-statevar.obj:	nevars.h
-tags.obj:	btree.h
-termio.obj:	nefunc.h
-version.obj:	patchlev.h
-w32cmd.obj:	nefunc.h winvile.h
-w32misc.obj:	nefunc.h
-w32ole.obj:	w32ole.h winviletlb.h w32reg.h
-w32oo.obj:	dirstuff.h
-w32reg.obj:	w32reg.h
-word.obj:	nefunc.h
-wvwrap.obj:	w32reg.h w32ole.h winviletlb.h
+api.obj :	api.h
+bind.obj :	btree.h
+btree.obj :	btree.h
+display.obj :	pscreen.h
+filec.obj :	dirstuff.h
+glob.obj :	dirstuff.h
+main.obj :	chgdfunc.h 
+modes.obj :	chgdfunc.h 
+ntwinio.obj :	winvile.h pscreen.h patchlev.h
+path.obj :	dirstuff.h
+perl.obj :	api.h
+random.obj :	dirstuff.h
+statevar.obj :	patchlev.h
+tags.obj :	btree.h
+version.obj :	patchlev.h
+w32cmd.obj :	winvile.h
+w32ole.obj :	w32ole.h winviletlb.h w32reg.h
+w32oo.obj :	dirstuff.h
+w32reg.obj :	w32reg.h
+wvwrap.obj :	w32reg.h w32ole.h winviletlb.h
Index: modes.c
Prereq:  1.311 
--- vile-9.5e+/modes.c	2005-11-23 13:42:42.000000000 +0000
+++ vile-9.5f/modes.c	2006-02-15 21:09:04.000000000 +0000
@@ -7,7 +7,7 @@
  * Major extensions for vile by Paul Fox, 1991
  * Majormode extensions for vile by T.E.Dickey, 1997
  *
- * $Header: /usr/build/vile/vile/RCS/modes.c,v 1.311 2005/11/23 13:42:42 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/modes.c,v 1.314 2006/02/15 21:09:04 tom Exp $
  *
  */
 
@@ -64,7 +64,10 @@
 static struct VALNAMES *major_valnames;
 
 static int did_attach_mmode;
+
 static const char **my_mode_list;	/* copy of 'all_modes[]' */
+static int sizeof_my_mode_list;	/* ...its length */
+
 #define is_bool_type(type) ((type) == VALTYPE_BOOL || (type) == VALTYPE_MAJOR)
 
 static MAJORMODE_LIST *lookup_mm_list(const char *name);
@@ -2090,9 +2093,9 @@
 /*ARGSUSED*/
 int
 chgd_xtermkeys(BUFFER *bp GCC_UNUSED,
-	   VALARGS * args GCC_UNUSED,
-	   int glob_vals GCC_UNUSED,
-	   int testing GCC_UNUSED)
+	       VALARGS * args GCC_UNUSED,
+	       int glob_vals GCC_UNUSED,
+	       int testing GCC_UNUSED)
 {
 #if DISP_TERMCAP || DISP_CURSES
     if (glob_vals && !testing) {
@@ -2186,17 +2189,20 @@
 static size_t
 count_modes(void)
 {
-    size_t n;
-
     init_my_mode_list();
 
-    if (my_mode_list != 0) {
-	for (n = 0; my_mode_list[n] != 0; n++)
-	    continue;
-    } else {
-	n = 0;
+    if (sizeof_my_mode_list < 0) {
+	size_t n;
+
+	if (my_mode_list != 0) {
+	    for (n = 0; my_mode_list[n] != 0; n++)
+		continue;
+	} else {
+	    n = 0;
+	}
+	sizeof_my_mode_list = n;
     }
-    return n;
+    return sizeof_my_mode_list;
 }
 
 /*
@@ -2672,6 +2678,7 @@
 		for (k = ++count; k != j; k--)
 		    my_mode_list[k] = my_mode_list[k - 1];
 		my_mode_list[j] = newname;
+		sizeof_my_mode_list++;
 	    } else {
 		no_memory("insert_per_major");
 	    }
@@ -2701,6 +2708,7 @@
 	    count--;
 	    for (k = j; k <= count; k++)
 		my_mode_list[k] = my_mode_list[k + 1];
+	    sizeof_my_mode_list--;
 	}
     }
     return count;
@@ -2841,7 +2849,7 @@
 init_sm_vals(struct VAL *dst)
 {
     int k;
-    for (k = 0; k < MAX_B_VALUES; k++) {
+    for (k = 0; k < NUM_B_VALUES; k++) {
 	make_global_val(dst, global_b_values.bv, k);
     }
 }
@@ -2867,6 +2875,31 @@
 }
 
 /*
+ * Help initialization of submode groups by copying mode values from the
+ * base, e.g., ignorecase for majormodes that need this in their fence patterns.
+ *
+ * We do not copy the regular expressions since those are what submode groups
+ * are designed for, and do not want to have leftover patterns from the
+ * base contaminating the fence-fi, fence-else, etc.
+ */
+static void
+copy_sm_vals(struct VAL *dst, struct VAL *src, int type)
+{
+    int n;
+
+    if (src != 0) {
+	int last = NUM_B_VALUES;
+	for (n = 0; n < last; n++) {
+	    if (b_valnames[n].type == type
+		&& is_local_val(src, n)) {
+		dst[n] = src[n];
+		make_local_val(dst, n);
+	    }
+	}
+    }
+}
+
+/*
  * Using the currently specified 'group' qualifier, lookup the corresponding
  * MINORMODE structure and return a pointer to the B_VALUES VALS data.  If
  * no structure is found, create one.
@@ -2901,6 +2934,17 @@
 
 	if (p != 0) {
 	    init_sm_vals(&(p->sm_vals.bv[0]));
+	    if (ptr->sm != 0) {
+		copy_sm_vals(&(p->sm_vals.bv[0]),
+			     &(ptr->sm->sm_vals.bv[0]),
+			     VALTYPE_BOOL);
+		copy_sm_vals(&(p->sm_vals.bv[0]),
+			     &(ptr->sm->sm_vals.bv[0]),
+			     VALTYPE_INT);
+		copy_sm_vals(&(p->sm_vals.bv[0]),
+			     &(ptr->sm->sm_vals.bv[0]),
+			     VALTYPE_ENUM);
+	    }
 	    if (q != 0)
 		q->sm_next = p;
 	    else
@@ -2987,6 +3031,9 @@
     return (result);
 }
 
+/*
+ * Look in the submode's list of qualifiers, e.g., for "group" or "name".
+ */
 static int
 ok_subqual(MAJORMODE * ptr, char *name)
 {
@@ -3058,7 +3105,7 @@
 	    struct VAL *mm = get_sm_vals(bp->majr);
 
 	    /* adjust buffer modes */
-	    for (n = 0; n < MAX_B_VALUES; n++) {
+	    for (n = 0; n < NUM_B_VALUES; n++) {
 		if (!is_local_b_val(bp, n)
 		    && is_local_val(mm, n)) {
 		    make_global_val(bp->b_values.bv, mm, n);
@@ -3107,7 +3154,7 @@
 	&& !strcmp(mp->shortname, name)) {
 	TRACE(("detach_mmode '%s', given '%s'\n", name, mp->shortname));
 	/* readjust the buffer's modes */
-	for (n = 0; n < MAX_B_VALUES; n++) {
+	for (n = 0; n < NUM_B_VALUES; n++) {
 	    if (!is_local_b_val(bp, n)
 		&& is_local_val(get_sm_vals(mp), n)) {
 		make_global_b_val(bp, n);
@@ -3213,8 +3260,10 @@
 static void
 init_my_mode_list(void)
 {
-    if (my_mode_list == 0)
+    if (my_mode_list == 0) {
 	my_mode_list = TYPECAST(const char *, all_modes);
+	sizeof_my_mode_list = -1;
+    }
 }
 
 static int
Index: modetbl
Prereq:  1.237 
--- vile-9.5e+/modetbl	2005-11-21 00:53:37.000000000 +0000
+++ vile-9.5f/modetbl	2006-02-16 00:35:21.000000000 +0000
@@ -11,7 +11,7 @@
 #
 # The modes are table entries in the BUFFER and WINDOW structures.
 #
-# $Header: /usr/build/vile/vile/RCS/modetbl,v 1.237 2005/11/21 00:53:37 tom Exp $
+# $Header: /usr/build/vile/vile/RCS/modetbl,v 1.238 2006/02/16 00:35:21 tom Exp $
 #
 #
 # Mode-table entries.  Capitalized letters are used for abbreviations.
@@ -207,6 +207,7 @@
 # The "environment" variables are similar to modes, but are not so neatly
 # organized into groups of universal/buffer/window.
 .environment
+"_"		_STATUS		OPT_EVAL	# function's result (external)
 "abufname"	ABUFNAME		# alternate buffer name (i.e. '#')
 "autocolor-hook" AUTOCOLORHOOK	OPT_HOOKS&&OPT_COLOR	# procedure to run for auto-coloring
 "bchars"	BCHARS			# chars in current buffer
@@ -245,8 +246,8 @@
 "filename-expr"	FILENAME_EXPR	OPT_FINDERR	# regular expression for %F
 "filename-ic"	FILENAME_IC		# true if we set OPT_CASELESS
 "filter-list"	FILTER_LIST	OPT_FILTER	# list of builtin-filters
-"findpath"	FINDPATH	OPT_FINDPATH	# directory(s) used with "find" feature
 "find-cmd"	FINDCMD		OPT_FINDPATH	# shell cmd emitted via "find" feature (debug)
+"findpath"	FINDPATH	OPT_FINDPATH	# directory(s) used with "find" feature
 "font"		FONT		DISP_X11||DISP_NTWIN	# current font
 "forward-search" FWD_SEARCH		# search-direction (true if forward)
 "goal-column"	GOAL_COLUMN	OPT_TRACE	# goal-column (debug-only)
@@ -277,8 +278,8 @@
 "palette"	PALETTE			# current palette string
 "patchlevel"	PATCHLEVEL		# current patch-level of vile (empty for release)
 "pathlist-separator" PATHCHR		# separator for lists of pathnames
-"pathname-separator" PATHSEP		# separator for levels of pathnames
 "pathname"	PATHNAME		# current path-like word
+"pathname-separator" PATHSEP		# separator for levels of pathnames
 "pending"	PENDING			# type ahead pending flag
 "pid"		PROCESSID		# vile's process-id
 "position-format" POSFORMAT	OPT_POSFORMAT # position format string
@@ -287,6 +288,7 @@
 "qidentifier"	QIDENTIF		# current qualified identifier
 "read-hook"	RDHOOK		OPT_HOOKS	# procedure to run when reading
 "replace"	REPLACE			# replacement pattern
+"return"	RETURN		OPT_EVAL	# function's return-result (internal)
 "search"	SEARCH			# search pattern
 "seed"		SEED			# current random number seed
 "shell"		SHELL		OPT_SHELL	# shell-environment variable
Index: ntconio.c
Prereq:  1.84 
--- vile-9.5e+/ntconio.c	2005-11-23 12:19:35.000000000 +0000
+++ vile-9.5f/ntconio.c	2006-01-15 14:03:49.000000000 +0000
@@ -1,7 +1,7 @@
 /*
  * Uses the Win32 console API.
  *
- * $Header: /usr/build/vile/vile/RCS/ntconio.c,v 1.84 2005/11/23 12:19:35 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/ntconio.c,v 1.87 2006/01/15 14:03:49 tom Exp $
  *
  */
 
@@ -23,6 +23,8 @@
 #define	NPAUSE	200		/* # times thru update to pause */
 #define NOKYMAP (-1)
 
+#define ABS(x) (((x) < 0) ? -(x) : (x))
+
 #define DFT_BCOLOR  C_BLACK
 #define DFT_FCOLOR  ((ncolors >= 8) ? 7 : (ncolors - 1))
 
@@ -242,7 +244,7 @@
     if (to == from)
 	return;
 #if OPT_PRETTIER_SCROLL
-    if (absol(from - to) > 1) {
+    if (ABS(from - to) > 1) {
 	ntscroll(from, (from < to) ? to - 1 : to + 1, n);
 	if (from < to)
 	    from = to - 1;
@@ -276,7 +278,7 @@
 	Sleep(scroll_pause);
     }
 #if !OPT_PRETTIER_SCROLL
-    if (absol(from - to) > n) {
+    if (ABS(from - to) > n) {
 	DWORD cnt;
 	DWORD written;
 	COORD coordCursor;
@@ -1481,6 +1483,9 @@
     ntclose,
     ntkopen,
     ntkclose,
+    nullterm_clean,
+    nullterm_unclean,
+    nullterm_openup,
     ntgetch,
     ntputc,
     nttypahead,
Index: ntwinio.c
Prereq:  1.153 
--- vile-9.5e+/ntwinio.c	2006-01-09 23:51:18.000000000 +0000
+++ vile-9.5f/ntwinio.c	2006-02-19 18:17:19.000000000 +0000
@@ -1,7 +1,7 @@
 /*
  * Uses the Win32 screen API.
  *
- * $Header: /usr/build/vile/vile/RCS/ntwinio.c,v 1.153 2006/01/09 23:51:18 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/ntwinio.c,v 1.157 2006/02/19 18:17:19 tom Exp $
  * Written by T.E.Dickey for vile (october 1997).
  * -- improvements by Clark Morgan (see w32cbrd.c, w32pipe.c).
  */
@@ -22,6 +22,8 @@
 #include "nefunc.h"
 #include "chgdfunc.h"
 
+#define ABS(x) (((x) < 0) ? -(x) : (x))
+
 #define MIN_ROWS MINWLNS
 #define MIN_COLS 15
 
@@ -671,7 +673,7 @@
     /* ask for setting string */
     while (count < 3) {
 	*tstring = EOS;
-	lsprintf(prompt, "Palette value (%s): ", table[count].name);
+	sprintf(prompt, "Palette value (%s): ", table[count].name);
 	status = mlreply(prompt, tstring, sizeof(tstring));
 	if (status != TRUE)
 	    return (status);
@@ -1492,7 +1494,7 @@
     if (to == from)
 	return;
 #if OPT_PRETTIER_SCROLL
-    if (absol(from - to) > 1) {
+    if (ABS(from - to) > 1) {
 	ntscroll(from, (from < to) ? to - 1 : to + 1, n);
 	if (from < to)
 	    from = to - 1;
@@ -2671,7 +2673,7 @@
     int test_line;
 
     for (test_line = nPos; test_line < last_line; test_line += 0x10000) {
-	int check = absol(this_line - test_line);
+	int check = ABS(this_line - test_line);
 	if (check < diff_line) {
 	    diff_line = check;
 	    nPos = test_line;
@@ -3499,18 +3501,20 @@
 	receive_dropped_files((HDROP) wParam);
 	return 0;
 
+    case WM_INITMENUPOPUP:
+	TRACE(("MAIN:WM_INITMENUPOPUP %s at %d,%d\n",
+	       syscommand2s(LOWORD(wParam)),
+	       HIWORD(lParam),
+	       LOWORD(lParam)));
+	build_recent_file_and_folder_menus();
+	return (DefWindowProc(hWnd, message, wParam, lParam));
+
     case WM_SYSCOMMAND:
 	TRACE(("MAIN:WM_SYSCOMMAND %s at %d,%d\n",
 	       syscommand2s(LOWORD(wParam)),
 	       HIWORD(lParam),
 	       LOWORD(lParam)));
-	{
-	    WPARAM cmd = wParam & 0xFFF0;
-	    if (cmd == SC_KEYMENU || cmd == SC_MOUSEMENU)
-		build_recent_file_and_folder_menus();
-	    else
-		handle_builtin_menu(wParam);
-	}
+	handle_builtin_menu(wParam);
 	return (DefWindowProc(hWnd, message, wParam, lParam));
 
 #if OPT_SCROLLBARS
@@ -4166,15 +4170,17 @@
 
     if ((buf = typeallocn(char, need)) != 0) {
 
-	s = lsprintf(buf, fmt1, prognam);
+	sprintf(s = buf, fmt1, prognam);
 	for (n = 0; n < length; n++) {
 	    char temp[80];
+
+	    s += strlen(s);
 	    if ((need = option_size(options[n])) != 0) {
 		strncpy(temp, options[n], need);
 		temp[need] = EOS;
-		s = lsprintf(s, fmt2, temp, skip_cblanks(options[n] + need));
+		sprintf(s, fmt2, temp, skip_cblanks(options[n] + need));
 	    } else {
-		s = lsprintf(s, fmt3, options[n]);
+		sprintf(s, fmt3, options[n]);
 	    }
 	}
 
@@ -4198,6 +4204,9 @@
     ntclose,
     ntkopen,
     ntkclose,
+    nullterm_clean,
+    nullterm_unclean,
+    nullterm_openup,
     ntgetch,
     ntputc,
     nttypahead,
Index: nullterm.c
--- /dev/null	2006-02-19 23:35:28.896544500 +0000
+++ vile-9.5f/nullterm.c	2006-01-12 23:37:46.000000000 +0000
@@ -0,0 +1,243 @@
+/*
+ * Define an empty terminal type for machines where we cannot use 'dumb_term',
+ * so that command-line prompting will have something to talk to.
+ *
+ * $Header: /usr/build/vile/vile/RCS/nullterm.c,v 1.3 2006/01/12 23:37:46 tom Exp $
+ */
+
+#include	<estruct.h>
+#include	<edef.h>
+
+static void
+nullterm_open(void)
+{
+}
+
+static void
+nullterm_close(void)
+{
+}
+
+static int
+nullterm_getch(void)
+{
+    return esc_c;
+}
+
+/*ARGSUSED*/
+static OUTC_DCL
+nullterm_putch(OUTC_ARGS)
+{
+    OUTC_RET c;
+}
+
+static int
+nullterm_typahead(void)
+{
+    return FALSE;
+}
+
+static void
+nullterm_flush(void)
+{
+}
+
+/*ARGSUSED*/
+static void
+nullterm_curmove(int row GCC_UNUSED, int col GCC_UNUSED)
+{
+}
+
+static void
+nullterm_eeol(void)
+{
+}
+
+static void
+nullterm_eeop(void)
+{
+}
+
+static void
+nullterm_beep(void)
+{
+}
+
+/*ARGSUSED*/
+static void
+nullterm_rev(UINT state GCC_UNUSED)
+{
+}
+
+#if OPT_COLOR
+#define NO_COLOR(name,value) name = value;
+#else
+#define NO_COLOR(name,value)	/*nothing */
+#endif
+
+/*
+ * These are public, since we'll use them as placeholders for unimplemented
+ * device methods.
+ */
+/*ARGSUSED*/
+int
+nullterm_setdescrip(const char *res GCC_UNUSED)
+{
+    return (FALSE);
+}
+
+/*ARGSUSED*/
+int
+nullterm_watchfd(int fd GCC_UNUSED, WATCHTYPE type GCC_UNUSED, long *idp GCC_UNUSED)
+{
+    return 0;
+}
+
+/*ARGSUSED*/
+void
+nullterm_clean(int f GCC_UNUSED)
+{
+}
+
+void
+nullterm_unclean(void)
+{
+}
+
+void
+nullterm_openup(void)
+{
+}
+
+/*ARGSUSED*/
+void
+nullterm_cursorvis(int flag GCC_UNUSED)
+{
+}
+
+/*ARGSUSED*/
+void
+nullterm_icursor(int c GCC_UNUSED)
+{
+}
+
+/*ARGSUSED*/
+void
+nullterm_kclose(void)
+{
+}
+
+/*ARGSUSED*/
+void
+nullterm_kopen(void)
+{
+}
+
+/*ARGSUSED*/
+void
+nullterm_pflush(void)
+{
+}
+
+/*ARGSUSED*/
+void
+nullterm_scroll(int f GCC_UNUSED, int t GCC_UNUSED, int n GCC_UNUSED)
+{
+}
+
+/*ARGSUSED*/
+void
+nullterm_setback(int b GCC_UNUSED)
+{
+    NO_COLOR(gbcolor, C_BLACK)
+}
+
+/*ARGSUSED*/
+void
+nullterm_setccol(int c GCC_UNUSED)
+{
+    NO_COLOR(gccolor, ENUM_UNKNOWN)
+}
+
+/*ARGSUSED*/
+void
+nullterm_setfore(int f GCC_UNUSED)
+{
+    NO_COLOR(gbcolor, C_WHITE)
+}
+
+/*ARGSUSED*/
+void
+nullterm_setpal(const char *p GCC_UNUSED)
+{
+}
+
+/*ARGSUSED*/
+void
+nullterm_settitle(const char *t GCC_UNUSED)
+{
+}
+
+/*ARGSUSED*/
+void
+nullterm_unwatchfd(int fd GCC_UNUSED, long id GCC_UNUSED)
+{
+}
+
+/*ARGSUSED*/
+void
+nullterm_mopen(void)
+{
+}
+
+/*ARGSUSED*/
+void
+nullterm_mclose(void)
+{
+}
+
+/*ARGSUSED*/
+void
+nullterm_mevent(void)
+{
+}
+
+TERM null_term =
+{
+    1,
+    1,
+    80,
+    80,
+    0,				/* NPAUSE */
+    nullterm_open,
+    nullterm_close,
+    nullterm_kopen,
+    nullterm_kclose,
+    nullterm_clean,
+    nullterm_unclean,
+    nullterm_openup,
+    nullterm_getch,
+    nullterm_putch,
+    nullterm_typahead,
+    nullterm_flush,
+    nullterm_curmove,
+    nullterm_eeol,
+    nullterm_eeop,
+    nullterm_beep,
+    nullterm_rev,
+    nullterm_setdescrip,
+    nullterm_setfore,
+    nullterm_setback,
+    nullterm_setpal,
+    nullterm_setccol,
+    nullterm_scroll,
+    nullterm_pflush,
+    nullterm_icursor,
+    nullterm_settitle,
+    nullterm_watchfd,
+    nullterm_unwatchfd,
+    nullterm_cursorvis,
+    nullterm_mopen,
+    nullterm_mclose,
+    nullterm_mevent,
+};
Index: os2vio.c
Prereq:  1.33 
--- vile-9.5e+/os2vio.c	2005-11-23 12:19:35.000000000 +0000
+++ vile-9.5f/os2vio.c	2006-01-12 23:37:34.000000000 +0000
@@ -3,7 +3,7 @@
  * Modified from a really old version of "borland.c" (before the VIO
  * stuff went in there.)
  *
- * $Header: /usr/build/vile/vile/RCS/os2vio.c,v 1.33 2005/11/23 12:19:35 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/os2vio.c,v 1.35 2006/01/12 23:37:34 tom Exp $
  */
 
 #include "estruct.h"
@@ -582,6 +582,9 @@
     vio_close,
     vio_kopen,
     vio_kclose,
+    ttclean,
+    ttunclean,
+    nullterm_openup,
     vio_getc,
     vio_putc,
     tttypahead,
Index: patchlev.h
--- vile-9.5e+/patchlev.h	2005-12-20 20:42:05.000000000 +0000
+++ vile-9.5f/patchlev.h	2006-01-10 22:53:18.000000000 +0000
@@ -1,3 +1,3 @@
 #define VILE_VERSION "9.5"
 /* set to "" for no patches */
-#define VILE_PATCHLEVEL "e"
+#define VILE_PATCHLEVEL "f"
Index: proto.h
Prereq:  1.561 
--- vile-9.5e+/proto.h	2005-11-30 02:17:38.000000000 +0000
+++ vile-9.5f/proto.h	2006-01-13 01:29:15.000000000 +0000
@@ -4,7 +4,7 @@
  *
  *   Created: Thu May 14 15:44:40 1992
  *
- * $Header: /usr/build/vile/vile/RCS/proto.h,v 1.561 2005/11/30 02:17:38 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/proto.h,v 1.564 2006/01/13 01:29:15 tom Exp $
  *
  */
 
@@ -1137,6 +1137,7 @@
 
 extern int  nullterm_setdescrip (const char *res);
 extern int  nullterm_watchfd (int fd, WATCHTYPE type, long *idp);
+extern void nullterm_clean (int flag);
 extern void nullterm_cursorvis (int flag);
 extern void nullterm_icursor (int c);
 extern void nullterm_kclose (void);
@@ -1145,12 +1146,14 @@
 extern void nullterm_mevent (void);
 extern void nullterm_mopen (void);
 extern void nullterm_pflush (void);
+extern void nullterm_openup (void);
 extern void nullterm_scroll (int f, int t, int n);
 extern void nullterm_setback (int b);
 extern void nullterm_setccol (int c);
 extern void nullterm_setfore (int f);
 extern void nullterm_setpal (const char *p);
 extern void nullterm_settitle (const char *t);
+extern void nullterm_unclean (void);
 extern void nullterm_unwatchfd (int fd, long id);
 
 /* ucrypt.c */
@@ -1342,7 +1345,7 @@
 extern	char *	x_get_window_name	(void);
 extern	int	x_preparse_args		(int *pargc, char ***pargv);
 extern	int	x_setfont		(const char *fname);
-extern	int	x_typahead		(int milli);
+extern	int	x_milli_sleep		(int milli);
 extern	void	x_move_events		(void);
 extern	void	x_set_icon_name		(const char *name);
 extern	void	x_set_window_name	(const char *name);
Index: random.c
Prereq:  1.287 
--- vile-9.5e+/random.c	2005-07-14 00:09:57.000000000 +0000
+++ vile-9.5f/random.c	2006-02-19 20:53:10.000000000 +0000
@@ -2,7 +2,7 @@
  * This file contains the command processing functions for a number of random
  * commands. There is no functional grouping here, for sure.
  *
- * $Header: /usr/build/vile/vile/RCS/random.c,v 1.287 2005/07/14 00:09:57 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/random.c,v 1.291 2006/02/19 20:53:10 tom Exp $
  *
  */
 
@@ -378,7 +378,7 @@
 
 #if !SMALLER
 /*
- * Go to the given character index in the buffer
+ * Go to the given character index in the buffer.
  */
 int
 gotochr(int f, int n)
@@ -396,8 +396,10 @@
 	    len = line_length(lp);
 	    if (goal <= len) {
 		DOT.l = lp;
-		if ((DOT.o = goal + len - 1) >= llength(lp))
+		/* we cannot move into the middle of the line-separator */
+		if ((DOT.o = goal - 1) >= llength(lp))
 		    DOT.o = llength(lp) - 1;
+		goal = 0;
 		break;
 	    }
 	    goal -= len;
@@ -772,7 +774,7 @@
 {
 #if DISP_X11
     if (watchinput)
-	x_typahead(milli);
+	x_milli_sleep(milli);
     else
 #endif
     {
@@ -1142,6 +1144,7 @@
 
     if (chdir(SL_TO_BSL(path)) == 0) {
 	did_chdir = TRUE;
+
 	if (dirs_add_active) {
 	    /* the directory is legit -- that's all we care about */
 
@@ -1160,6 +1163,9 @@
 #else
 	(void) pwd(TRUE, 1);
 #endif
+#if OPT_TITLE
+	set_editor_title();
+#endif
 	run_a_hook(&cdhook);
 	updatelistbuffers();
 
@@ -1456,13 +1462,17 @@
     else if (hook == &writehook)
 	result = "$write-hook";
     else if (hook == &bufhook)
-	result = "$buf-hook";
+	result = "$buffer-hook";
     else if (hook == &exithook)
 	result = "$exit-hook";
+#if OPT_COLOR
     else if (hook == &autocolorhook)
 	result = "autocolor-hook";
+#endif
+#if OPT_MAJORMODE
     else if (hook == &majormodehook)
 	result = "$majormode-hook";
+#endif
     return result;
 }
 
Index: revlist
--- vile-9.5e+/revlist	2006-01-10 01:27:47.000000000 +0000
+++ vile-9.5f/revlist	2006-02-20 01:02:13.000000000 +0000
@@ -1,25 +1,25 @@
-revlist for vile, version v9_5e
+revlist for vile, version v9_5f
 --------------------------------------------------------------------------------
-CHANGES	1.893
+CHANGES	1.908
 CHANGES.R3	1.1
 CHANGES.R4	1.1
 CHANGES.R5	1.1
 CHANGES.R6	1.1
 CHANGES.R7	1.2
 CHANGES.R8	1.1
-COPYING	1.3
+COPYING	1.4
 INSTALL	1.6
 MANIFEST	none
-README	1.93
+README	1.94
 README.PC	1.33
 README.VMS	1.5
 aclocal.m4	1.158
-ansi.c	1.46
+ansi.c	1.48
 api.c	1.37
 api.h	1.13
 basic.c	1.124
 bind.c	1.291
-borland.c	1.34
+borland.c	1.36
 btree.c	1.22
 btree.h	1.4
 buffer.c	1.298
@@ -33,19 +33,19 @@
 configure	1.3
 configure.in	1.221
 csrch.c	1.32
-curses.c	1.25
-descrip.mms	1.46
+curses.c	1.27
+descrip.mms	1.48
 dirstuff.h	1.30
-display.c	1.413
+display.c	1.415
 djhandl.c	1.6
-dumbterm.c	1.19
-edef.h	1.322
-estruct.h	1.592
-eval.c	1.349
-exec.c	1.281
+dumbterm.c	1.21
+edef.h	1.323
+estruct.h	1.595
+eval.c	1.351
+exec.c	1.282
 externs.c	1.10
 fences.c	1.83
-file.c	1.388
+file.c	1.390
 filec.c	1.121
 fileio.c	1.179
 finderr.c	1.130
@@ -60,72 +60,72 @@
 itbuff.c	1.25
 lckfiles.c	1.11
 line.c	1.170
-main.c	1.546
-makefile.blc	1.18
-makefile.djg	1.34
-makefile.emx	1.5
-makefile.icc	1.15
-makefile.in	1.199
-makefile.wnt	1.89
+main.c	1.549
+makefile.blc	1.19
+makefile.djg	1.35
+makefile.icc	1.16
+makefile.in	1.202
+makefile.wnt	1.91
 map.c	1.108
 menu.c	1.48
 mkdirs.sh	1.6
 mkprlenv.wnt	1.9
 mktbls.c	1.132
-modes.c	1.311
-modetbl	1.237
+modes.c	1.314
+modetbl	1.238
 msgs.c	1.26
 npopen.c	1.94
-ntconio.c	1.84
-ntwinio.c	1.153
+ntconio.c	1.87
+ntwinio.c	1.157
+nullterm.c	1.3
 oneliner.c	1.108
 opers.c	1.90
 os2keys.h	1.2
 os2pipe.c	1.5
-os2vio.c	1.33
-patchlev.h	1.341
+os2vio.c	1.35
+patchlev.h	1.342
 path.c	1.150
 perl.xs	1.104
 plugin.c	1.1
 plugin.h	1.1
-proto.h	1.561
+proto.h	1.564
 pscreen.h	1.2
 ptypemap	1.7
-random.c	1.287
+random.c	1.291
 regexp.c	1.117
 region.c	1.132
-revlist	v9_5e
+revlist	v9_5f
 search.c	1.137
 select.c	1.158
 sinstall.sh	1.1
-spawn.c	1.188
-statevar.c	1.95
+spawn.c	1.190
+statevar.c	1.97
 tags.c	1.128
-tbuff.c	1.63
-tcap.c	1.168
+tbuff.c	1.64
+tcap.c	1.170
 tcap.h	1.10
-termio.c	1.203
-test_io.c	1.1
+termio.c	1.211
+test_io.c	1.2
 trace.c	1.53
 trace.h	1.24
 ucrypt.c	1.15
 undo.c	1.88
-version.c	1.58
-vile-9.5.spec	1.5
+version.c	1.59
+vile-9.5.spec	1.7
 vile.1	1.30
-vile.hlp	1.606
+vile.hlp	1.610
 vile.wmconfig	1.1
 vl_alloc.h	1.1
 vl_ctype.h	1.4
 vl_regex.h	1.3
 vms2unix.c	1.42
-vmsbuild.com	1.44
+vmsbuild.com	1.46
 vmspipe.c	1.14
-vmsvt.c	1.58
+vmsvt.c	1.63
 w32cbrd.c	1.25
-w32cmd.c	1.35
+w32cmd.c	1.36
 w32misc.c	1.46
-w32ole.cpp	1.23
+w32ole.cpp	1.25
 w32ole.h	1.6
 w32ole.rc	1.2
 w32oo.cpp	1.7
@@ -141,7 +141,7 @@
 word.c	1.79
 wordmov.c	1.22
 wvwrap.cpp	1.10
-x11.c	1.281
+x11.c	1.285
 x11menu.c	1.8
 xshell.sh	1.4
 xterm.c	1.2
@@ -151,7 +151,7 @@
 doc/config.doc	1.14
 doc/dir.doc	1.3
 doc/filters.doc	1.35
-doc/macros.doc	1.95
+doc/macros.doc	1.96
 doc/menus.doc	1.7
 doc/modes.doc	1.16
 doc/ncu-indent	1.12
@@ -174,7 +174,7 @@
 filters/awk.key	1.2
 filters/bas-filt.l	1.10
 filters/basic.key	1.4
-filters/bat-filt.l	1.21
+filters/bat-filt.l	1.22
 filters/bat.key	1.4
 filters/bnf-filt.l	1.7
 filters/bnf.key	1.1
@@ -182,7 +182,8 @@
 filters/c-filt.flx	1.1
 filters/c.key	1.11
 filters/cfg-filt.l	1.11
-filters/cpp.key	1.6
+filters/cpp.key	1.7
+filters/cs.key	1.1
 filters/csh.key	1.1
 filters/css-filt.l	1.11
 filters/css.key	1.5
@@ -206,13 +207,13 @@
 filters/filterio.c	1.28
 filters/filters.c	1.99
 filters/filters.h	1.96
-filters/filters.rc	1.203
+filters/filters.rc	1.204
 filters/flt_defs.h	1.2
 filters/fltstack.h	1.9
 filters/genmake.c	1.4
 filters/genmake.mak	1.29
 filters/html.key	1.8
-filters/htmlfilt.l	1.35
+filters/htmlfilt.l	1.36
 filters/imake.key	1.4
 filters/imakeflt.l	1.14
 filters/infofilt.l	1.5
@@ -234,7 +235,7 @@
 filters/mail.key	1.3
 filters/mailfilt.l	1.18
 filters/make.key	1.8
-filters/makefile.2nd	1.11
+filters/makefile.2nd	1.12
 filters/makefile.djg	1.3
 filters/makefile.emx	1.4
 filters/makefile.icc	1.3
@@ -285,7 +286,7 @@
 filters/sccs.key	1.1
 filters/sccsfilt.l	1.12
 filters/sed-filt.c	1.21
-filters/sh-filt.l	1.64
+filters/sh-filt.l	1.65
 filters/sh.key	1.4
 filters/sml-filt.l	1.5
 filters/sml.key	1.1
@@ -342,7 +343,7 @@
 macros/gnugpg.rc	1.3
 macros/loaderrs.rc	1.1
 macros/manpage.rc	1.21
-macros/modes.rc	1.33
+macros/modes.rc	1.36
 macros/palettes.rc	1.7
 macros/pictmode.rc	1.4
 macros/search.rc	1.3
Index: spawn.c
Prereq:  1.188 
--- vile-9.5e+/spawn.c	2005-11-30 01:24:52.000000000 +0000
+++ vile-9.5f/spawn.c	2006-01-12 23:46:38.000000000 +0000
@@ -1,7 +1,7 @@
 /*	Spawn:	various DOS access commands
  *		for MicroEMACS
  *
- * $Header: /usr/build/vile/vile/RCS/spawn.c,v 1.188 2005/11/30 01:24:52 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/spawn.c,v 1.190 2006/01/12 23:46:38 tom Exp $
  *
  */
 
@@ -137,16 +137,16 @@
 
 #if	SYS_UNIX
 #define	OK_SPAWN
-    ttclean(TRUE);
+    term.clean(TRUE);
     file_stat(0, 0);
-    kbd_openup();
+    term.openup();
 #if	DISP_X11 && !SMALLER
     (void) x_window_SHELL((char *) 0);
 #else
     (void) system_SHELL((char *) 0);
 #endif
-    kbd_openup();
-    ttunclean();
+    term.openup();
+    term.unclean();
     term.kopen();
     sgarbf = TRUE;
     return AfterShell();
@@ -221,7 +221,7 @@
 	return FALSE;
 
     beginDisplay();
-    ttclean(TRUE);
+    term.clean(TRUE);
     file_stat(0, 0);
 
 /* #define simulate_job_control_for_debug */
@@ -250,9 +250,9 @@
 #if USE_UNIX_JOB_CTL
     TRACE(("entering rtfrmshell...\n"));
     endofDisplay();
-    kbd_openup();
+    term.openup();
     term.kopen();
-    ttunclean();
+    term.unclean();
     sgarbf = TRUE;
     setup_handler(SIGCONT, rtfrmshell);		/* suspend & restart */
     (void) update(TRUE);
@@ -390,12 +390,12 @@
     (void) system_SHELL(line);
 #endif
 #else
-    ttclean(TRUE);
+    term.clean(TRUE);
     file_stat(0, 0);
 
     (void) system_SHELL(line);
 
-    ttunclean();
+    term.unclean();
     if (pressret)
 	pressreturn();
     term.open();
@@ -881,7 +881,7 @@
 #endif
 #if	SYS_UNIX
     bottomleft();
-    ttclean(TRUE);
+    term.clean(TRUE);
     file_stat(0, 0);
     if ((t = strchr(line, '|')) != 0) {
 	char temp[NLINE];
@@ -892,7 +892,7 @@
     }
     (void) strcat(line, " >fltout");
     system(line);
-    ttunclean();
+    term.unclean();
     term.flush();
     sgarbf = TRUE;
     s = TRUE;
Index: statevar.c
Prereq:  1.95 
--- vile-9.5e+/statevar.c	2005-12-25 22:36:49.000000000 +0000
+++ vile-9.5f/statevar.c	2006-02-16 00:28:41.000000000 +0000
@@ -3,7 +3,7 @@
  *	for getting and setting the values of the vile state variables,
  *	plus helper utility functions.
  *
- * $Header: /usr/build/vile/vile/RCS/statevar.c,v 1.95 2005/12/25 22:36:49 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/statevar.c,v 1.97 2006/02/16 00:28:41 tom Exp $
  */
 
 #include	"estruct.h"
@@ -167,6 +167,35 @@
 }
 
 static int
+any_ro_TBUFF(TBUFF **rp, const char *vp, TBUFF **value)
+{
+    if (rp) {
+	if (value != 0) {
+	    tb_copy(rp, *value);
+	    return TRUE;
+	}
+    } else if (vp) {
+	return ABORT;		/* read-only */
+    }
+    return FALSE;
+}
+
+static int
+any_rw_TBUFF(TBUFF **rp, const char *vp, TBUFF **value)
+{
+    if (rp) {
+	if (value != 0) {
+	    tb_copy(rp, *value);
+	    return TRUE;
+	}
+    } else if (vp) {
+	tb_scopy(value, vp);
+	return TRUE;
+    }
+    return FALSE;
+}
+
+static int
 any_rw_TXT(TBUFF **rp, const char *vp, char **value)
 {
     if (rp) {
@@ -1402,8 +1431,22 @@
 int
 var_STATUS(TBUFF **rp, const char *vp)
 {
-    return any_rw_BOOL(rp, vp, &lastcmdstatus);
+    return any_ro_BOOL(rp, vp, lastcmdstatus);
+}
+
+#if OPT_EVAL
+int
+var__STATUS(TBUFF **rp, const char *vp)
+{
+    return any_ro_TBUFF(rp, vp, &last_macro_result);
+}
+
+int
+var_RETURN(TBUFF **rp, const char *vp)
+{
+    return any_rw_TBUFF(rp, vp, &this_macro_result);
 }
+#endif /* OPT_EVAL */
 
 #if OPT_TITLE
 int
@@ -1432,7 +1475,8 @@
 var_TITLEFORMAT(TBUFF **rp, const char *vp)
 {
     int code = any_rw_STR(rp, vp, &title_format);
-    set_editor_title();
+    if (!rp && vp)
+	set_editor_title();
     return code;
 }
 #endif /* OPT_TITLE */
Index: tbuff.c
Prereq:  1.63 
--- vile-9.5e+/tbuff.c	2005-02-15 21:15:12.000000000 +0000
+++ vile-9.5f/tbuff.c	2006-02-16 01:00:30.000000000 +0000
@@ -7,7 +7,7 @@
  *	To do:	add 'tb_ins()' and 'tb_del()' to support cursor-level command
  *		editing.
  *
- * $Header: /usr/build/vile/vile/RCS/tbuff.c,v 1.63 2005/02/15 21:15:12 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/tbuff.c,v 1.64 2006/02/16 01:00:30 tom Exp $
  *
  */
 
@@ -172,13 +172,16 @@
 TBUFF *
 tb_error(TBUFF **p)
 {
-    TBUFF *result = tb_init(p, EOS);
-    if (result != 0) {
+    TBUFF *result;
+
+    beginDisplay();
+    if ((result = tb_init(p, EOS)) != 0) {
 	result->tb_size = 0;
 	result->tb_used = 0;
 	FreeAndNull(result->tb_data);
 	result->tb_errs = TRUE;
     }
+    endofDisplay();
     return result;
 }
 
Index: tcap.c
Prereq:  1.168 
--- vile-9.5e+/tcap.c	2005-11-23 19:15:30.000000000 +0000
+++ vile-9.5f/tcap.c	2006-01-12 23:37:34.000000000 +0000
@@ -1,7 +1,7 @@
 /*	tcap:	Unix V5, V7 and BS4.2 Termcap video driver
  *		for MicroEMACS
  *
- * $Header: /usr/build/vile/vile/RCS/tcap.c,v 1.168 2005/11/23 19:15:30 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/tcap.c,v 1.170 2006/01/12 23:37:34 tom Exp $
  *
  */
 
@@ -1131,6 +1131,9 @@
     tcap_close,
     tcap_kopen,
     tcap_kclose,
+    ttclean,
+    ttunclean,
+    nullterm_openup,
     ttgetc,
     ttputc,
     tttypahead,
Index: termio.c
Prereq:  1.203 
--- vile-9.5e+/termio.c	2005-11-30 01:29:42.000000000 +0000
+++ vile-9.5f/termio.c	2006-01-13 01:29:15.000000000 +0000
@@ -3,7 +3,7 @@
  * characters, and write characters in a barely buffered fashion on the display.
  * All operating systems.
  *
- * $Header: /usr/build/vile/vile/RCS/termio.c,v 1.203 2005/11/30 01:29:42 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/termio.c,v 1.211 2006/01/13 01:29:15 tom Exp $
  *
  */
 
@@ -15,11 +15,6 @@
 # include <pc.h>		/* for kbhit() */
 #endif
 
-#if SYS_VMS
-#include <starlet.h>
-#include <lib$routines.h>
-#endif
-
 #if SYS_UNIX
 
 static void ttmiscinit(void);
@@ -316,7 +311,7 @@
 
     ttmiscinit();
 
-    ttunclean();
+    term.unclean();
 }
 
 /* we disable the flow control chars so we can use ^S as a command, but
@@ -337,7 +332,7 @@
 	ntermios.c_cc[VSTART] = VDISABLE;
 	ntermios.c_cc[VSTOP] = VDISABLE;
     }
-    ttunclean();
+    term.unclean();
 #endif
     return TRUE;
 }
@@ -345,7 +340,7 @@
 void
 ttclose(void)
 {
-    ttclean(TRUE);
+    term.clean(TRUE);
 }
 
 /*
@@ -360,7 +355,7 @@
 {
 #if !DISP_X11
     if (f)
-	kbd_openup();
+	term.openup();
 
     (void) fflush(stdout);
     vl_restore_tty();
@@ -467,7 +462,7 @@
 #endif
 
     ttmiscinit();
-    ttunclean();
+    term.unclean();
 }
 
 /* we disable the flow control chars so we can use ^S as a command, but
@@ -481,7 +476,7 @@
     ntermio.c_iflag &= ~(IXON | IXANY | IXOFF);
     if (!f)
 	ntermio.c_iflag |= otermio.c_iflag & (IXON | IXANY | IXOFF);
-    ttunclean();
+    term.unclean();
 #endif
     return TRUE;
 }
@@ -489,7 +484,7 @@
 void
 ttclose(void)
 {
-    ttclean(TRUE);
+    term.clean(TRUE);
 }
 
 void
@@ -497,7 +492,7 @@
 {
 #if ! DISP_X11
     if (f)
-	kbd_openup();
+	term.openup();
 
     (void) fflush(stdout);
     term.flush();
@@ -638,7 +633,7 @@
 	ntchars.t_startc = -1;
 	ntchars.t_stopc = -1;
     }
-    ttunclean();
+    term.unclean();
 #endif
     return TRUE;
 }
@@ -646,7 +641,7 @@
 void
 ttclose(void)
 {
-    ttclean(TRUE);
+    term.clean(TRUE);
 }
 
 void
@@ -654,7 +649,7 @@
 {
 #if ! DISP_X11
     if (f)
-	kbd_openup();
+	term.openup();
 
     term.flush();
     term.close();
@@ -962,7 +957,7 @@
 {
 
 #if DISP_X11
-    return x_typahead(0);
+    return x_milli_sleep(0);
 #else
 
 # if USE_SELECT || USE_POLL || defined(__BEOS__)
@@ -1017,72 +1012,9 @@
 # endif
 #endif
 
-#if SYS_VMS
-#include	<stsdef.h>
-#include	<ssdef.h>
-#include	<descrip.h>
-#include	<iodef.h>
-#include	<ttdef.h>
-#include	<tt2def.h>
-
-typedef struct {
-    USHORT status;		/* I/O completion status */
-    USHORT count;		/* byte transfer count   */
-    int dev_dep_data;		/* device-dependent data */
-} QIO_SB;			/* This is a QIO I/O Status Block */
-
-#define NIBUF	1024		/* Input buffer size            */
-#define NOBUF	1024		/* MM says big buffers win!     */
-#define EFN	0		/* Event flag                   */
-
-char obuf[NOBUF];		/* Output buffer                */
-int nobuf;			/* # of bytes in above          */
-
-char ibuf[NIBUF];		/* Input buffer                 */
-int nibuf;			/* # of bytes in above          */
-
-int ibufi;			/* Read index                   */
-
-int oldmode[3];			/* Old TTY mode bits            */
-int newmode[3];			/* New TTY mode bits            */
-short iochan;			/* TTY I/O channel              */
-#endif
-
 void
 ttopen(void)
 {
-#if SYS_VMS
-    QIO_SB iosb;
-    int status;
-    $DESCRIPTOR(odsc, "SYS$COMMAND");
-
-    status = sys$assign(&odsc, &iochan, 0, 0);
-    if (status != SS$_NORMAL)
-	tidy_exit(status);
-    status = sys$qiow(EFN, iochan, IO$_SENSEMODE, &iosb, 0, 0,
-		      oldmode, sizeof(oldmode), 0, 0, 0, 0);
-    if (status != SS$_NORMAL
-	|| iosb.status != SS$_NORMAL)
-	tidy_exit(status);
-    newmode[0] = oldmode[0];
-    newmode[1] = oldmode[1];
-    newmode[1] |= TT$M_NOBRDCST;	/* turn on no-broadcast */
-    newmode[1] &= ~TT$M_TTSYNC;
-    newmode[1] &= ~TT$M_ESCAPE;	/* turn off escape-processing */
-    newmode[1] &= ~TT$M_HOSTSYNC;
-    newmode[1] &= ~TT$M_NOTYPEAHD;	/* turn off no-typeahead */
-    newmode[2] = oldmode[2];
-    newmode[2] |= TT2$M_PASTHRU;	/* turn on pass-through */
-    newmode[2] |= TT2$M_ALTYPEAHD;	/* turn on big typeahead buffer */
-    status = sys$qiow(EFN, iochan, IO$_SETMODE, &iosb, 0, 0,
-		      newmode, sizeof(newmode), 0, 0, 0, 0);
-    if (status != SS$_NORMAL
-	|| iosb.status != SS$_NORMAL)
-	tidy_exit(status);
-    term.rows = (newmode[1] >> 24);
-    term.cols = newmode[0] >> 16;
-
-#endif
     /* make sure backspace is bound to backspace */
     asciitbl[backspc] = &f_backchar_to_bol;
 }
@@ -1090,26 +1022,7 @@
 void
 ttclose(void)
 {
-#if SYS_VMS
-    /*
-     * Note: this code used to check for errors when closing the output,
-     * but it didn't work properly (left the screen set in 1-line mode)
-     * when I was running as system manager, so I took out the error
-     * checking -- T.Dickey 94/7/15.
-     */
-    int status;
-    QIO_SB iosb;
-
-    ttflush();
-    status = sys$qiow(EFN, iochan, IO$_SETMODE, &iosb, 0, 0,
-		      oldmode, sizeof(oldmode), 0, 0, 0, 0);
-    if (status == SS$_IVCHAN)
-	return;			/* already closed it */
-    (void) sys$dassgn(iochan);
-#endif
-#if !SYS_VMS
-    ttclean(TRUE);
-#endif
+    term.clean(TRUE);
 }
 
 void
@@ -1117,7 +1030,7 @@
 {
 #if !DISP_X11
     if (f)
-	kbd_openup();
+	term.openup();
 
     term.flush();
     term.close();
@@ -1131,20 +1044,13 @@
 }
 
 /*
- * Write a character to the display. On VMS, terminal output is buffered, and
- * we just put the characters in the big array, after checking for overflow.
+ * Write a character to the display.
  * On CPM terminal I/O unbuffered, so we just write the byte out. Ditto on
  * MS-DOS (use the very very raw console output routine).
  */
 OUTC_DCL
 ttputc(OUTC_ARGS)
 {
-#if SYS_VMS
-    if (nobuf >= NOBUF)
-	ttflush();
-    obuf[nobuf++] = c;
-    OUTC_RET c;
-#endif
 #if SYS_OS2 && !DISP_VIO
     OUTC_RET putch(c);
 #endif
@@ -1162,16 +1068,6 @@
 void
 ttflush(void)
 {
-#if SYS_VMS
-    QIO_SB iosb;
-
-    if (nobuf != 0) {
-	(void) sys$qiow(EFN, iochan, IO$_WRITELBLK | IO$M_NOFORMAT,
-			&iosb, 0, 0, obuf, nobuf, 0, 0, 0, 0);
-	nobuf = 0;
-    }
-#endif
-
 #if SYS_MSDOS
 # if DISP_ANSI
     fflush(stdout);
@@ -1179,51 +1075,15 @@
 #endif
 }
 
-#if SYS_VMS
-static void
-read_vms_tty(int length)
-{
-    int status;
-    QIO_SB iosb;
-    int term[2] =
-    {0, 0};
-    unsigned mask = (IO$_READVBLK
-		     | IO$M_NOECHO
-		     | IO$M_NOFILTR
-		     | IO$M_TRMNOECHO);
-
-    status = sys$qiow(EFN, iochan,
-		      ((length == 1)
-		       ? mask
-		       : mask | IO$M_TIMED),
-		      &iosb, 0, 0, ibuf, length, 0, term, 0, 0);
-
-    if (status != SS$_NORMAL)
-	tidy_exit(status);
-    if (iosb.status == SS$_ENDOFFILE)
-	tidy_exit(status);
-
-    nibuf = iosb.count;
-    ibufi = 0;
-}
-#endif
-
 /*
  * Read a character from the terminal, performing no editing and doing no echo
- * at all. More complex in VMS that almost anyplace else, which figures. Very
- * simple on CPM, because the system can do exactly what you want.
+ * at all.  Very simple on CPM, because the system can do exactly what you
+ * want.
  * This should be a terminal dispatch function.
  */
 int
 ttgetc(void)
 {
-#if SYS_VMS
-    while (ibufi >= nibuf) {
-	if (!tttypahead())
-	    read_vms_tty(1);
-    }
-    return (ibuf[ibufi++] & 0xFF);	/* Allow multinational  */
-#else
 #if SYS_MSDOS || SYS_OS2
     /*
      * If we've got a mouse, poll waiting for mouse movement and mouse
@@ -1256,28 +1116,18 @@
     /* Not used. */
     return 0;
 #endif
-#endif
-
 }
 
 /* tttypahead:	See if the user has more characters waiting in the
 		keyboard buffer
 */
-#if !  SYS_WINNT
+#if !  SYS_WINNT && !SYS_VMS
 int
 tttypahead(void)
 {
 
 #if DISP_X11
-    return x_typahead(0);
-#endif
-
-#if DISP_VMSVT
-    if (ibufi >= nibuf) {
-	read_vms_tty(NIBUF);
-	return (nibuf > 0);
-    }
-    return TRUE;
+    return x_milli_sleep(0);
 #endif
 
 #if SYS_MSDOS || SYS_OS2
@@ -1336,228 +1186,6 @@
 /******************************************************************************/
 
 /*
- * Define an empty terminal type for machines where we cannot use 'dumb_term',
- * so that command-line prompting will have something to talk to.
- */
-
-static void
-nullterm_open(void)
-{
-}
-
-static void
-nullterm_close(void)
-{
-}
-
-static int
-nullterm_getch(void)
-{
-    return esc_c;
-}
-
-/*ARGSUSED*/
-static OUTC_DCL
-nullterm_putch(OUTC_ARGS)
-{
-    OUTC_RET c;
-}
-
-static int
-nullterm_typahead(void)
-{
-    return FALSE;
-}
-
-static void
-nullterm_flush(void)
-{
-}
-
-/*ARGSUSED*/
-static void
-nullterm_curmove(int row GCC_UNUSED, int col GCC_UNUSED)
-{
-}
-
-static void
-nullterm_eeol(void)
-{
-}
-
-static void
-nullterm_eeop(void)
-{
-}
-
-static void
-nullterm_beep(void)
-{
-}
-
-/*ARGSUSED*/
-static void
-nullterm_rev(UINT state GCC_UNUSED)
-{
-}
-
-#if OPT_COLOR
-#define NO_COLOR(name,value) name = value;
-#else
-#define NO_COLOR(name,value)	/*nothing */
-#endif
-
-/*
- * These are public, since we'll use them as placeholders for unimplemented
- * device methods.
- */
-/*ARGSUSED*/
-int
-nullterm_setdescrip(const char *res GCC_UNUSED)
-{
-    return (FALSE);
-}
-
-/*ARGSUSED*/
-int
-nullterm_watchfd(int fd GCC_UNUSED, WATCHTYPE type GCC_UNUSED, long *idp GCC_UNUSED)
-{
-    return 0;
-}
-
-/*ARGSUSED*/
-void
-nullterm_cursorvis(int flag GCC_UNUSED)
-{
-}
-
-/*ARGSUSED*/
-void
-nullterm_icursor(int c GCC_UNUSED)
-{
-}
-
-/*ARGSUSED*/
-void
-nullterm_kclose(void)
-{
-}
-
-/*ARGSUSED*/
-void
-nullterm_kopen(void)
-{
-}
-
-/*ARGSUSED*/
-void
-nullterm_pflush(void)
-{
-}
-
-/*ARGSUSED*/
-void
-nullterm_scroll(int f GCC_UNUSED, int t GCC_UNUSED, int n GCC_UNUSED)
-{
-}
-
-/*ARGSUSED*/
-void
-nullterm_setback(int b GCC_UNUSED)
-{
-    NO_COLOR(gbcolor, C_BLACK)
-}
-
-/*ARGSUSED*/
-void
-nullterm_setccol(int c GCC_UNUSED)
-{
-    NO_COLOR(gccolor, ENUM_UNKNOWN)
-}
-
-/*ARGSUSED*/
-void
-nullterm_setfore(int f GCC_UNUSED)
-{
-    NO_COLOR(gbcolor, C_WHITE)
-}
-
-/*ARGSUSED*/
-void
-nullterm_setpal(const char *p GCC_UNUSED)
-{
-}
-
-/*ARGSUSED*/
-void
-nullterm_settitle(const char *t GCC_UNUSED)
-{
-}
-
-/*ARGSUSED*/
-void
-nullterm_unwatchfd(int fd GCC_UNUSED, long id GCC_UNUSED)
-{
-}
-
-/*ARGSUSED*/
-void
-nullterm_mopen(void)
-{
-}
-
-/*ARGSUSED*/
-void
-nullterm_mclose(void)
-{
-}
-
-/*ARGSUSED*/
-void
-nullterm_mevent(void)
-{
-}
-
-TERM null_term =
-{
-    1,
-    1,
-    80,
-    80,
-    0,				/* NPAUSE */
-    nullterm_open,
-    nullterm_close,
-    nullterm_kopen,
-    nullterm_kclose,
-    nullterm_getch,
-    nullterm_putch,
-    nullterm_typahead,
-    nullterm_flush,
-    nullterm_curmove,
-    nullterm_eeol,
-    nullterm_eeop,
-    nullterm_beep,
-    nullterm_rev,
-    nullterm_setdescrip,
-    nullterm_setfore,
-    nullterm_setback,
-    nullterm_setpal,
-    nullterm_setccol,
-    nullterm_scroll,
-    nullterm_pflush,
-    nullterm_icursor,
-    nullterm_settitle,
-    nullterm_watchfd,
-    nullterm_unwatchfd,
-    nullterm_cursorvis,
-    nullterm_mopen,
-    nullterm_mclose,
-    nullterm_mevent,
-};
-
-/******************************************************************************/
-
-/*
  * This function is used during terminal initialization to allow us to setup
  * either a dumb or null terminal driver to handle stray command-line and other
  * debris, then (in the second call), open the screen driver.
@@ -1568,6 +1196,18 @@
     static TERM save_term;
     static int initialized;
 
+    /*
+     * Help separate dumb_term from termio.c
+     */
+    if (termp != 0 && termp != &null_term) {
+	if (termp->clean == nullterm_clean)
+	    termp->clean = ttclean;
+	if (termp->unclean == nullterm_unclean)
+	    termp->unclean = ttunclean;
+	if (termp->openup == nullterm_openup)
+	    termp->openup = kbd_openup;
+    }
+
     if (!initialized++) {
 
 	/*
Index: test_io.c
Prereq:  1.1 
--- vile-9.5e+/test_io.c	2006-01-10 01:18:48.000000000 +0000
+++ vile-9.5f/test_io.c	2006-01-10 23:28:47.000000000 +0000
@@ -1,12 +1,13 @@
 /*
  * Stub for testing linkage requirements of I/O drivers.
  *
- * $Header: /usr/build/vile/vile/RCS/test_io.c,v 1.1 2006/01/10 01:18:48 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/test_io.c,v 1.2 2006/01/10 23:28:47 tom Exp $
  */
 
 #include <estruct.h>
 
-extern TERM term;		/* Terminal information.        */
+#define realdef			/* Make global definitions not external */
+#include	"edef.h"	/* global declarations */
 
 int
 main(int argc, char **argv)
Index: version.c
Prereq:  1.58 
--- vile-9.5e+/version.c	2005-11-30 01:25:16.000000000 +0000
+++ vile-9.5f/version.c	2006-01-12 22:37:43.000000000 +0000
@@ -1,7 +1,7 @@
 /*
  * version & usage-messages for vile
  *
- * $Header: /usr/build/vile/vile/RCS/version.c,v 1.58 2005/11/30 01:25:16 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/version.c,v 1.59 2006/01/12 22:37:43 tom Exp $
  *
  */
 
@@ -82,7 +82,7 @@
 	"single-letter options usually are case-independent"
     };
 
-    ttclean(TRUE);
+    term.clean(TRUE);
 #if DISP_NTWIN
     gui_usage(prog_arg, options, TABLESIZE(options));
 #else
Index: vile-9.5.spec
Prereq:  1.5 
--- vile-9.5e+/vile-9.5.spec	2005-11-24 22:52:46.000000000 +0000
+++ vile-9.5f/vile-9.5.spec	2006-01-10 22:53:14.000000000 +0000
@@ -1,7 +1,7 @@
 Summary: VILE VI Like Emacs editor
-# $Header: /usr/build/vile/vile/RCS/vile-9.5.spec,v 1.5 2005/11/24 22:52:46 tom Exp $
+# $Header: /usr/build/vile/vile/RCS/vile-9.5.spec,v 1.7 2006/01/10 22:53:14 tom Exp $
 Name: vile
-Version: 9.5d
+Version: 9.5f
 # each patch should update the version
 Release: 1
 Copyright: GPL
@@ -12,6 +12,8 @@
 Patch2: vile-9.5b.patch.gz
 Patch3: vile-9.5c.patch.gz
 Patch4: vile-9.5d.patch.gz
+Patch5: vile-9.5e.patch.gz
+Patchf: vile-9.5f.patch.gz
 # each patch should add itself to this list
 Packager: Thomas Dickey <dickey@invisible-island.net>
 BuildRoot: %{_tmppath}/%{name}-root
@@ -28,6 +30,8 @@
 %patch2 -p1
 %patch3 -p1
 %patch4 -p1
+%patch5 -p1
+%patch6 -p1
 # each patch should add itself to this list
 
 %build
@@ -80,6 +84,12 @@
 %changelog
 # each patch should add its ChangeLog entries here
 
+* Tue Jan 10 2006 Thomas Dickey
+- added patch for 9.5f
+
+* Tue Jan 10 2006 Thomas Dickey
+- added patch for 9.5e
+
 * Thu Nov 24 2005 Thomas Dickey
 - added patch for 9.5d
 
Index: vile.hlp
Prereq:  1.606 
--- vile-9.5e+/vile.hlp	2006-01-09 23:49:18.000000000 +0000
+++ vile-9.5f/vile.hlp	2006-02-16 01:26:06.000000000 +0000
@@ -2706,6 +2706,7 @@
 	character.  There are two types of built-in variables (the so-called
 	"state" variables, and mode values).  The state variables are:
 
+	$_		most-recent macro $return value
 	$abufname	alternate buffer name (i.e. last visited) (read only)
 	$autocolor-hook	name of the hook that runs when autocolor is enabled
 	$bchars		number of characters in current buffer	(read only)
@@ -2812,6 +2813,7 @@
 	$qidentifier	current qualified name (as with C++ ::)
 	$read-hook	name of procedure to run after a file is read
 	$replace	replacement pattern
+	$return		set within a macro to provide $_ on completion
 	$search		search pattern
 	$seed		current random number seed
 	$shell		name of the shell program for spawned commands.
@@ -3607,13 +3609,15 @@
 		%L	number of lines in buffer, if ruler is set
 		%m	major mode(s), e.g., cmode, view-only, etc.  Displayed
 			in square brackets.
-		%n	relative file name when not internal buffer name,
+		%n	file leaf name when not internal buffer name,
 			otherwise the buffer name.
-		%N	absolute file name when not internal buffer name,
+		%N	absolute file path when not internal buffer name,
 			otherwise the buffer name.
 		%p	line number as percentage of number of lines if
 			"ruler" is set
 		%P	line number as percentage of number of lines
+		%r	relative file name when not internal buffer name,
+			otherwise the buffer name.
 		%S	rough position of window with respect to buffer (top,
 			bot, all, emp, mid) when ruler not set (or ruler is
 			set, but buffer is empty).
@@ -3756,9 +3760,9 @@
 
 	b) vile is compiled and linked with the terminfo library.
 
-	Hint 1:  On linux hosts, the "xterm" terminal type supports 8
-	colors (i.e., ensure that "export TERM=xterm" or csh equiv is
-	included in your shell startup file).
+	Hint 1:  Modern xterm and similar terminal emulators support 8 colors
+	(i.e., ensure that the correct $TERM is used, e.g., "export TERM=xterm"
+	or csh equiv is included in your shell startup file).
 
 	Hint 2:  To determine if the editor was compiled with terminfo,
 	type :show-variables and examine the value of $cfgopts.  If this
@@ -6218,4 +6222,4 @@
 
 Copyright 1995-2005,2006 by Paul Fox, Thomas Dickey, and Kevin Buettner
 --------------------------------------------------------------------
- $Header: /usr/build/vile/vile/RCS/vile.hlp,v 1.606 2006/01/09 23:49:18 tom Exp $
+ $Header: /usr/build/vile/vile/RCS/vile.hlp,v 1.610 2006/02/16 01:26:06 tom Exp $
Index: vmsbuild.com
Prereq:  1.44 
--- vile-9.5e+/vmsbuild.com	2005-07-24 20:25:20.000000000 +0000
+++ vile-9.5f/vmsbuild.com	2006-01-14 01:44:31.000000000 +0000
@@ -1,4 +1,4 @@
-$! $Header: /usr/build/vile/vile/RCS/vmsbuild.com,v 1.44 2005/07/24 20:25:20 tom Exp $
+$! $Header: /usr/build/vile/vile/RCS/vmsbuild.com,v 1.46 2006/01/14 01:44:31 tom Exp $
 $! VMS build-script for vile.  Requires installed C compiler
 $!
 $! Screen Configurations
@@ -43,25 +43,8 @@
 $ start:
 $! -----------------------------------------------------------
 $! pickup user's compiler choice, if any
-$! -----------------------------------------------------------
 $!
-$ comp = ""
-$ using_vaxc = 0
-$ if "''p2'" .nes. ""
-$ then
-$    comp = f$edit(p2, "UPCASE")
-$    if "''comp'" .eqs. "VAXC"
-$    then
-$        gosub vaxc_config
-$    else
-$        if "''comp'" .eqs. "DECC"
-$        then
-$            gosub decc_config
-$        else
-$            gosub usage
-$        endif
-$    endif
-$ endif
+$	gosub parm2_compiler
 $! -----------------------------------------------------------
 $!      Build the option-file
 $!
@@ -94,6 +77,7 @@
 $ write optf "modes.obj"
 $ write optf "msgs.obj"
 $ write optf "npopen.obj"
+$ write optf "nullterm.obj"
 $ write optf "oneliner.obj"
 $ write optf "opers.obj"
 $ write optf "path.obj"
@@ -119,137 +103,140 @@
 $! ----------------------------------
 $! Look for the compiler used and specify architecture.
 $!
-$ CC = "CC"
-$ arch = "UNKNOWN"
+$!!!	gosub set_compiler
+$!!!	gosub set_symbols
+$!
+$	CC = "CC"
+$	arch = "UNKNOWN"
+$!
+$	if f$getsyi("ARCH_NAME") .eqs. "Alpha"
+$	then
+$		arch = "__alpha__=1"
+$		if "''comp'" .eqs. "" then gosub decc_config
+$	endif
+$!
+$	if f$getsyi("ARCH_NAME") .eqs. "IA64"
+$	then
+$		arch = "__ia64__=1"
+$		if "''comp'" .eqs. "" then gosub decc_config
+$	endif
 $!
-$ if f$getsyi("ARCH_NAME") .eqs. "Alpha"
-$ then
-$  arch = "__alpha__=1"
-$  if "''comp'" .eqs. "" then gosub decc_config
-$ endif
-$!
-$ if f$getsyi("ARCH_NAME") .eqs. "IA64"
-$ then
-$  arch = "__ia64__=1"
-$  if "''comp'" .eqs. "" then gosub decc_config
-$ endif
-$!
-$ if f$getsyi("ARCH_NAME") .eqs. "VAX"
-$ then
-$  arch = "__vax__=1"
-$  if "''comp'" .nes. "" then goto screen_config
-$  if f$search("SYS$SYSTEM:VAXC.EXE").nes.""
-$  then
-$   gosub vaxc_config
-$  else
-$   if f$search("SYS$SYSTEM:DECC$COMPILER.EXE").nes.""
-$   then
-$    gosub decc_config
-$   else
-$    DEFS = ",HAVE_STRERROR"
-$    if f$trnlnm("GNU_CC").eqs.""
-$    then
-$     write sys$output "C compiler required to rebuild vile"
-$     close optf
-$     exit
-$    else
-$     write optf "gnu_cc:[000000]gcclib.olb/lib"
-$     comp = "__gcc__=1"
-$     CC = "GCC"
-$    endif
-$   endif
-$  endif
-$ endif
+$	if f$getsyi("ARCH_NAME") .eqs. "VAX"
+$	then
+$		arch = "__vax__=1"
+$		if "''comp'" .nes. "" then goto screen_config
+$		if f$search("SYS$SYSTEM:VAXC.EXE").nes.""
+$		then
+$			gosub vaxc_config
+$		else
+$			if f$search("SYS$SYSTEM:DECC$COMPILER.EXE").nes.""
+$			then
+$				gosub decc_config
+$			else
+$				DEFS = ",HAVE_STRERROR"
+$				if f$trnlnm("GNU_CC").eqs.""
+$				then
+$					write sys$output "C compiler required to rebuild vile"
+$					close optf
+$					exit
+$				else
+$					write optf "gnu_cc:[000000]gcclib.olb/lib"
+$					comp = "__gcc__=1"
+$					CC = "GCC"
+$				endif
+$			endif
+$		endif
+$	endif
 $
-$ if "''arch'" .eqs. "UNKNOWN"
-$ then
-$   write sys$output "Cannot determine architecture type"
-$   exit 1
-$ endif
+$	if "''arch'" .eqs. "UNKNOWN"
+$	then
+$		write sys$output "Cannot determine architecture type"
+$		exit 1
+$	endif
 $!
 $ screen_config:
 $!
-$ MKTBLS :== $SYS$DISK:'F$DIRECTORY()MKTBLS.EXE	! make a foreign command
+$	MKTBLS :== $SYS$DISK:'F$DIRECTORY()MKTBLS.EXE	! make a foreign command
 $!
-$ if "''p1'" .nes. "XVILE" .and. "''p1'" .nes. "XVILE.EXE"
-$  then
+$	if "''p1'" .nes. "XVILE" .and. "''p1'" .nes. "XVILE.EXE"
+$	then
 $! for regular vile, use these:
-$   SCREEN := vmsvt
-$   TARGET := vile
-$   SCRDEF := "DISP_VMSVT,scrn_chosen"
-$   mmstar = "__vile__=1"
-$ else
+$		SCREEN := vmsvt
+$		TARGET := vile
+$		SCRDEF := "DISP_VMSVT,scrn_chosen"
+$		mmstar = "__vile__=1"
+$	else
 $! for building the X toolkit version:
-$   SCREEN := x11
-$   TARGET := xvile
-$   SCRDEF = "NO_WIDGETS,XTOOLKIT,DISP_X11,scrn_chosen"
-$   mmstar = "__xvile__=1"
+$		SCREEN := x11
+$		TARGET := xvile
+$		SCRDEF = "NO_WIDGETS,XTOOLKIT,DISP_X11,scrn_chosen"
+$		mmstar = "__xvile__=1"
 $!
 $!  Find out which X-Version we're running.  This will fail for older
 $!  VMS versions (i.e., v5.5-1).  Therefore, choose DECWindows XUI for
 $!  default.
 $!
-$   On Error Then GoTo XUI
-$   @sys$update:decw$get_image_version sys$share:decw$xlibshr.exe decw$version
-$   if f$extract(4,3,decw$version).eqs."1.0"
-$   then
-$     write optf "Sys$share:DECW$DWTLIBSHR.EXE/Share"
-$   endif
-$   if f$extract(4,3,decw$version).eqs."1.1"
-$   then
-$     write optf "menu.obj"
-$     write optf "x11menu.obj"
-$     write optf "sys$share:decw$xmlibshr.exe/share"
-$     write optf "sys$share:decw$xtshr.exe/share"
-$     SCRDEF := "MOTIF_WIDGETS,XTOOLKIT,DISP_X11,scrn_chosen"
-$     mmstar = "__xmvile__=1"
-$     GoTo MAIN2
-$   endif
-$   if f$extract(4,3,decw$version).eqs."1.2"
-$   then
-$     write optf "menu.obj"
-$     write optf "x11menu.obj"
-$     write optf "sys$share:decw$xmlibshr12.exe/share"
-$     write optf "sys$share:decw$xtlibshrr5.exe/share"
-$     SCRDEF := "MOTIF_WIDGETS,XTOOLKIT,DISP_X11,scrn_chosen"
-$     mmstar = "__xmvile__=1"
-$     GoTo MAIN2
-$   endif
-$   GoTo MAIN
-$!
-$XUI :
-$   write optf "Sys$share:DECW$DWTLIBSHR.EXE/Share"
-$!
-$MAIN :
-$   write optf "sys$share:decw$xtshr.exe/share"
-$   write optf "sys$share:decw$xlibshr.exe/share"
-$ endif
-$!
-$MAIN2 :
-$ if using_vaxc .eq. 1 then write optf "sys$library:vaxcrtl.exe/share"
-$ close optf
+$		On Error Then GoTo XUI
+$		@sys$update:decw$get_image_version sys$share:decw$xlibshr.exe decw$version
+$		if f$extract(4,3,decw$version).eqs."1.0"
+$		then
+$			write optf "Sys$share:DECW$DWTLIBSHR.EXE/Share"
+$		endif
+$		if f$extract(4,3,decw$version).eqs."1.1"
+$		then
+$			write optf "menu.obj"
+$			write optf "x11menu.obj"
+$			write optf "sys$share:decw$xmlibshr.exe/share"
+$			write optf "sys$share:decw$xtshr.exe/share"
+$			SCRDEF := "MOTIF_WIDGETS,XTOOLKIT,DISP_X11,scrn_chosen"
+$			mmstar = "__xmvile__=1"
+$			GoTo MAIN2
+$		endif
+$		if f$extract(4,3,decw$version).eqs."1.2"
+$		then
+$			write optf "menu.obj"
+$			write optf "x11menu.obj"
+$			write optf "sys$share:decw$xmlibshr12.exe/share"
+$			write optf "sys$share:decw$xtlibshrr5.exe/share"
+$			SCRDEF := "MOTIF_WIDGETS,XTOOLKIT,DISP_X11,scrn_chosen"
+$			mmstar = "__xmvile__=1"
+$			GoTo MAIN2
+$		endif
+$		GoTo MAIN
+$!
+$ XUI :
+$		write optf "Sys$share:DECW$DWTLIBSHR.EXE/Share"
+$!
+$ MAIN :
+$		write optf "sys$share:decw$xtshr.exe/share"
+$		write optf "sys$share:decw$xlibshr.exe/share"
+$	endif
+$!
+$ MAIN2 :
+$	if using_vaxc .eq. 1 then write optf "sys$library:vaxcrtl.exe/share"
+$		close optf
 $! -------------- vms_link.opt is created -------------
-$ if f$edit("''p1'", "UPCASE") .eqs. "VMS_LINK.OPT"
-$ then
+$		if f$edit("''p1'", "UPCASE") .eqs. "VMS_LINK.OPT"
+$		then
 $!  mms called this script to build vms_link.opt.  all done
-$   exit
-$ endif
+$			exit
+$		endif
 $!
-$ if f$search("SYS$SYSTEM:MMS.EXE").eqs.""
-$ then
+$	if f$search("SYS$SYSTEM:MMS.EXE").eqs.""
+$	then
 $!  can also use /Debug /Listing, /Show=All
 $
-$   CFLAGS := 'CFLAGS/Diagnostics /Define=("os_chosen","''SCRDEF'''DEFS'") /Include=([])
+$		CFLAGS := 'CFLAGS/Diagnostics /Define=("os_chosen","''SCRDEF'''DEFS'") /Include=([])
 $
-$  	if "''p3'" .nes. "" then gosub 'p3
-$  	if "''p3'" .nes. "" then exit 1
+$		if "''p3'" .nes. "" then gosub 'p3
+$		if "''p3'" .nes. "" then exit 1
 $!
-$	gosub all
+$		gosub all
 $!
-$  else
-$   mms/ignore=warning/macro=('comp','mmstar','arch') 'p3
-$  endif
-$ exit
+$	else
+$		mms/ignore=warning/macro=('comp','mmstar','arch') 'p3
+$	endif
+$	exit
 $!
 $ all:
 $	if f$search("mktbls.exe") .eqs. ""
@@ -298,6 +285,7 @@
 $	call make modes
 $	call make msgs
 $	call make npopen
+$	call make nullterm
 $	call make oneliner
 $	call make opers
 $	call make path
@@ -399,6 +387,136 @@
 $	write sys$output "** made xvile.com"
 $	return
 $!
+$! Test-drivers
+$ test_io :
+$	gosub parm2_compiler 'p2
+$	gosub set_compiler
+$	gosub set_symbols
+$!
+$	call make test_io
+$	call make vmsvt
+$	call make nullterm
+$	call linkit test_io test_io.obj,vmsvt.obj,nullterm.obj
+$!
+$	return
+$! --------------------------------
+$! Set compiler symbol "comp" based on 2nd parameter.
+$ parm2_compiler:
+$	comp = ""
+$	using_vaxc = 0
+$	if "''p2'" .nes. ""
+$	then
+$		comp = f$edit(p2, "UPCASE")
+$		if "''comp'" .eqs. "VAXC"
+$		then
+$			gosub vaxc_config
+$		else
+$			if "''comp'" .eqs. "DECC"
+$			then
+$				gosub decc_config
+$			else
+$				gosub usage
+$			endif
+$		endif
+$	endif
+$	return
+$! ----------------------------------
+$! Look for the compiler used and specify architecture.
+$ set_compiler:
+$	CC = "CC"
+$	arch = "UNKNOWN"
+$!
+$	if f$getsyi("ARCH_NAME") .eqs. "Alpha"
+$	then
+$		arch = "__alpha__=1"
+$		if "''comp'" .eqs. "" then gosub decc_config
+$	endif
+$!
+$	if f$getsyi("ARCH_NAME") .eqs. "IA64"
+$	then
+$		arch = "__ia64__=1"
+$		if "''comp'" .eqs. "" then gosub decc_config
+$	endif
+$!
+$	if f$getsyi("ARCH_NAME") .eqs. "VAX"
+$	then
+$		arch = "__vax__=1"
+$		if "''comp'" .nes. "" then goto done_compiler
+$		if f$search("SYS$SYSTEM:VAXC.EXE").nes.""
+$		then
+$			gosub vaxc_config
+$		else
+$			if f$search("SYS$SYSTEM:DECC$COMPILER.EXE").nes.""
+$			then
+$				gosub decc_config
+$			else
+$				DEFS = ",HAVE_STRERROR"
+$				if f$trnlnm("GNU_CC").eqs.""
+$				then
+$					write sys$output "C compiler required to rebuild vile"
+$					exit
+$				else
+$					comp = "__gcc__=1"
+$					CC = "GCC"
+$				endif
+$			endif
+$		endif
+$	endif
+$
+$	if "''arch'" .eqs. "UNKNOWN"
+$	then
+$		write sys$output "Cannot determine architecture type"
+$		exit 1
+$	endif
+$ done_compiler:
+$	return
+$! ----------------------------------
+$! Look for the compiler used and specify architecture.
+$ set_symbols:
+$	MKTBLS :== $SYS$DISK:'F$DIRECTORY()MKTBLS.EXE	! make a foreign command
+$!
+$	if "''p1'" .eqs. "XVILE" .or. "''p1'" .eqs. "XVILE.EXE"
+$	then
+$! for building the X toolkit version:
+$		SCREEN := x11
+$		TARGET := xvile
+$		SCRDEF = "NO_WIDGETS,XTOOLKIT,DISP_X11,scrn_chosen"
+$		mmstar = "__xvile__=1"
+$!
+$!  Find out which X-Version we're running.  This will fail for older
+$!  VMS versions (i.e., v5.5-1).  Therefore, choose DECWindows XUI for
+$!  default.
+$!
+$		On Error Then GoTo done_symbol
+$		@sys$update:decw$get_image_version sys$share:decw$xlibshr.exe decw$version
+$		if f$extract(4,3,decw$version).eqs."1.1"
+$		then
+$			SCRDEF := "MOTIF_WIDGETS,XTOOLKIT,DISP_X11,scrn_chosen"
+$			mmstar = "__xmvile__=1"
+$		endif
+$		if f$extract(4,3,decw$version).eqs."1.2"
+$		then
+$			SCRDEF := "MOTIF_WIDGETS,XTOOLKIT,DISP_X11,scrn_chosen"
+$			mmstar = "__xmvile__=1"
+$		endif
+$	else
+$! for regular vile, use these:
+$		SCREEN := vmsvt
+$		TARGET := vile
+$		SCRDEF := "DISP_VMSVT,scrn_chosen"
+$		mmstar = "__vile__=1"
+$	endif
+$!  can also use /Debug /Listing, /Show=All
+$	CFLAGS := 'CFLAGS/Diagnostics /Define=("os_chosen","''SCRDEF'''DEFS'") /Include=([])
+$	if f$search("SYS$SYSTEM:MMS.EXE").eqs.""
+$	then
+$		BUILDS = "with_dcl"
+$	else
+$		BUILDS = "with_mms"
+$	endif
+$ done_symbol :
+$	return
+$!
 $ make: subroutine
 $	if f$search("''p1'.obj") .eqs. ""
 $	then
@@ -406,9 +524,21 @@
 $		'CC 'CFLAGS 'p1.c
 $		if f$search("''p1'.dia") .nes. "" then delete 'p1.dia;*
 $	endif
-$exit
-$	return
+$	exit
 $ endsubroutine
+$!
+$ linkit: subroutine
+$!      sys$library:vaxcrtl.olb did not ship with VMS V8.2 HP rx2600 IA64,
+$!      nor with layered product HP C V7.1-011 on OpenVMS IA64 V8.2
+$	if f$search("SYS$LIBRARY:VAXCRTL.OLB") .nes. ""
+$	then
+$		link /exec='p1/map/cross 'p2,SYS$LIBRARY:VAXCRTL/LIB
+$	else
+$		link /exec='p1/map/cross 'p2
+$	endif
+$	exit
+$ endsubroutine
+$!
 $ vaxc_config:
 $    comp       = "__vaxc__=1"
 $    CFLAGS     = "/VAXC"
@@ -431,5 +561,6 @@
 $    write sys$output "      $ @vmsbuild xvile [{decc | vaxc} [<bldtarget>]]"
 $    write sys$output "bldtarget is one of"
 $    write sys$output "      all install clobber clean"
-$!    write sys$output "      vms_link.opt vile_com xvile_com"
+$    write sys$output "      vile_com xvile_com"
+$    write sys$output "      test_io test_btree test_regexp"
 $    exit 2
Index: vmsvt.c
Prereq:  1.58 
--- vile-9.5e+/vmsvt.c	2005-11-23 12:19:01.000000000 +0000
+++ vile-9.5f/vmsvt.c	2006-01-13 01:25:13.000000000 +0000
@@ -14,12 +14,13 @@
  *   -- support wide and narrow screen resolutions,
  *   -- support visual bells.
  *
- * $Header: /usr/build/vile/vile/RCS/vmsvt.c,v 1.58 2005/11/23 12:19:01 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/vmsvt.c,v 1.63 2006/01/13 01:25:13 tom Exp $
  *
  */
 
 #include	"estruct.h"	/* Emacs' structures            */
 #include	"edef.h"	/* Emacs' definitions           */
+#include	"nefunc.h"	/* f_backchar_to_bol            */
 
 #if DISP_VMSVT
 
@@ -33,10 +34,18 @@
 #include	<smg$routines.h>
 #include	<ssdef.h>
 
+#include	<descrip.h>
+#include	<iodef.h>
+#include	<ttdef.h>
+#include	<tt2def.h>
+
 /* function prototypes needed for the dispatch table */
-static void vmsscrollregion(int top, int bot);
-static void vmsscroll_reg(int from, int to, int n);
-static void vmsscroll_delins(int from, int to, int n);
+static OUTC_DCL vmsvt_putc(OUTC_ARGS);
+static int vmsvt_typahead(void);
+static void vmsvt_flush(void);
+static void vmsvt_scrollregion(int top, int bot);
+static void vmsvt_scroll_reg(int from, int to, int n);
+static void vmsvt_scroll_delins(int from, int to, int n);
 
 /* SMG stuff (just like termcap) */
 static int initialized;
@@ -74,7 +83,7 @@
     char *seq;
     int code;
 };
-struct vmskeyseqs vt100seqs[] =
+static struct vmskeyseqs vt100seqs[] =
 {
     { "\033[A",   KEY_Up },
     { "\033[B",   KEY_Down },
@@ -150,7 +159,7 @@
     { "\2332~",   KEY_Insert },
     { "\2334~",   KEY_Select },
 };
-struct vmskeyseqs vt52seqs[] =
+static struct vmskeyseqs vt52seqs[] =
 {
     { "\33A",     KEY_Up },
     { "\33B",     KEY_Down },
@@ -163,21 +172,46 @@
 };
 /* *INDENT-ON* */
 
+typedef struct {
+    USHORT status;		/* I/O completion status */
+    USHORT count;		/* byte transfer count   */
+    int dev_dep_data;		/* device-dependent data */
+} QIO_SB;			/* This is a QIO I/O Status Block */
+
+#define NIBUF	1024		/* Input buffer size            */
+#define NOBUF	1024		/* MM says big buffers win!     */
+#define EFN	0		/* Event flag                   */
+
+static char obuf[NOBUF];	/* Output buffer                */
+static int nobuf;		/* # of bytes in above          */
+
+static char ibuf[NIBUF];	/* Input buffer                 */
+static int nibuf;		/* # of bytes in above          */
+
+static int ibufi;		/* Read index                   */
+
+/*
+ * Public data also used by spawn.c
+ */
+int oldmode[3];			/* Old TTY mode bits            */
+int newmode[3];			/* New TTY mode bits            */
+short iochan;			/* TTY I/O channel              */
+
 /***
- *  ttputs  -  Send a string to ttputc
+ *  Send a string to vmsvt_putc
  *
  *  Nothing returned
  ***/
 static void
-ttputs(char *string)		/* String to write              */
+vmsvt_puts(char *string)	/* String to write              */
 {
     if (string)
 	while (*string != EOS)
-	    ttputc(*string++);
+	    vmsvt_putc(*string++);
 }
 
 /***
- *  vmsvt_tgoto - 2-argument request, e.g., for cursor movement.
+ *  2-argument request, e.g., for cursor movement.
  *
  *  Nothing returned
  ***/
@@ -208,24 +242,24 @@
 					       &ret_length,
 					       buffer,
 					       arg_list))) {
-	ttputs("OOPS");
+	vmsvt_puts("OOPS");
 	return;
     } else if (ret_length > 0) {
 	char *cp = buffer;
 	while (ret_length-- > 0)
-	    ttputc(*cp++);
+	    vmsvt_putc(*cp++);
     }
 }
 
 static void
-vmsmove(int row, int col)
+vmsvt_move(int row, int col)
 {
     vmsvt_tgoto(SMG$K_SET_CURSOR_ABS, row + 1, col + 1);
 }
 
 #if OPT_VIDEO_ATTRS
 static void
-vmsattr(UINT attr)
+vmsvt_attr(UINT attr)
 {
 #define VA_SGR (VASEL|VAREV|VAUL|VAITAL|VABOLD)
     /* *INDENT-OFF* */
@@ -261,7 +295,7 @@
 	    if ((tbl[n].mask & diff) != 0
 		&& (tbl[n].mask & attr) == 0
 		&& (s = *(tbl[n].end)) != 0) {
-		ttputs(s);
+		vmsvt_puts(s);
 #if OPT_COLOR
 		if (!ends)	/* do this once */
 		    reinitialize_colors();
@@ -276,16 +310,16 @@
 	    if ((tbl[n].mask & diff) != 0
 		&& (tbl[n].mask & attr) != 0
 		&& (s = *(tbl[n].start)) != 0) {
-		ttputs(s);
+		vmsvt_puts(s);
 		diff &= ~(tbl[n].mask);
 	    }
 	}
 
 	if (tc_SO != 0 && tc_SE != 0) {
 	    if (ends && (attr & (VAREV | VASEL))) {
-		ttputs(tc_SO);
+		vmsvt_puts(tc_SO);
 	    } else if (diff & VA_SGR) {		/* we didn't find it */
-		ttputs(tc_SE);
+		vmsvt_puts(tc_SE);
 	    }
 	}
 #if OPT_COLOR
@@ -313,23 +347,23 @@
 	return;
     revstate = state;
     if (state)
-	ttputs(tc_SO);
+	vmsvt_puts(tc_SO);
     else
-	ttputs(tc_SE);
+	vmsvt_puts(tc_SE);
 }
 
 #endif /* OPT_VIDEO_ATTRS */
 
 static void
-vmseeol(void)
+vmsvt_eeol(void)
 {
-    ttputs(erase_to_end_line);
+    vmsvt_puts(erase_to_end_line);
 }
 
 static void
-vmseeop(void)
+vmsvt_eeop(void)
 {
-    ttputs(erase_whole_display);
+    vmsvt_puts(erase_whole_display);
 }
 
 static void
@@ -448,8 +482,12 @@
 }
 
 static void
-vmsopen(void)
+vmsvt_open(void)
 {
+    QIO_SB iosb;
+    int status;
+    $DESCRIPTOR(odsc, "SYS$COMMAND");
+
     int i, keyseq_tablesize;
     struct vmskeyseqs *keyseqs;
 
@@ -496,9 +534,9 @@
     if (scroll_regn && scroll_back) {
 	if (scroll_forw == NULL)	/* assume '\n' scrolls forward */
 	    scroll_forw = "\n";
-	term.scroll = vmsscroll_reg;
+	term.scroll = vmsvt_scroll_reg;
     } else if (delete_line && insert_line)
-	term.scroll = vmsscroll_delins;
+	term.scroll = vmsvt_scroll_delins;
     else
 	term.scroll = nullterm_scroll;
 
@@ -509,7 +547,34 @@
 		  : "WIDE");
 
     /* Open terminal I/O drivers */
-    ttopen();
+    status = sys$assign(&odsc, &iochan, 0, 0);
+    if (status != SS$_NORMAL)
+	tidy_exit(status);
+    status = sys$qiow(EFN, iochan, IO$_SENSEMODE, &iosb, 0, 0,
+		      oldmode, sizeof(oldmode), 0, 0, 0, 0);
+    if (status != SS$_NORMAL
+	|| iosb.status != SS$_NORMAL)
+	tidy_exit(status);
+    newmode[0] = oldmode[0];
+    newmode[1] = oldmode[1];
+    newmode[1] |= TT$M_NOBRDCST;	/* turn on no-broadcast */
+    newmode[1] &= ~TT$M_TTSYNC;
+    newmode[1] &= ~TT$M_ESCAPE;	/* turn off escape-processing */
+    newmode[1] &= ~TT$M_HOSTSYNC;
+    newmode[1] &= ~TT$M_NOTYPEAHD;	/* turn off no-typeahead */
+    newmode[2] = oldmode[2];
+    newmode[2] |= TT2$M_PASTHRU;	/* turn on pass-through */
+    newmode[2] |= TT2$M_ALTYPEAHD;	/* turn on big typeahead buffer */
+    status = sys$qiow(EFN, iochan, IO$_SETMODE, &iosb, 0, 0,
+		      newmode, sizeof(newmode), 0, 0, 0, 0);
+    if (status != SS$_NORMAL
+	|| iosb.status != SS$_NORMAL)
+	tidy_exit(status);
+    term.rows = (newmode[1] >> 24);
+    term.cols = newmode[0] >> 16;
+
+    /* make sure backspace is bound to backspace */
+    asciitbl[backspc] = &f_backchar_to_bol;
 
     /* Set predefined keys */
     for (i = keyseq_tablesize; i--;)
@@ -522,23 +587,23 @@
 
 /* move howmany lines starting at from to to */
 static void
-vmsscroll_reg(int from, int to, int n)
+vmsvt_scroll_reg(int from, int to, int n)
 {
     int i;
     if (to == from)
 	return;
     if (to < from) {
-	vmsscrollregion(to, from + n - 1);
-	vmsmove(from + n - 1, 0);
+	vmsvt_scrollregion(to, from + n - 1);
+	vmsvt_move(from + n - 1, 0);
 	for (i = from - to; i > 0; i--)
-	    ttputs(scroll_forw);
+	    vmsvt_puts(scroll_forw);
     } else {			/* from < to */
-	vmsscrollregion(from, to + n - 1);
-	vmsmove(from, 0);
+	vmsvt_scrollregion(from, to + n - 1);
+	vmsvt_move(from, 0);
 	for (i = to - from; i > 0; i--)
-	    ttputs(scroll_back);
+	    vmsvt_puts(scroll_back);
     }
-    vmsscrollregion(0, term.rows - 1);
+    vmsvt_scrollregion(0, term.rows - 1);
 }
 
 /*
@@ -548,7 +613,7 @@
 
 /* move howmany lines starting at from to to */
 static void
-vmsscroll_delins(int from, int to, int n)
+vmsvt_scroll_delins(int from, int to, int n)
 {
     int i;
     if (to == from)
@@ -556,7 +621,7 @@
     /* patch: should make this more like 'tcap.c', or merge logic somehow */
 #if OPT_PRETTIER_SCROLL
     if (absol(from - to) > 1) {
-	vmsscroll_delins(from, (from < to) ? to - 1 : to + 1, n);
+	vmsvt_scroll_delins(from, (from < to) ? to - 1 : to + 1, n);
 	if (from < to)
 	    from = to - 1;
 	else
@@ -564,38 +629,38 @@
     }
 #endif
     if (to < from) {
-	vmsmove(to, 0);
+	vmsvt_move(to, 0);
 	for (i = from - to; i > 0; i--)
-	    ttputs(delete_line);
-	vmsmove(to + n, 0);
+	    vmsvt_puts(delete_line);
+	vmsvt_move(to + n, 0);
 	for (i = from - to; i > 0; i--)
-	    ttputs(insert_line);
+	    vmsvt_puts(insert_line);
     } else {
-	vmsmove(from + n, 0);
+	vmsvt_move(from + n, 0);
 	for (i = to - from; i > 0; i--)
-	    ttputs(delete_line);
-	vmsmove(from, 0);
+	    vmsvt_puts(delete_line);
+	vmsvt_move(from, 0);
 	for (i = to - from; i > 0; i--)
-	    ttputs(insert_line);
+	    vmsvt_puts(insert_line);
     }
 }
 
 /* cs is set up just like cm, so we use tgoto... */
 static void
-vmsscrollregion(int top, int bot)
+vmsvt_scrollregion(int top, int bot)
 {
     vmsvt_tgoto(SMG$K_SET_SCROLL_REGION, top + 1, bot + 1);
 }
 
 /***
- *  vmscres  -	Change screen resolution
+ *  Change screen resolution
  *
  *  support these values:   WIDE -> 132 columns, NORMAL -> 80 columns
  *
  *  T -> if resolution successfully changed, F otherwise.
  ***/
 static int
-vmscres(const char *res)
+vmsvt_cres(const char *res)
 {
     char buf[NLINE];
     int rc = FALSE;
@@ -608,11 +673,11 @@
     strcpy(buf, res);
     mkupper(buf);
     if (strcmp(buf, "WIDE") == 0 && set_wide != 0) {
-	ttputs(set_wide);
+	vmsvt_puts(set_wide);
 	term.cols = wide_cols;
 	rc = TRUE;
     } else if (strcmp(buf, "NORMAL") == 0 && set_narrow != 0) {
-	ttputs(set_narrow);
+	vmsvt_puts(set_narrow);
 	term.cols = narrow_cols;
 	rc = TRUE;
     } else
@@ -623,7 +688,7 @@
 }
 
 static void
-vmsclose(void)
+vmsvt_close(void)
 {
     if (tc.t_type != TT$_VT52) {
 	/*
@@ -631,28 +696,42 @@
 	 * cleanup as usual.
 	 */
 	if (tc.t_width != term.cols)
-	    vmscres((tc.t_width == narrow_cols) ? "NORMAL" : "WIDE");
+	    vmsvt_cres((tc.t_width == narrow_cols) ? "NORMAL" : "WIDE");
     }
-    ttclose();
+    /*
+     * Note: this code used to check for errors when closing the output,
+     * but it didn't work properly (left the screen set in 1-line mode)
+     * when I was running as system manager, so I took out the error
+     * checking -- T.Dickey 94/7/15.
+     */
+    int status;
+    QIO_SB iosb;
+
+    vmsvt_flush();
+    status = sys$qiow(EFN, iochan, IO$_SETMODE, &iosb, 0, 0,
+		      oldmode, sizeof(oldmode), 0, 0, 0, 0);
+    if (status == SS$_IVCHAN)
+	return;			/* already closed it */
+    (void) sys$dassgn(iochan);
 }
 
 /***
- *  vmsbeep  -	Ring the bell
+ *  Ring the bell
  *
  *  Nothing returned
  ***/
 static void
-vmsbeep(void)
+vmsvt_beep(void)
 {
 #if OPT_FLASH
     int hit = 0;
 
     if (global_g_val(GMDFLASH) && dark_off != NULL && dark_on != NULL) {
 	hit = 1;
-	ttputs(dark_off);
+	vmsvt_puts(dark_off);
 	term.flush();
 	catnap(200, FALSE);
-	ttputs(dark_on);
+	vmsvt_puts(dark_on);
     }
     if (!hit && tc.t_type != TT$_VT52) {
 	/* *INDENT-OFF* */
@@ -670,19 +749,115 @@
 	str1 = seq[val][0];
 	if (str1) {
 	    str2 = seq[val][1];
-	    ttputs(str1);
+	    vmsvt_puts(str1);
 	    term.flush();
 	    catnap(200, FALSE);
-	    ttputs(str2);
+	    vmsvt_puts(str2);
 	    hit = 1;
 	}
     }
     if (!hit)
 #endif
-	ttputc(BEL);
+	vmsvt_putc(BEL);
+}
+
+static void
+read_vms_tty(int length)
+{
+    int status;
+    QIO_SB iosb;
+    int term[2] =
+    {0, 0};
+    unsigned mask = (IO$_READVBLK
+		     | IO$M_NOECHO
+		     | IO$M_NOFILTR
+		     | IO$M_TRMNOECHO);
+
+    status = sys$qiow(EFN, iochan,
+		      ((length == 1)
+		       ? mask
+		       : mask | IO$M_TIMED),
+		      &iosb, 0, 0, ibuf, length, 0, term, 0, 0);
+
+    if (status != SS$_NORMAL)
+	tidy_exit(status);
+    if (iosb.status == SS$_ENDOFFILE)
+	tidy_exit(status);
+
+    nibuf = iosb.count;
+    ibufi = 0;
+}
+
+/*
+ * Read a character from the terminal, performing no editing and doing no echo
+ * at all.  More complex in VMS than almost anyplace else, which figures.
+ */
+static int
+vmsvt_getc(void)
+{
+    while (ibufi >= nibuf) {
+	if (!vmsvt_typahead())
+	    read_vms_tty(1);
+    }
+    return (ibuf[ibufi++] & 0xFF);	/* Allow multinational  */
+}
+
+/*
+ * Write a character to the display. On VMS, terminal output is buffered, and
+ * we just put the characters in the big array, after checking for overflow.
+ */
+static OUTC_DCL
+vmsvt_putc(OUTC_ARGS)
+{
+    if (nobuf >= NOBUF)
+	vmsvt_flush();
+    obuf[nobuf++] = c;
+    OUTC_RET c;
+}
+
+static int
+vmsvt_typahead(void)
+{
+    if (ibufi >= nibuf) {
+	read_vms_tty(NIBUF);
+	return (nibuf > 0);
+    }
+    return TRUE;
+}
+
+/*
+ * Flush terminal buffer. Does real work where the terminal output is buffered
+ * up. A no-operation on systems where byte at a time terminal I/O is done.
+ */
+static void
+vmsvt_flush(void)
+{
+    QIO_SB iosb;
+
+    if (nobuf != 0) {
+	(void) sys$qiow(EFN, iochan, IO$_WRITELBLK | IO$M_NOFORMAT,
+			&iosb, 0, 0, obuf, nobuf, 0, 0, 0, 0);
+	nobuf = 0;
+    }
+}
+
+static void
+vmsvt_clean(int f)
+{
+    if (f)
+	term.openup();
+
+    term.flush();
+    term.close();
+    term.kclose();
+}
+
+static void
+vmsvt_unclean(void)
+{
 }
 
-/* Dispatch table. All hard fields just point into the terminal I/O code. */
+/* Dispatch table. */
 TERM term =
 {
     24,				/* Max number of rows allowable */
@@ -692,24 +867,27 @@
 				/* Filled in */ 0,
 				/* Current number of columns    */
     100,			/* # times thru update to pause */
-    vmsopen,			/* Open terminal at the start   */
-    vmsclose,			/* Close terminal at end        */
+    vmsvt_open,			/* Open terminal at the start   */
+    vmsvt_close,		/* Close terminal at end        */
     nullterm_kopen,		/* Open keyboard                */
     nullterm_kclose,		/* Close keyboard               */
-    ttgetc,			/* Get character from keyboard  */
-    ttputc,			/* Put character to display     */
-    tttypahead,			/* char ready for reading       */
-    ttflush,			/* Flush output buffers         */
-    vmsmove,			/* Move cursor, origin 0        */
-    vmseeol,			/* Erase to end of line         */
-    vmseeop,			/* Erase to end of page         */
-    vmsbeep,			/* Beep                         */
+    vmsvt_clean,		/* cleanup keyboard             */
+    vmsvt_unclean,		/* uncleanup keyboard           */
+    nullterm_openup,
+    vmsvt_getc,			/* Get character from keyboard  */
+    vmsvt_putc,			/* Put character to display     */
+    vmsvt_typahead,		/* char ready for reading       */
+    vmsvt_flush,		/* Flush output buffers         */
+    vmsvt_move,			/* Move cursor, origin 0        */
+    vmsvt_eeol,			/* Erase to end of line         */
+    vmsvt_eeop,			/* Erase to end of page         */
+    vmsvt_beep,			/* Beep                         */
 #if OPT_VIDEO_ATTRS
-    vmsattr,			/* Set attribute video state    */
+    vmsvt_attr,			/* Set attribute video state    */
 #else
-    vmsrev,			/* Set reverse video state      */
+    vmsvt_rev,			/* Set reverse video state      */
 #endif
-    vmscres,			/* Change screen resolution     */
+    vmsvt_cres,			/* Change screen resolution     */
     nullterm_setfore,		/* N/A: Set foreground color    */
     nullterm_setback,		/* N/A: Set background color    */
     nullterm_setpal,		/* N/A: Set palette colors      */
Index: w32cmd.c
Prereq:  1.35 
--- vile-9.5e+/w32cmd.c	2005-01-26 19:17:55.000000000 +0000
+++ vile-9.5f/w32cmd.c	2006-02-19 18:21:15.000000000 +0000
@@ -2,7 +2,7 @@
  * w32cmd:  collection of functions that add Win32-specific editor
  *          features (modulo the clipboard interface) to [win]vile.
  *
- * $Header: /usr/build/vile/vile/RCS/w32cmd.c,v 1.35 2005/01/26 19:17:55 cmorgan Exp $
+ * $Header: /usr/build/vile/vile/RCS/w32cmd.c,v 1.36 2006/02/19 18:21:15 tom Exp $
  */
 
 #include "estruct.h"
@@ -19,8 +19,8 @@
 #define FOOTER_OFFS      0.333  /* inches from bottom of page */
 #define _FF_             '\f'
 
-#define REGKEY_RECENT_FILES "Software\\winvile\\MRUFiles"
-#define REGKEY_RECENT_FLDRS "Software\\winvile\\MRUFolders"
+#define REGKEY_RECENT_FILES VILE_SUBKEY "\\MRUFiles"
+#define REGKEY_RECENT_FLDRS VILE_SUBKEY "\\MRUFolders"
 #define RECENT_REGVALUE_FMT "%02X"
 
 /* --------------------------------------------------------------------- */
@@ -2167,13 +2167,13 @@
  *
  * Recent Files
  * ------------
- * Key:        HKCU\Software\winvile\MRUFiles
+ * Key:        REGKEY_RECENT_FILES
  * Value Name: Hex(0 to (MAX_RECENT_FILES - 1))
  * Value Data: nul-terminated file path
  *
  * Recent Folders
  * --------------
- * Key:        HKCU\Software\winvile\MRUFolders
+ * Key:        REGKEY_RECENT_FLDRS
  * Value Name: Hex(0 to (MAX_RECENT_FLDRS - 1))
  * Value Data: nul-terminated directory path
  *
Index: w32ole.cpp
Prereq:  1.23 
--- vile-9.5e+/w32ole.cpp	2005-12-20 22:18:06.000000000 +0000
+++ vile-9.5f/w32ole.cpp	2006-01-15 18:16:12.000000000 +0000
@@ -17,7 +17,7 @@
  *   "FAILED" may not be used to test an OLE return code.  Use SUCCEEDED
  *   instead.
  *
- * $Header: /usr/build/vile/vile/RCS/w32ole.cpp,v 1.23 2005/12/20 22:18:06 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/w32ole.cpp,v 1.25 2006/01/15 18:16:12 tom Exp $
  */
 
 #include "w32vile.h"
@@ -39,12 +39,18 @@
 
 #include <initguid.h>
 
-#if __MSC_VER == 1200		/* Visual C++ 6.0 */
-#define VC6_ADDIN 1
+#if (_MSC_VER >= 1200) && (_MSC_VER < 1300)
+#define VC6_ADDIN 1             /* Visual C++ 6.0 */
 #else
 #define VC6_ADDIN 0
 #endif
 
+#if (_MSC_VER >= 1300) && (_MSC_VER < 1400)
+#define VC7_ADDIN 1             /* Visual C++ 7.0 */
+#else
+#define VC7_ADDIN 0
+#endif
+
 #if VC6_ADDIN
 #include <objmodel/appguid.h>
 #include <objmodel/textguid.h>
@@ -52,6 +58,10 @@
 #include <objmodel/textauto.h>
 #endif
 
+#if VC7_ADDIN
+#include <objbase.h>
+#endif
+
 static size_t   ansibuf_len,   /* scaled in bytes   */
                 olebuf_len;    /* scaled in wchar_t */
 static char     *ansibuf;
Index: x11.c
Prereq:  1.281 
--- vile-9.5e+/x11.c	2005-11-23 13:30:33.000000000 +0000
+++ vile-9.5f/x11.c	2006-01-13 01:31:23.000000000 +0000
@@ -2,7 +2,7 @@
  *	X11 support, Dave Lemke, 11/91
  *	X Toolkit support, Kevin Buettner, 2/94
  *
- * $Header: /usr/build/vile/vile/RCS/x11.c,v 1.281 2005/11/23 13:30:33 tom Exp $
+ * $Header: /usr/build/vile/vile/RCS/x11.c,v 1.285 2006/01/13 01:31:23 tom Exp $
  *
  */
 
@@ -455,39 +455,21 @@
 static struct eventqueue *evqhead = NULL;
 static struct eventqueue *evqtail = NULL;
 
-static int x_getc(void);
-
-static void x_open(void);
-static void x_close(void);
 static void x_flush(void);
 static void x_beep(void);
-static void x_rev(UINT state);
 
 #if OPT_COLOR
-static void x_fcol(int color);
-static void x_bcol(int color);
-static void x_ccol(int color);
+static void x_ccol(int);
 #else
 #define	x_fcol	nullterm_setfore
 #define	x_bcol	nullterm_setback
 #define	x_ccol	nullterm_setccol
 #endif
 
-static void x_setpal(const char *s);
-static void x_scroll(int from, int to, int count);
-
-static int x_watchfd(int fd, WATCHTYPE type, long *idp);
-static void x_unwatchfd(int fd, long id);
-
 static int set_character_class(char *s);
 static void x_touch(TextWindow tw, int sc, int sr, UINT ec, UINT er);
-static void x_paste_selection(Atom selection);
 static void x_own_selection(Atom selection);
 static Boolean x_get_selected_text(UCHAR ** datp, size_t *lenp);
-static Boolean x_get_clipboard_text(UCHAR ** datp, size_t *lenp);
-static Boolean x_convert_selection(Widget w, Atom * selection, Atom * target,
-				   Atom * type, XtPointer *value, ULONG * length,
-				   int *format);
 static void extend_selection(TextWindow tw, int nr, int nc, Bool wipe);
 static void x_process_event(Widget w, XtPointer unused, XEvent * ev,
 			    Boolean * continue_to_dispatch);
@@ -523,8 +505,6 @@
 static void check_visuals(void);
 #endif
 #if MOTIF_WIDGETS
-static void grip_moved(Widget w, XtPointer unused, XEvent * ev,
-		       Boolean * continue_to_dispatch);
 static void pane_button(Widget w, XtPointer unused, XEvent * ev,
 			Boolean * continue_to_dispatch);
 #endif /* MOTIF_WIDGETS */
@@ -544,53 +524,10 @@
 #else
 #define x_has_events() (XtAppPending(cur_win->app_context) & XtIMXEvent)
 #endif /* OPT_WORKING */
-static int evqempty(void);
 static void evqadd(const XEvent * evp);
 
 #define	FONTNAME	"7x13"
 
-TERM term =
-{
-    0,				/* these four values are set dynamically at
-				 * open time */
-    0,
-    0,
-    0,
-    0,
-    x_open,
-    x_close,
-    nullterm_kopen,
-    nullterm_kclose,
-    x_getc,
-    psc_putchar,
-    tttypahead,
-    psc_flush,
-    psc_move,
-    psc_eeol,
-    psc_eeop,
-    x_beep,
-    x_rev,
-    nullterm_setdescrip,
-    x_fcol,
-    x_bcol,
-    x_setpal,
-    x_ccol,
-    x_scroll,
-    x_flush,
-    nullterm_icursor,
-#if OPT_TITLE
-    x_set_window_name,
-#else
-    nullterm_settitle,
-#endif
-    x_watchfd,
-    x_unwatchfd,
-    nullterm_cursorvis,
-    nullterm_mopen,
-    nullterm_mclose,
-    nullterm_mevent,
-};
-
 #define	x_width(tw)		((tw)->cols * (tw)->char_width)
 #define	x_height(tw)		((tw)->rows * (tw)->char_height)
 #define	x_pos(tw, c)		((c) * (tw)->char_width)
@@ -6190,7 +6127,7 @@
  * milli - milliseconds to wait for type-ahead
  */
 int
-x_typahead(int milli)
+x_milli_sleep(int milli)
 {
     int status;
     XtIntervalId timeoutid = 0;
@@ -6251,6 +6188,12 @@
     return status;
 }
 
+static int
+x_typeahead(void)
+{
+    return x_milli_sleep(0);
+}
+
 /*ARGSUSED*/
 static void
 x_typahead_timeout(XtPointer flagp, XtIntervalId * id GCC_UNUSED)
@@ -6876,4 +6819,49 @@
 
 #endif /* OPT_LOCALE */
 
+TERM term =
+{
+    0,				/* these four values are set dynamically at
+				 * open time */
+    0,
+    0,
+    0,
+    0,
+    x_open,
+    x_close,
+    nullterm_kopen,
+    nullterm_kclose,
+    nullterm_clean,
+    nullterm_unclean,
+    nullterm_openup,
+    x_getc,
+    psc_putchar,
+    x_typeahead,
+    psc_flush,
+    psc_move,
+    psc_eeol,
+    psc_eeop,
+    x_beep,
+    x_rev,
+    nullterm_setdescrip,
+    x_fcol,
+    x_bcol,
+    x_setpal,
+    x_ccol,
+    x_scroll,
+    x_flush,
+    nullterm_icursor,
+#if OPT_TITLE
+    x_set_window_name,
+#else
+    nullterm_settitle,
+#endif
+    x_watchfd,
+    x_unwatchfd,
+    nullterm_cursorvis,
+    nullterm_mopen,
+    nullterm_mclose,
+    nullterm_mevent,
+};
+
 #endif /* DISP_X11 && XTOOLKIT */