changeset 146:2af401a6ecca r20-2p1

Import from CVS: tag r20-2p1
author cvs
date Mon, 13 Aug 2007 09:34:46 +0200
parents e13feca31ba6
children e186c2b7192d
files CHANGES-beta ChangeLog etc/NEWS lib-src/b2m.c lib-src/rcs-checkin lisp/ChangeLog lisp/efs/Makefile lisp/prim/auto-autoloads.el lisp/tm/tm-vm.el lisp/version.el lisp/vm/vm-autoload.el lisp/vm/vm-digest.el lisp/vm/vm-mime.el lisp/vm/vm-misc.el lisp/vm/vm-startup.el lisp/vm/vm-summary.el lisp/vm/vm-toolbar.el lisp/vm/vm-version.el man/tm/tm-vm-en.texi src/ChangeLog src/buffer.c src/frame.c
diffstat 22 files changed, 415 insertions(+), 199 deletions(-) [+]
line wrap: on
line diff
--- a/CHANGES-beta	Mon Aug 13 09:34:16 2007 +0200
+++ b/CHANGES-beta	Mon Aug 13 09:34:46 2007 +0200
@@ -1,4 +1,9 @@
 							-*- indented-text -*-
+to 20.2
+-- tm-vm-8.12 + manual
+-- VM-6.31
+-- b2m.c/rcs-checking synch with Emacs/Mule zeta.
+
 to 20.2 beta6
 -- ediff-2.65 Courtesy of Michael Kifer
 -- Gnus-5.4.52
--- a/ChangeLog	Mon Aug 13 09:34:16 2007 +0200
+++ b/ChangeLog	Mon Aug 13 09:34:46 2007 +0200
@@ -1,3 +1,7 @@
+Tue May 13 20:35:52 1997  Steven L Baur  <steve@altair.xemacs.org>
+
+	* XEmacs-20.2 is released.
+
 Sat May 10 16:14:30 1997  Steven L Baur  <steve@altair.xemacs.org>
 
 	* XEmacs 20.2-b6 is released.
--- a/etc/NEWS	Mon Aug 13 09:34:16 2007 +0200
+++ b/etc/NEWS	Mon Aug 13 09:34:46 2007 +0200
@@ -112,11 +112,6 @@
 * Changes in XEmacs 20.2
 ========================
 
-** configure no longer defaults to using --with-xim=motif if Motif libraries
-are linked.
-
-There are many bugs in the Xlib XIM support in X11R6.3.
-
 ** Why XEmacs 20.1 is called 20.2
 
 Testing of XEmacs 20.1 revealed a number of showstopping bugs at the
@@ -142,6 +137,11 @@
 
 ** Default modeline colors are now less of a color-salad.
 
+** The `C-z' key now iconifies only the current X frame.  You can use
+`C-x C-z' to get the old behavior.
+
+On the tty frames `C-z' behaves as before.
+
 ** The command `display-time' now draws a pretty image in the modeline
 when new mail arrives.  It also supports balloon-help messages.
 
@@ -149,12 +149,6 @@
 eval-expression (`M-:') and upcase-region (`C-x C-u')/downcase-region
 (`C-x C-l').
 
-** Numerous causes of crashes have been fixed.  XEmacs should now be
-even more stable than before.
-
-** The XEmacs build process has been changed to make site
-administration easier.  See lisp/site-load.el for details.
-
 ** It is now possible to customize the functions called by XEmacs toolbar.
 
 Type `M-x customize RET toolbar RET' to customize it.  Customizations
@@ -182,6 +176,17 @@
 
 ** The blinking cursor is always "on" during movement.
 
+** The XEmacs build process has been changed to make site
+administration easier.  See lisp/site-load.el for details.
+
+** Numerous causes of crashes have been fixed.  XEmacs should now be
+even more stable than before.
+
+** configure no longer defaults to using --with-xim=motif if Motif libraries
+are linked.
+
+There are many bugs in the Xlib XIM support in X11R6.3.
+
 ** A number of new packages are added, and many packages were
 updated.
 
@@ -318,7 +323,7 @@
 ** AUCTeX-9.7k, courtesy of Per Abrahamsen
 
 AUC TeX is a comprehensive customizable integrated environment for
-writing input files for LaTeX using GNU Emacs.
+writing input files for LaTeX using Emacs.
 
 AUC TeX lets you run TeX/LaTeX and other LaTeX-related tools, such as
 a output filters or post processor from inside Emacs.  Especially
@@ -421,24 +426,6 @@
 * Lisp and internal changes in XEmacs 20.2
 ==========================================
 
-** lib-complete.el was MULE-ized.
-
-The commands `find-library', `find-library-other-window' and
-`find-library-other-frame' now take an optional coding system
-argument.
-
-** Experimental support for Lisp reader macros #-, #+.
-
-The Common Lisp reader macros for feature test are now supported.  This
-feature is present for evaluation purposes and is subject to change.
-
-** `values' now has a setf method
-
-** The `C-z' key now iconifies only the current X frame.  You can use
-`C-x C-z' to get the old behavior.
-
-On the tty frames `C-z' behaves as before.
-
 ** `defcustom' and `defgroup' can now be used to specify types and
 placement of the user-settable variables.
 
@@ -530,6 +517,19 @@
 Set this to variable to nil to avoid XEmacs usual lossage of zmacs
 region when moving up against a buffer boundary.
 
+** lib-complete.el was MULE-ized.
+
+The commands `find-library', `find-library-other-window' and
+`find-library-other-frame' now take an optional coding system
+argument.
+
+** Experimental support for Lisp reader macros #-, #+.
+
+The Common Lisp reader macros for feature test are now supported.  This
+feature is present for evaluation purposes and is subject to change.
+
+** `values' now has a setf method
+
 ** The `eval-after-load' and `eval-next-after-load' functions are
 now available.
 
--- a/lib-src/b2m.c	Mon Aug 13 09:34:16 2007 +0200
+++ b/lib-src/b2m.c	Mon Aug 13 09:34:46 2007 +0200
@@ -13,14 +13,11 @@
  *   Ed Wilkinson
  *   E.Wilkinson@massey.ac.nz
  *   Mon Nov 7 15:54:06 PDT 1988
- *
  */
 
-/* Synched up with: FSF 19.28. */
+/* Made conformant to the GNU coding standards January, 1995
+   by Francesco Potorti` <pot@cnuce.cnr.it>. */
 
-/* Serious bug: This program uses `gets', which is intrinsically
-   unreliable--long lines will cause crashes.
-   Someone should fix this program not to use `gets'.  */
 #include <stdio.h>
 #include <time.h>
 #include <sys/types.h>
@@ -28,111 +25,243 @@
 #include <fcntl.h>
 #endif
 
-#include <../src/config.h>
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+/* On some systems, Emacs defines static as nothing for the sake
+   of unexec.  We don't want that here since we don't use unexec. */
+#undef static
+#endif
+
+#undef TRUE
+#define TRUE	1
+#undef FALSE
+#define FALSE	0
+
+/* Exit codes for success and failure.  */
+#ifdef VMS
+#define	GOOD	1
+#define BAD	0
+#else
+#define	GOOD	0
+#define	BAD	1
+#endif
+
+#define streq(s,t)	(strcmp (s, t) == 0)
+#define strneq(s,t,n)	(strncmp (s, t, n) == 0)
 
-#if __STDC__ || defined(STDC_HEADERS)
-# include <stdlib.h>
-# include <string.h>
-#else /* ! (__STDC__ || defined(STDC_HEADERS)) */
-# ifdef USG
-#  include <string.h>
-# else
-#  include <strings.h>
-#  endif
+typedef int logical;
 
-/* BSD's strings.h does not declare the type of strtok.  */
-extern char *strtok ();
-#endif /* ! (__STDC__ || defined(STDC_HEADERS)) */
+/*
+ * A `struct linebuffer' is a structure which holds a line of text.
+ * `readline' reads a line from a stream into a linebuffer and works
+ * regardless of the length of the line.
+ */
+struct linebuffer
+{
+  long size;
+  char *buffer;
+};
+
+extern char *strtok();
+
+long *xmalloc (), *xrealloc ();
+char *concat ();
+long readline ();
+void fatal ();
+
+/*
+ * xnew -- allocate storage.  SYNOPSIS: Type *xnew (int n, Type);
+ */
+#define xnew(n, Type)	((Type *) xmalloc ((n) * sizeof (Type)))
 
 
-#ifndef TRUE
-#define TRUE  (1)
-#endif
-#ifndef FALSE
-#define FALSE (0)
-#endif
+
+char *progname;
 
-int header = FALSE, printing;
-time_t ltoday;
-char from[256], labels[256], data[256], *p, *today;
+main (argc, argv)
+     int argc;
+     char **argv;
+{
+  logical labels_saved, printing, header;
+  time_t ltoday;
+  char *labels, *p, *today;
+  struct linebuffer data;
 
-void
-main (int argc, char **argv)
-{
 #ifdef MSDOS
   _fmode = O_BINARY;		/* all of files are treated as binary files */
+#if __DJGPP__ > 1
+  if (!isatty (fileno (stdout)))
+    setmode (fileno (stdout), O_BINARY);
+  if (!isatty (fileno (stdin)))
+    setmode (fileno (stdin), O_BINARY);
+#else /* not __DJGPP__ > 1 */
   (stdout)->_flag &= ~_IOTEXT;
   (stdin)->_flag &= ~_IOTEXT;
+#endif /* not __DJGPP__ > 1 */
 #endif
-  if ((argc >= 2) && strcmp (argv[1], "--help") == 0)
+  progname = argv[0];
+
+  if (argc != 1)
     {
-      fprintf (stderr, "%s - a filter for Babyl -> Unix mail files\n", argv[0]);
-      fprintf (stderr, "Usage: %s < babylmailbox > unixmailbox\n", argv[0]);
-      exit (0);
+      fprintf (stderr, "Usage: %s <babylmailbox >unixmailbox\n", progname);
+      exit (GOOD);
     }
-
+  labels_saved = printing = header = FALSE;
   ltoday = time (0);
   today = ctime (&ltoday);
+  data.size = 200;
+  data.buffer = xnew (200, char);
 
-  /* BUG!  Must not use gets in a reliable program!  */
-  if (gets (data))
+  if (readline (&data, stdin) == 0
+      || !strneq (data.buffer, "BABYL OPTIONS:", 14))
+    fatal ("standard input is not a Babyl mailfile.");
+
+  while (readline (&data, stdin) > 0)
     {
-      if (strncmp (data, "BABYL OPTIONS:", 14))
-	{
-	  fprintf (stderr, "%s: not a Babyl mailfile!\n", argv[0]);
-	  exit (-1);
-	}
-      else
-	printing = FALSE;
-    }
-  else
-    exit (-1);
-  if (printing)
-    puts (data);
-
-  while (gets (data))
-    {
-
-#if 0
-      /* What was this for?  Does somebody have something against blank
-	 lines?  */
-      if (!strcmp (data, ""))
-	exit (0);
-#endif
-
-      if (!strcmp (data, "*** EOOH ***") && !printing)
+      if (streq (data.buffer, "*** EOOH ***") && !printing)
 	{
 	  printing = header = TRUE;
-	  printf ("From %s %s", argv[0], today);
+	  printf ("From \"Babyl to mail by %s\" %s", progname, today);
 	  continue;
 	}
 
-      if (!strcmp (data, "\037\f"))
+      if (data.buffer[0] == '\037')
 	{
-	  /* save labels */
-	  gets (data);
-	  p = strtok (data, " ,\r\n\t");
-	  strcpy (labels, "X-Babyl-Labels: ");
+	  if (data.buffer[1] == '\0')
+	    continue;
+	  else if (data.buffer[1] == '\f')
+	    {
+	      /* Save labels. */
+	      readline (&data, stdin);
+	      p = strtok (data.buffer, " ,\r\n\t");
+	      labels = "X-Babyl-Labels: ";
+
+	      while (p = strtok (NULL, " ,\r\n\t"))
+		labels = concat (labels, p, ", ");
 
-	  while ((p = strtok (NULL, " ,\r\n\t")))
-	    {
-	      strcat (labels, p);
-	      strcat (labels, ", ");
+	      p = &labels[strlen (labels) - 2];
+	      if (*p == ',')
+		*p = '\0';
+	      printing = header = FALSE;
+	      labels_saved = TRUE;
+	      continue;
 	    }
+	}
 
-	  labels[strlen (labels) - 2] = '\0';
-	  printing = header = FALSE;
-	  continue;
+      if ((data.buffer[0] == '\0') && header)
+	{
+	  header = FALSE;
+	  if (labels_saved)
+	    puts (labels);
 	}
 
-      if (!strlen (data) && header)
-	{
-	  header = FALSE;
-	  if (strcmp (labels, "X-Babyl-Labels"))
-	    puts (labels);
-	}
-    
       if (printing)
-	puts (data);
+	puts (data.buffer);
     }
 }
+
+
+
+/*
+ * Return a newly-allocated string whose contents
+ * concatenate those of s1, s2, s3.
+ */
+char *
+concat (s1, s2, s3)
+     char *s1, *s2, *s3;
+{
+  int len1 = strlen (s1), len2 = strlen (s2), len3 = strlen (s3);
+  char *result = xnew (len1 + len2 + len3 + 1, char);
+
+  strcpy (result, s1);
+  strcpy (result + len1, s2);
+  strcpy (result + len1 + len2, s3);
+  result[len1 + len2 + len3] = '\0';
+
+  return result;
+}
+
+/*
+ * Read a line of text from `stream' into `linebuffer'.
+ * Return the number of characters read from `stream',
+ * which is the length of the line including the newline, if any.
+ */
+long
+readline (linebuffer, stream)
+     struct linebuffer *linebuffer;
+     register FILE *stream;
+{
+  char *buffer = linebuffer->buffer;
+  register char *p = linebuffer->buffer;
+  register char *pend;
+  int chars_deleted;
+
+  pend = p + linebuffer->size;	/* Separate to avoid 386/IX compiler bug.  */
+
+  while (1)
+    {
+      register int c = getc (stream);
+      if (p == pend)
+	{
+	  linebuffer->size *= 2;
+	  buffer = (char *) xrealloc (buffer, linebuffer->size);
+	  p += buffer - linebuffer->buffer;
+	  pend = buffer + linebuffer->size;
+	  linebuffer->buffer = buffer;
+	}
+      if (c == EOF)
+	{
+	  chars_deleted = 0;
+	  break;
+	}
+      if (c == '\n')
+	{
+	  if (p[-1] == '\r' && p > buffer)
+	    {
+	      *--p = '\0';
+	      chars_deleted = 2;
+	    }
+	  else
+	    {
+	      *p = '\0';
+	      chars_deleted = 1;
+	    }
+	  break;
+	}
+      *p++ = c;
+    }
+
+  return (p - buffer + chars_deleted);
+}
+
+/*
+ * Like malloc but get fatal error if memory is exhausted.
+ */
+long *
+xmalloc (size)
+     unsigned int size;
+{
+  long *result = (long *) malloc (size);
+  if (result == NULL)
+    fatal ("virtual memory exhausted");
+  return result;
+}
+
+long *
+xrealloc (ptr, size)
+     char *ptr;
+     unsigned int size;
+{
+  long *result = (long *) realloc (ptr, size);
+  if (result == NULL)
+    fatal ("virtual memory exhausted");
+  return result;
+}
+
+void
+fatal (message)
+{
+  fprintf (stderr, "%s: %s\n", progname, message);
+  exit (BAD);
+}
+
--- a/lib-src/rcs-checkin	Mon Aug 13 09:34:16 2007 +0200
+++ b/lib-src/rcs-checkin	Mon Aug 13 09:34:46 2007 +0200
@@ -1,4 +1,4 @@
-#!/bin/sh
+#! /bin/sh
 
 # This script accepts any number of file arguments and checks them into RCS.
 #
@@ -44,7 +44,7 @@
 	test -f "$file" || continue
 
 	# Check that file is readable.
-	<$file || exit
+	test -r "$file" || exit
 
 	# If the RCS file does not already exist,
 	# initialize it with a description from $file's first line.
--- a/lisp/ChangeLog	Mon Aug 13 09:34:16 2007 +0200
+++ b/lisp/ChangeLog	Mon Aug 13 09:34:46 2007 +0200
@@ -1,3 +1,8 @@
+Mon May 12 13:47:37 1997  Oscar Figueiredo  <Oscar.Figueiredo@di.epfl.ch>
+
+	* tm/tm-vm.el: Provide for vm-unsaved-message having been removed
+	in recent versions of VM.
+	
 Fri May  9 10:41:44 1997  Steven L Baur  <steve@altair.xemacs.org>
 
 	* iso/iso-acc.el (iso-accents-compose): Fix XEmacs 19.14
--- a/lisp/efs/Makefile	Mon Aug 13 09:34:16 2007 +0200
+++ b/lisp/efs/Makefile	Mon Aug 13 09:34:46 2007 +0200
@@ -2,7 +2,7 @@
 #
 # File:         Makefile
 # Release:      $efs release: 1.15 $
-# Version:      $Revision: 1.6 $
+# Version:      $Revision: 1.7 $
 # RCS:
 # Description:  Makefile for byte-compiling efs and dired.
 # Author:       Andy Norman, HPLabs, Bristol, UK.
@@ -89,7 +89,8 @@
 
 COREOBJS = efs-defun.elc efs-ovwrt.elc efs-fnh.elc efs-cu.elc efs-netrc.elc \
            efs.elc efs-dired.elc efs-report.elc \
-           efs-cp-p.elc
+           efs-cp-p.elc \
+	   efs-dump.elc
 CORESRC = efs-defun.el efs-ovwrt.el efs-fnh.el efs-cu.el efs-netrc.el \
           efs.el efs-dired.el efs-report.el \
           efs-cp-p.el \
--- a/lisp/prim/auto-autoloads.el	Mon Aug 13 09:34:16 2007 +0200
+++ b/lisp/prim/auto-autoloads.el	Mon Aug 13 09:34:46 2007 +0200
@@ -977,7 +977,7 @@
 
 (autoload 'run-ediff-from-cvs-buffer "ediff" "\
 Run Ediff-merge on appropriate revisions of the selected file.
-First run after `M-x cvs-update'. Then place the cursor on a lide describing a
+First run after `M-x cvs-update'. Then place the cursor on a line describing a
 file and then run `run-ediff-from-cvs-buffer'." t nil)
 
 (autoload 'ediff-patch-file "ediff" "\
@@ -3631,7 +3631,7 @@
 ;;;### (autoloads (ksh-mode) "ksh-mode" "modes/ksh-mode.el")
 
 (autoload 'ksh-mode "ksh-mode" "\
-ksh-mode $Revision: 1.26 $ - Major mode for editing (Bourne, Korn or Bourne again)
+ksh-mode $Revision: 1.27 $ - Major mode for editing (Bourne, Korn or Bourne again)
 shell scripts.
 Special key bindings and commands:
 \\{ksh-mode-map}
@@ -4991,7 +4991,7 @@
 
 (autoload 'vhdl-mode "vhdl-mode" "\
 Major mode for editing VHDL code.
-vhdl-mode $Revision: 1.26 $
+vhdl-mode $Revision: 1.27 $
 To submit a problem report, enter `\\[vhdl-submit-bug-report]' from a
 vhdl-mode buffer.  This automatically sets up a mail buffer with version
 information already added.  You just need to add a description of the
--- a/lisp/tm/tm-vm.el	Mon Aug 13 09:34:16 2007 +0200
+++ b/lisp/tm/tm-vm.el	Mon Aug 13 09:34:46 2007 +0200
@@ -9,7 +9,7 @@
 ;;         Oscar Figueiredo <Oscar.Figueiredo@di.epfl.ch>
 ;; Maintainer: Oscar Figueiredo <Oscar.Figueiredo@di.epfl.ch>
 ;; Created: 1994/10/29
-;; Version: $Revision: 1.5 $
+;; Version: $Revision: 1.6 $
 ;; Keywords: mail, MIME, multimedia, multilingual, encoded-word
 
 ;; This file is part of tm (Tools for MIME).
@@ -103,7 +103,7 @@
 ;;; @@ System/Information variables
 
 (defconst tm-vm/RCS-ID
-  "$Id: tm-vm.el,v 1.5 1997/05/09 03:28:15 steve Exp $")
+  "$Id: tm-vm.el,v 1.6 1997/05/14 02:01:47 steve Exp $")
 (defconst tm-vm/version (get-version-string tm-vm/RCS-ID))
 
 ; Ensure vm-menu-mail-menu gets properly defined *before* tm-vm/vm-emulation-map
@@ -1169,7 +1169,8 @@
 
 ;;; @@@ multipart/digest
 
-(fset 'vm-unsaved-message 'message)
+(if (not (fboundp 'vm-unsaved-message))
+    (fset 'vm-unsaved-message 'message))
 
 (defun tm-vm/enclose-messages (mlist &optional preamble)
   "Enclose the messages in MLIST as multipart/digest.
--- a/lisp/version.el	Mon Aug 13 09:34:16 2007 +0200
+++ b/lisp/version.el	Mon Aug 13 09:34:46 2007 +0200
@@ -25,7 +25,7 @@
 (defconst emacs-version "20.2"
   "Version numbers of this version of Emacs.")
 
-(setq emacs-version (purecopy (concat emacs-version " XEmacs Lucid (beta6)")))
+(setq emacs-version (purecopy (concat emacs-version " XEmacs Lucid")))
 
 (defconst emacs-major-version
   (progn (or (string-match "^[0-9]+" emacs-version)
--- a/lisp/vm/vm-autoload.el	Mon Aug 13 09:34:16 2007 +0200
+++ b/lisp/vm/vm-autoload.el	Mon Aug 13 09:34:46 2007 +0200
@@ -85,8 +85,10 @@
 
 (autoload (quote vm-mime-burst-message) "vm-digest" "Burst messages from the digest message M.
 M should be a message struct for a real message.
-MIME encoding is expected.  The message content type
-must be either message/* or multipart/digest." nil nil)
+MIME encoding is expected.  Somewhere within the MIME layout
+there must be at least one part of type message/news, message/rfc822 or
+multipart/digest.  If there are multiple parts matching those types,
+all of them will be burst." nil nil)
 
 (autoload (quote vm-mime-burst-layout) "vm-digest" nil nil nil)
 
@@ -1149,10 +1151,14 @@
 
 (autoload (quote vm-mm-layout-cache) "vm-mime" nil nil nil)
 
+(autoload (quote vm-mm-layout-display-error) "vm-mime" nil nil nil)
+
 (autoload (quote vm-set-mm-layout-type) "vm-mime" nil nil nil)
 
 (autoload (quote vm-set-mm-layout-cache) "vm-mime" nil nil nil)
 
+(autoload (quote vm-set-mm-layout-display-error) "vm-mime" nil nil nil)
+
 (autoload (quote vm-mm-layout) "vm-mime" nil nil nil)
 
 (autoload (quote vm-mm-encoded-header) "vm-mime" nil nil nil)
@@ -1333,6 +1339,8 @@
 
 (autoload (quote vm-mime-layout-contains-type) "vm-mime" nil nil nil)
 
+(autoload (quote vm-mime-find-digests-in-layout) "vm-mime" nil nil nil)
+
 (autoload (quote vm-mime-plain-message-p) "vm-mime" nil nil nil)
 
 (autoload (quote vm-mime-text-type-p) "vm-mime" nil nil nil)
@@ -2209,7 +2217,7 @@
 
 (autoload (quote vm-mode) "vm-startup" "Major mode for reading mail.
 
-This is VM 6.30.
+This is VM 6.31.
 
 Commands:
    h - summarize folder contents
--- a/lisp/vm/vm-digest.el	Mon Aug 13 09:34:16 2007 +0200
+++ b/lisp/vm/vm-digest.el	Mon Aug 13 09:34:46 2007 +0200
@@ -132,13 +132,20 @@
 (defun vm-mime-burst-message (m)
   "Burst messages from the digest message M.
 M should be a message struct for a real message.
-MIME encoding is expected.  The message content type
-must be either message/* or multipart/digest."
+MIME encoding is expected.  Somewhere within the MIME layout
+there must be at least one part of type message/news, message/rfc822 or
+multipart/digest.  If there are multiple parts matching those types,
+all of them will be burst."
   (let ((ident-header nil)
-	(layout (vm-mm-layout m)))
+	(did-burst nil)
+	(list (vm-mime-find-digests-in-layout (vm-mm-layout m))))
     (if vm-digest-identifier-header-format
 	(setq ident-header (vm-sprintf 'vm-digest-identifier-header-format m)))
-    (vm-mime-burst-layout layout ident-header)))
+    (while list
+      (setq did-burst (or did-burst
+			  (vm-mime-burst-layout (car list) ident-header)))
+      (setq list (cdr list)))
+    did-burst))
 
 (defun vm-mime-burst-layout (layout ident-header)
   (let ((work-buffer nil)
@@ -608,12 +615,15 @@
       (set-buffer (vm-buffer-of m))
       (let ((layout (vm-mm-layout m)))
 	(if (and (vectorp layout)
-		 (or (vm-mime-types-match "multipart/digest"
-					  (car (vm-mm-layout-type layout)))
-		     (vm-mime-types-match "message/rfc822"
-					  (car (vm-mm-layout-type layout)))
-		     (vm-mime-types-match "message/news"
-					  (car (vm-mm-layout-type layout)))))
+		 (or (vm-mime-layout-contains-type
+		      layout
+		      "multipart/digest")
+		     (vm-mime-layout-contains-type
+		      layout
+		      "message/rfc822")
+		     (vm-mime-layout-contains-type
+		      layout
+		      "message/news")))
 	    (throw 'return-value "mime"))))
     (save-excursion
       (save-restriction
--- a/lisp/vm/vm-mime.el	Mon Aug 13 09:34:16 2007 +0200
+++ b/lisp/vm/vm-mime.el	Mon Aug 13 09:34:46 2007 +0200
@@ -37,11 +37,13 @@
 (defun vm-mm-layout-body-start (e) (aref e 8))
 (defun vm-mm-layout-body-end (e) (aref e 9))
 (defun vm-mm-layout-parts (e) (aref e 10))
+(defun vm-mm-layout-cache (e) (aref e 11))
 ;; if display of MIME part fails, error string will be here.
-(defun vm-mm-layout-cache (e) (aref e 11))
+(defun vm-mm-layout-display-error (e) (aref e 12))
 
 (defun vm-set-mm-layout-type (e type) (aset e 0 type))
 (defun vm-set-mm-layout-cache (e c) (aset e 11 c))
+(defun vm-set-mm-layout-display-error (e c) (aset e 12 c))
 
 (defun vm-mm-layout (m)
   (or (vm-mime-layout-of m)
@@ -624,7 +626,7 @@
 				  (vm-headers-of m)
 				  (vm-text-of m)
 				  (vm-text-end-of m)
-				  nil nil )))
+				  nil nil nil )))
 		  ((null type)
 		   (goto-char (point-min))
 		   (or (re-search-forward "^\n\\|\n\\'" nil t)
@@ -635,7 +637,7 @@
 			   (vm-marker (point-min))
 			   (vm-marker (point))
 			   (vm-marker (point-max))
-			   nil nil ))
+			   nil nil nil ))
 		  ((null (string-match "[^/ ]+/[^/ ]+" (car type)))
 		   (vm-mime-error "Malformed MIME content type: %s" (car type)))
 		  ((and (string-match "^multipart/\\|^message/" (car type))
@@ -668,7 +670,7 @@
 				     (narrow-to-region (point) (point-max))
 				     (vm-mime-parse-entity-safe nil c-t
 								c-t-e)))
-				  nil )))
+				  nil nil )))
 		  (t
 		   (goto-char (point-min))
 		   (or (re-search-forward "^\n\\|\n\\'" nil t)
@@ -679,7 +681,7 @@
 				  (vm-marker (point-min))
 				  (vm-marker (point))
 				  (vm-marker (point-max))
-				  nil nil ))))
+				  nil nil nil ))))
 	    (setq p (cdr type)
 		  boundary nil)
 	    (while p
@@ -726,7 +728,7 @@
 		    (vm-marker (point))
 		    (vm-marker (point-max))
 		    (nreverse multipart-list)
-		    nil )))))))
+		    nil nil )))))))
 
 (defun vm-mime-parse-entity-safe (&optional m c-t c-t-e)
   (or c-t (setq c-t '("text/plain" "charset=us-ascii")))
@@ -758,7 +760,7 @@
 	     header
 	     text
 	     text-end
-	     nil nil)))))
+	     nil nil nil)))))
 
 (defun vm-mime-get-xxx-parameter (layout name param-list)
   (let ((match-end (1+ (length name)))
@@ -1051,7 +1053,8 @@
 	      (vm-marker (point))
 	      (vm-marker (point-max))
 	      nil
-	      nil ))))
+	      nil
+	      nil))))
 
 (defun vm-mime-should-display-button (layout dont-honor-content-disposition)
   (if (and vm-honor-mime-content-disposition
@@ -1253,7 +1256,7 @@
 		      (vm-mime-display-internal-text/plain layout)))
 		(t (and extent (vm-mime-rewrite-failed-button
 				extent
-				(or (vm-mm-layout-cache layout)
+				(or (vm-mm-layout-display-error layout)
 				    "no external viewer defined for type")))
 		   (vm-mime-display-internal-application/octet-stream
 		    (or extent layout))))
@@ -1285,7 +1288,7 @@
 	  (and work-buffer (kill-buffer work-buffer)))
 	(message "Inlining text/html... done")
 	t )
-    (vm-set-mm-layout-cache layout "Need W3 to inline HTML")
+    (vm-set-mm-layout-display-error layout "Need W3 to inline HTML")
     nil ))
 
 (defun vm-mime-display-internal-text/plain (layout &optional no-highlighting)
@@ -1294,7 +1297,7 @@
 	(charset (or (vm-mime-get-parameter layout "charset") "us-ascii")))
     (if (not (vm-mime-charset-internally-displayable-p charset))
 	(progn
-	  (vm-set-mm-layout-cache
+	  (vm-set-mm-layout-display-error
 	   layout (concat "Undisplayable charset: " charset))
 	  nil)
       (vm-mime-insert-mime-body layout)
@@ -1353,6 +1356,11 @@
 		   (if (vm-mime-text-type-p layout)
 		       (set-buffer-file-coding-system 'no-conversion nil)
 		     (set-buffer-file-coding-system 'binary t)))
+               ;; Write an empty tempfile out to disk and set its
+               ;; permissions to 0600, then write the actual buffer
+               ;; contents to tempfile.
+               (write-region start start tempfile nil 0)
+               (set-file-modes tempfile 384)
 	       (write-region start end tempfile nil 0))
 	     (delete-region start end)
 	     (save-excursion
@@ -1535,9 +1543,14 @@
 
 (defun vm-mime-display-internal-message/rfc822 (layout)
   (if (vectorp layout)
-      (let ((start (point)))
-	(vm-mime-insert-mime-headers layout)
+      (let ((start (point))
+	    (buffer-read-only nil))
+	(vm-mime-insert-mime-headers (car (vm-mm-layout-parts layout)))
 	(insert ?\n)
+	(save-excursion
+	  (goto-char start)
+	  (vm-reorder-message-headers nil vm-visible-headers
+				      vm-invisible-header-regexp))
 	(save-restriction
 	  (narrow-to-region start (point))
 	  (vm-decode-mime-encoded-words))
@@ -1709,7 +1722,13 @@
 	  (setq end (point-marker))
 	  (vm-mime-transfer-decode-region layout start end)
 	  (setq tempfile (vm-make-tempfile-name))
-	  ;; coding system for presentation buffer is binary
+	  ;; Write an empty tempfile out to disk and set its
+	  ;; permissions to 0600, then write the actual buffer
+	  ;; contents to tempfile.
+	  (write-region start start tempfile nil 0)
+	  (set-file-modes tempfile 384)
+	  ;; coding system for presentation buffer is binary so
+	  ;; we don't need to set it here.
 	  (write-region start end tempfile nil 0)
 	  (message "Creating %s glyph..." name)
 	  (setq g (make-glyph
@@ -1761,7 +1780,13 @@
 	  (setq end (point-marker))
 	  (vm-mime-transfer-decode-region layout start end)
 	  (setq tempfile (vm-make-tempfile-name))
-	  ;; coding system for presentation buffer is binary
+	  ;; Write an empty tempfile out to disk and set its
+	  ;; permissions to 0600, then write the actual buffer
+	  ;; contents to tempfile.
+	  (write-region start start tempfile nil 0)
+	  (set-file-modes tempfile 384)
+	  ;; coding system for presentation buffer is binary, so
+	  ;; we don't need to set it here.
 	  (write-region start end tempfile nil 0)
 	  (vm-set-mm-layout-cache layout tempfile)
 	  (save-excursion
@@ -2082,6 +2107,24 @@
 	    (setq done t)
 	  (setq p (cdr p))))
       result )))
+
+;; breadth first traversal
+(defun vm-mime-find-digests-in-layout (layout)
+  (let ((layout-list (list layout))
+	layout-type
+	(result nil))
+    (while layout-list
+      (setq layout-type (car (vm-mm-layout-type (car layout-list))))
+      (cond ((string-match "^multipart/digest\\|message/\\(rfc822\\|news\\)"
+			   layout-type)
+	     (setq result (nconc result (list (car layout-list)))))
+	    ((vm-mime-composite-type-p layout-type)
+	     (setq layout-list (nconc layout-list
+				      (copy-sequence
+				       (vm-mm-layout-parts
+					(car layout-list)))))))
+      (setq layout-list (cdr layout-list)))
+    result ))
   
 (defun vm-mime-plain-message-p (m)
   (save-match-data
@@ -2843,7 +2886,7 @@
 		    ;; insert/delete trick needed to avoid
 		    ;; enriched-mode tags from seeping into the
 		    ;; attachment overlays.  I really wish
-		    ;; front-advance / rear-aadvance overlay
+		    ;; front-advance / rear-advance overlay
 		    ;; endpoint properties actually worked.
 		    (goto-char (point-max))
 		    (insert-before-markers "\n")
@@ -3159,6 +3202,7 @@
       (error "Command must be used in a VM Mail mode buffer."))
   (let ((temp-buffer nil)
 	(mail-buffer (current-buffer))
+	(enriched (and (boundp 'enriched-mode) enriched-mode))
 	e-list)
     (unwind-protect
 	(progn
@@ -3166,6 +3210,7 @@
 	  (set-buffer temp-buffer)
 	  ;; so vm-mime-xxxx-encode-composition won't complain
 	  (setq major-mode 'mail-mode)
+	  (set (make-local-variable 'enriched-mode) enriched)
 	  (vm-insert-region-from-buffer mail-buffer)
 	  (goto-char (point-min))
 	  (or (vm-mail-mode-get-header-contents "From")
--- a/lisp/vm/vm-misc.el	Mon Aug 13 09:34:16 2007 +0200
+++ b/lisp/vm/vm-misc.el	Mon Aug 13 09:34:46 2007 +0200
@@ -432,29 +432,31 @@
 ;; test for it without just running make-frame.  I'll just
 ;; let it not work for now... someone will complain eventually
 ;; and I'll think of something.
-(defun vm-multiple-frames-possible-p ()
-  (or (and (boundp 'window-system) (not (eq window-system nil)))
-      (and (fboundp 'device-type) (eq (device-type) 'x))))
 
-(defun vm-mouse-support-possible-p ()
-  (vm-multiple-frames-possible-p))
-
+(defun vm-multiple-frames-possible-p () 
+  (cond (vm-xemacs-p 
+         (eq (device-type) 'x)) 
+        (vm-fsfemacs-19-p 
+         (not (eq window-system nil))))) 
+ 
+(defun vm-mouse-support-possible-p () 
+  (vm-multiple-frames-possible-p)) 
+ 
 (defun vm-menu-support-possible-p ()
   (cond (vm-xemacs-p
 	 (featurep 'menubar))
 	(vm-fsfemacs-19-p
 	 (fboundp 'menu-bar-mode))
 	(t nil)))
-
+ 
 (defun vm-toolbar-support-possible-p ()
-  (and vm-xemacs-p
-       (vm-multiple-frames-possible-p)
-       (featurep 'toolbar)))
+  (and vm-xemacs-p (featurep 'toolbar)))
 
 (defun vm-multiple-fonts-possible-p ()
-  (or (eq window-system 'x)
-      (and (fboundp 'device-type)
-	   (eq (device-type) 'x))))
+  (cond (vm-xemacs-p
+	 (eq (device-type) 'x))
+	(vm-fsfemacs-19-p
+	 (eq window-system 'x))))
 
 (defun vm-run-message-hook (message &optional hook-variable)
   (save-excursion
--- a/lisp/vm/vm-startup.el	Mon Aug 13 09:34:16 2007 +0200
+++ b/lisp/vm/vm-startup.el	Mon Aug 13 09:34:46 2007 +0200
@@ -276,7 +276,7 @@
 (defun vm-mode (&optional read-only)
   "Major mode for reading mail.
 
-This is VM 6.30.
+This is VM 6.31.
 
 Commands:
    h - summarize folder contents
--- a/lisp/vm/vm-summary.el	Mon Aug 13 09:34:16 2007 +0200
+++ b/lisp/vm/vm-summary.el	Mon Aug 13 09:34:46 2007 +0200
@@ -32,8 +32,7 @@
 	truncate-lines t)
   ;; horizontal scrollbar off by default
   ;; user can turn it on in summary hook if desired.
-  (and (fboundp 'set-specifier)
-       scrollbar-height
+  (and vm-xemacs-p (featurep 'scrollbar)
        (set-specifier scrollbar-height (cons (current-buffer) 0)))
   (use-local-map vm-summary-mode-map)
   (and (vm-menu-support-possible-p)
--- a/lisp/vm/vm-toolbar.el	Mon Aug 13 09:34:16 2007 +0200
+++ b/lisp/vm/vm-toolbar.el	Mon Aug 13 09:34:46 2007 +0200
@@ -319,6 +319,9 @@
   (vm-toolbar-initialize)
   (let ((height (+ 4 (glyph-height (car vm-toolbar-help-icon))))
 	(width (+ 4 (glyph-width (car vm-toolbar-help-icon))))
+	(frame (selected-frame))
+	(buffer (current-buffer))
+	(tag-set '(win))
 	(myframe (vm-created-this-frame-p))
 	toolbar )
     ;; glyph-width and glyph-height return 0 at startup sometimes
@@ -336,31 +339,27 @@
     (cond ((eq vm-toolbar-orientation 'right)
 	   (setq vm-toolbar-specifier right-toolbar)
 	   (if myframe
-	       (set-specifier right-toolbar (cons (selected-frame) toolbar)))
-	   (set-specifier right-toolbar (cons (current-buffer) toolbar))
-	   (set-specifier right-toolbar-width
-			  (cons (selected-frame) width)))
+	       (set-specifier right-toolbar toolbar frame tag-set))
+	   (set-specifier right-toolbar toolbar buffer)
+	   (set-specifier right-toolbar-width width frame tag-set))
 	  ((eq vm-toolbar-orientation 'left)
 	   (setq vm-toolbar-specifier left-toolbar)
 	   (if myframe
-	       (set-specifier left-toolbar (cons (selected-frame) toolbar)))
-	   (set-specifier left-toolbar (cons (current-buffer) toolbar))
-	   (set-specifier left-toolbar-width
-			  (cons (selected-frame) width)))
+	       (set-specifier left-toolbar toolbar frame tag-set))
+	   (set-specifier left-toolbar toolbar buffer)
+	   (set-specifier left-toolbar-width width frame tag-set))
 	  ((eq vm-toolbar-orientation 'bottom)
 	   (setq vm-toolbar-specifier bottom-toolbar)
 	   (if myframe
-	       (set-specifier bottom-toolbar (cons (selected-frame) toolbar)))
-	   (set-specifier bottom-toolbar (cons (current-buffer) toolbar))
-	   (set-specifier bottom-toolbar-height
-			  (cons (selected-frame) height)))
+	       (set-specifier bottom-toolbar toolbar frame tag-set))
+	   (set-specifier bottom-toolbar toolbar buffer)
+	   (set-specifier bottom-toolbar-height height frame tag-set))
 	  (t
 	   (setq vm-toolbar-specifier top-toolbar)
 	   (if myframe
-	       (set-specifier top-toolbar (cons (selected-frame) toolbar)))
-	   (set-specifier top-toolbar (cons (current-buffer) toolbar))
-	   (set-specifier top-toolbar-height
-			  (cons (selected-frame) height))))))
+	       (set-specifier top-toolbar toolbar frame tag-set))
+	   (set-specifier top-toolbar toolbar buffer)
+	   (set-specifier top-toolbar-height height frame tag-set)))))
 
 (defun vm-toolbar-make-toolbar-spec ()
   (let ((button-alist '(
@@ -401,7 +400,8 @@
     (let ((tuples
 	   (if (featurep 'xpm)
 	       (list
-		(if (>= (device-bitplanes) 16)
+		(if (and (device-on-window-system-p)
+			 (>= (device-bitplanes) 16))
       '(vm-toolbar-decode-mime-icon "mime-colorful-up.xpm"
 				    "mime-colorful-dn.xpm"
 				    "mime-colorful-xx.xpm")
--- a/lisp/vm/vm-version.el	Mon Aug 13 09:34:16 2007 +0200
+++ b/lisp/vm/vm-version.el	Mon Aug 13 09:34:46 2007 +0200
@@ -2,7 +2,7 @@
 
 (provide 'vm-version)
 
-(defconst vm-version "6.30"
+(defconst vm-version "6.31"
   "Version number of VM.")
 
 (defun vm-version ()
--- a/man/tm/tm-vm-en.texi	Mon Aug 13 09:34:16 2007 +0200
+++ b/man/tm/tm-vm-en.texi	Mon Aug 13 09:34:46 2007 +0200
@@ -5,7 +5,7 @@
 @c %**end of header
 
 @ifinfo
-This file documents tm-vm.el v8.11
+This file documents tm-vm.el v8.12
 
 tm-vm is part of the TM Package.
 
@@ -26,7 +26,7 @@
 @titlepage
 @title tm-vm Manual (English Version)
 @author by Oscar Figueiredo
-@code{$Id: tm-vm-en.texi,v 1.4 1997/04/13 03:14:26 steve Exp $}
+@code{$Id: tm-vm-en.texi,v 1.5 1997/05/14 02:01:53 steve Exp $}
 @page
 
 tm-vm is part of the TM Package.
@@ -48,7 +48,7 @@
 you read and write multimedia mail on the Internet using the MIME
 standard.
 
-This document applies to release 8.11 of tm-vm.el
+This document applies to release 8.12 of tm-vm.el
 @end ifinfo
 
 @menu
@@ -362,7 +362,7 @@
 This section documents the user-visible changes in the latest releases
 of tm-vm. For more technical details see the ChangeLog.
 
-@section 8.5 to 8.11
+@section 8.5 to 8.12
 
 @itemize @bullet
 @item
@@ -467,7 +467,7 @@
 @ifinfo
 @chapter Copyright
 
-This file documents tm-vm 8.11, an interface between tm and the VM mail
+This file documents tm-vm 8.12, an interface between tm and the VM mail
 user agent.
 
 Copyright 1996 Tomohiko Morioka, Oscar Figueiredo
--- a/src/ChangeLog	Mon Aug 13 09:34:16 2007 +0200
+++ b/src/ChangeLog	Mon Aug 13 09:34:46 2007 +0200
@@ -1,3 +1,10 @@
+Sun May 11 23:36:08 1997  Steven L Baur  <steve@altair.xemacs.org>
+
+	* buffer.c: Rename Vdelete_auto_save_files to coding standards.
+
+	* frame.c: Rename Vallow_deletion_of_last_visible_frame to coding
+	standards.
+
 Thu May  8 19:10:03 1997  Steven L Baur  <steve@altair.xemacs.org>
 
 	* frame.c: Change internal type of
--- a/src/buffer.c	Mon Aug 13 09:34:16 2007 +0200
+++ b/src/buffer.c	Mon Aug 13 09:34:46 2007 +0200
@@ -166,7 +166,7 @@
 Lisp_Object Vkill_buffer_query_functions;
 
 /* Non-nil means delete a buffer's auto-save file when the buffer is saved. */
-int Vdelete_auto_save_files;
+int delete_auto_save_files;
 
 Lisp_Object Qbuffer_live_p;
 Lisp_Object Qbuffer_or_string_p;
@@ -1384,7 +1384,7 @@
 	&& b->auto_save_modified != 0
 	&& BUF_SAVE_MODIFF (b) < b->auto_save_modified)
       {
-	if (Vdelete_auto_save_files != 0)
+	if (delete_auto_save_files != 0)
 	  {
 	    /* deleting the auto save file might kill b! */
 	    /* #### dmoore - fix this crap, we do this same gcpro and
@@ -2088,10 +2088,10 @@
 */ );
   Vkill_buffer_query_functions = Qnil;
 
-  DEFVAR_BOOL ("delete-auto-save-files", &Vdelete_auto_save_files /*
+  DEFVAR_BOOL ("delete-auto-save-files", &delete_auto_save_files /*
 *Non-nil means delete auto-save file when a buffer is saved or killed.
 */ );
-  Vdelete_auto_save_files = 1;
+  delete_auto_save_files = 1;
 }
 
 /* DOC is ignored because it is snagged and recorded externally 
--- a/src/frame.c	Mon Aug 13 09:34:16 2007 +0200
+++ b/src/frame.c	Mon Aug 13 09:34:46 2007 +0200
@@ -53,7 +53,7 @@
 Lisp_Object Vmouse_leave_frame_hook, Qmouse_leave_frame_hook;
 Lisp_Object Vmap_frame_hook, Qmap_frame_hook;
 Lisp_Object Vunmap_frame_hook, Qunmap_frame_hook;
-int  Vallow_deletion_of_last_visible_frame;
+int  allow_deletion_of_last_visible_frame;
 #if defined (HAVE_CDE) || defined (HAVE_OFFIX_DND)
 Lisp_Object Vdrag_and_drop_functions, Qdrag_and_drop_functions;
 #endif
@@ -1256,7 +1256,7 @@
      deleting all frames which were either visible or iconified and thus
      losing any way of communicating with the still running XEmacs process.
      So we put it back.  */
-  if (!force && !Vallow_deletion_of_last_visible_frame &&
+  if (!force && !allow_deletion_of_last_visible_frame &&
       !other_visible_frames_internal (f, called_from_delete_device))
     error ("Attempt to delete the sole visible or iconified frame");
 
@@ -3008,10 +3008,10 @@
   Vunmap_frame_hook = Qnil;
 
   DEFVAR_BOOL ("allow-deletion-of-last-visible-frame",
-	       &Vallow_deletion_of_last_visible_frame /*
+	       &allow_deletion_of_last_visible_frame /*
 *Non-nil means to assume the force option to delete-frame.
 */ );
-  Vallow_deletion_of_last_visible_frame = 0;
+  allow_deletion_of_last_visible_frame = 0;
 
 #if defined (HAVE_CDE) || defined (HAVE_OFFIX_DND)
   DEFVAR_LISP ("drag-and-drop-functions", &Vdrag_and_drop_functions /*