Commits

Anonymous committed ab3bc64

Synch with VM-6.71

  • Participants
  • Parent commits f4d98aa

Comments (0)

Files changed (15)

+1999-05-13  SL Baur  <steve@gneiss.etl.go.jp>
+
+	* Makefile: Synch with VM-6.71.
+
 1998-09-22  SL Baur  <steve@altair.xemacs.org>
 
 	* Repackage and add vm.elc to installation.
 # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
 # Boston, MA 02111-1307, USA.
 
-VERSION = 1.19
-AUTHOR_VERSION = 6.67
+VERSION = 1.20
+AUTHOR_VERSION = 6.71
 MAINTAINER = XEmacs Development Team <xemacs-beta@xemacs.org>
 PACKAGE = vm
 PKG_TYPE = regular
 REQUIRES = mail-lib xemacs-base
 CATEGORY = comm
 
-ELCS = vm-message.elc vm-misc.elc tapestry.elc \
+# vm-version.elc needs to be first in this list, because load time
+# code needs the Emacs/XEmacs MULE/no-MULE feature stuff.
+ELCS = vm-version.elc vm-message.elc vm-misc.elc tapestry.elc \
 	vm-delete.elc vm-digest.elc vm-imap.elc \
 	vm-easymenu.elc vm-edit.elc vm-folder.elc vm-license.elc \
 	vm-loaddefs.elc vm-mark.elc vm-menu.elc vm-mime.elc vm-minibuf.elc \
 	vm-macro.elc vm-motion.elc vm-mouse.elc vm-page.elc vm-pop.elc \
 	vm-reply.elc vm-save.elc vm-search.elc vm-sort.elc vm-startup.elc \
 	vm-summary.elc vm-thread.elc vm-toolbar.elc vm-undo.elc vm-user.elc \
-	vm-vars.elc vm-version.elc vm-virtual.elc vm-window.elc
+	vm-vars.elc vm-virtual.elc vm-window.elc
 
 EXTRA_SOURCES = vm.elc vm-autoload.el vm-autoload.elc
 
-PRELOADS=-l ./vm-byteopts.el -l ./vm-message.el -l ./vm-macro.el \
-	-l ./vm-misc.el \
-	-l ./vm-vars.el -l ./vm-version.el
+PRELOADS =-l ./vm-byteopts.el -l ./vm-version.el -l ./vm-message.el \
+	-l ./vm-macro.el -l ./vm-misc.el -l ./vm-vars.el
 
 INFO_FILES = $(PACKAGE).info*
 TEXI_FILES = $(PACKAGE).texi
 
 vm.elc: $(ELCS)
 	@echo "building vm.elc (with all modules set to autoload)..."
-	@echo "(require 'vm-startup)" > vm.elc
+	@echo "(require 'vm-version)" > vm.elc
+	@echo "(require 'vm-startup)" >> vm.elc
 	@echo "(require 'vm-vars)" >> vm.elc
-	@echo "(require 'vm-version)" >> vm.elc
 	@echo "(require 'vm-autoload)" >> vm.elc
 
 vm-autoload.el: $(ELCS:.elc=.el)
 # have to preload the files that contain macro definitions or the
 # byte compiler will compile everything that references them
 # incorrectly.  also preload a file that sets byte compiler options.
-PRELOADS = -l $(BYTEOPTS) -l ./vm-message.el -l ./vm-macro.el -l ./vm-vars.el  -l ./vm-version.el
+PRELOADS = -l $(BYTEOPTS) -l ./vm-version.el -l ./vm-message.el -l ./vm-macro.el -l ./vm-vars.el  
 
 # compile with noninteractive and relatively clean environment
 BATCHFLAGS = -batch -q -no-site-file
 # certain compiler optimizations.
 CORE = vm-message.el vm-macro.el vm-byteopts.el
 
+# vm-version.elc needs to be first in this list, because load time
+# code needs the Emacs/XEmacs MULE/no-MULE feature stuff.
 OBJECTS = \
+    vm-version.elc \
     vm-delete.elc vm-digest.elc vm-easymenu.elc vm-edit.elc vm-folder.elc \
     vm-imap.elc vm-license.elc vm-macro.elc vm-mark.elc vm-menu.elc \
     vm-message.elc \
     vm-save.elc \
     vm-search.elc vm-sort.elc vm-summary.elc vm-startup.elc vm-thread.elc \
     vm-toolbar.elc vm-undo.elc \
-    vm-user.elc vm-vars.elc vm-version.elc vm-virtual.elc vm-window.elc
+    vm-user.elc vm-vars.elc vm-virtual.elc vm-window.elc
 
 SOURCES = \
     vm-delete.el vm-digest.el vm-easymenu.el vm-edit.el vm-folder.el \
 
 autoload:	vm-autoload.elc $(OBJECTS) tapestry.elc
 	@echo "building vm.elc (with all modules set to autoload)..."
-	@echo "(require 'vm-startup)" > vm.elc
+	@echo "(require 'vm-version)" > vm.elc
+	@echo "(require 'vm-startup)" >> vm.elc
 	@echo "(require 'vm-vars)" >> vm.elc
-	@echo "(require 'vm-version)" >> vm.elc
 	@echo "(require 'vm-autoload)" >> vm.elc
 
 all:	vm.info vm
 	    ;; authentication
 	    (cond ((equal auth "login")
 		   (vm-imap-send-command process
-					 (format "LOGIN %s %s" user pass))
+					 (format "LOGIN %s %s"
+						 (vm-imap-quote-string user)
+						 (vm-imap-quote-string pass)))
 		   (and (null (vm-imap-read-ok-response process))
 			(progn
 			  (setq vm-imap-passwords
     ;; with a newline.  Add the newline if needed.
     ;;
     ;; HP Openmail seems to have this problem.
-    (if (and (not (eq ?\n (char-before (point))))
+    (if (and (not (eq ?\n (char-after (1- (point)))))
 	     (memq vm-folder-type '(From_-with-Content-Length BellFrom_)))
 	(insert-before-markers "\n"))
     ;; Set file type to binary for DOS/Windows.  I don't know if
 	    (setq retrieved (cdr retrieved))))
       (setq x (cdr x)))
     retrieved ))
+
+(defun vm-imap-quote-string (string)
+  (vm-with-string-as-temp-buffer string 'vm-imap-quote-buffer))
+
+(defun vm-imap-quote-buffer ()
+  (goto-char (point-min))
+  (insert "\"")
+  (while (re-search-forward "[\"\\]" nil t)
+    (forward-char -1)
+    (insert "\\")
+    (forward-char 1))
+  (goto-char (point-max))
+  (insert "\""))
 			    body)
 		     '(set-buffer-multibyte xzx))))
    body))
+
+(defmacro vm-with-multibyte-buffer (&rest body)
+  (nconc
+   (list 'if 'vm-fsfemacs-mule-p
+	 (list 'let '((xzx enable-multibyte-characters))
+	       (list 'unwind-protect
+		     (nconc (list 'let nil '(set-buffer-multibyte t))
+			    body)
+		     '(set-buffer-multibyte xzx))))
+   body))
 
 (provide 'vm-menu)
 
-;; copied from vm-vars.el because vm-xemacs-p, vm-xemacs-mule-p, 
-;; vm-fsfemacs-mule-p, and vm-fsfemacs-p are needed below at load time
-;; and vm-note-emacs-version may not be autoloadable.
-(or (fboundp 'vm-note-emacs-version)
-    (defun vm-note-emacs-version ()
-      (setq vm-xemacs-p (string-match "XEmacs" emacs-version)
-	    vm-xemacs-mule-p (and vm-xemacs-p (featurep 'mule)
-				  ;; paranoia
-				  (fboundp 'set-buffer-file-coding-system))
-	    vm-fsfemacs-p (not vm-xemacs-p)
-	    vm-fsfemacs-mule-p (and (not vm-xemacs-mule-p) (featurep 'mule)
-				    (fboundp 'set-buffer-file-coding-system)))))
-
-;; make sure the emacs/xemacs version variables are set, as they
-;; are needed below at load time.
-(vm-note-emacs-version)
-
-(defun vm-menu-fsfemacs-menus-p ()
-  (and vm-fsfemacs-p
-       (fboundp 'menu-bar-mode)))
-
-(defun vm-menu-xemacs-menus-p ()
-  (and vm-xemacs-p
-       (fboundp 'set-buffer-menubar)))
-
-(defun vm-fsfemacs-p ()
-  (not (string-match "XEmacs\\|Lucid" emacs-version)))
-
 (defvar vm-menu-folders-menu 
   '("Manipulate Folders"
     ["Make Folders Menu" vm-menu-hm-make-folder-menu vm-folder-directory])
 
 (defun vm-mm-layout (m)
   (or (vm-mime-layout-of m)
-      (progn (vm-set-mime-layout-of
-	      m
-	      (condition-case data
-		  (vm-mime-parse-entity m)
-		(vm-mime-error (message "%s" (car (cdr data))))))
+      (progn (vm-set-mime-layout-of m (vm-mime-parse-entity-safe m))
 	     (vm-mime-layout-of m))))
 
 (defun vm-mm-encoded-header (m)
 			  (not (= ?\n (char-after (1+ inputpos)))))
 		     (vm-insert-char char 1 nil work-buffer)
 		     (vm-increment cols))
-		    ((or (< char 33) (> char 126) (= char 61)
-			 (and quote-from (= cols 0) (let ((case-fold-search nil))
-						      (looking-at "From ")))
+		    ((or (< char 33) (> char 126)
+			 ;; =
+			 (= char 61)
+			 ;; ?
+			 (and Q-encoding (= char 63))
+			 ;; _
+			 (and Q-encoding (= char 95))
+			 (and quote-from (= cols 0)
+			      (let ((case-fold-search nil))
+				(looking-at "From ")))
 			 (and (= cols 0) (= char ?.)
 			      (looking-at "\\.\\(\n\\|\\'\\)")))
 		     (vm-insert-char ?= 1 nil work-buffer)
-		     (vm-insert-char (car (rassq (lsh char -4) hex-digit-alist))
+		     (vm-insert-char (car (rassq (lsh char -4)
+						 hex-digit-alist))
 				     1 nil work-buffer)
 		     (vm-insert-char (car (rassq (logand char 15)
 						 hex-digit-alist))
   (condition-case error-data
       (vm-mime-parse-entity m c-t c-t-e passing-message-only)
     (vm-mime-error
+     (message "%s" (car (cdr error-data)))
+     (sleep-for 2)
      (let ((header (if (and m (not passing-message-only))
 		       (vm-headers-of m)
 		     (vm-marker (point-min))))
 	   (text-end (if (and m (not passing-message-only))
 			 (vm-text-end-of m)
 		       (vm-marker (point-max)))))
-     (vector c-t c-t
+     (vector '("error/error") '("error/error")
 	     (vm-determine-proper-content-transfer-encoding text text-end)
 	     nil
 	     ;; cram the error message into the description slot
 	(set-buffer b)
 	(widen)
 	(let ((buffer-read-only nil)
+	      (inhibit-read-only t)
 	      (modified (buffer-modified-p)))
 	  (unwind-protect
 	      (progn
   (save-excursion
     (save-restriction
       (narrow-to-region beg end)
-      (catch 'done
-	(goto-char (point-min))
-	(if (or vm-xemacs-mule-p vm-fsfemacs-mule-p)
-	    (let ((charsets (delq 'ascii (vm-charsets-in-region beg end))))
-	      (cond ((null charsets)
-		     "us-ascii")
-		    ((cdr charsets)
-		     (or (car (cdr
-			       (assq (coding-system-name
-				      buffer-file-coding-system)
-				     vm-mime-mule-coding-to-charset-alist)))
-			 "iso-2022-jp"))
-		    (t
-		     (or (car (cdr
-			       (assoc
-				(car charsets)
-				vm-mime-mule-charset-to-charset-alist)))
-			 "unknown"))))
-	  (and (re-search-forward "[^\000-\177]" nil t)
-	       (throw 'done (or vm-mime-8bit-composition-charset
-				"iso-8859-1")))
-	  (throw 'done vm-mime-7bit-composition-charset))))))
+      (vm-with-multibyte-buffer
+       (catch 'done
+	 (goto-char (point-min))
+	 (if (or vm-xemacs-mule-p vm-fsfemacs-mule-p)
+	     (let ((charsets (delq 'ascii (vm-charsets-in-region
+					   (point-min) (point-max)))))
+	       (cond ((null charsets)
+		      "us-ascii")
+		     ((cdr charsets)
+		      (or (car (cdr
+				(assq (vm-coding-system-name
+				       buffer-file-coding-system)
+				      vm-mime-mule-coding-to-charset-alist)))
+			  "iso-2022-jp"))
+		     (t
+		      (or (car (cdr
+				(assoc
+				 (car charsets)
+				 vm-mime-mule-charset-to-charset-alist)))
+			  "unknown"))))
+	   (and (re-search-forward "[^\000-\177]" nil t)
+		(throw 'done (or vm-mime-8bit-composition-charset
+				 "iso-8859-1")))
+	   (throw 'done vm-mime-7bit-composition-charset)))))))
 
 (defun vm-determine-proper-content-transfer-encoding (beg end)
   (save-excursion
 	  (cond ((and vm-infer-mime-types
 		      (vm-mime-types-match "application/octet-stream" type)
 		      (setq file
-			    (vm-mime-get-disposition-parameter layout
-							       "filename"))
+			    (or
+			     (vm-mime-get-disposition-parameter layout
+								"filename")
+			     (vm-mime-get-parameter layout "name")))
 		      (setq type2 (vm-mime-default-type-from-filename file))
 		      (not (vm-mime-types-match type type2)))
 		 (vm-set-mm-layout-type layout (list type2))
 	     (setq end (+ end (- (buffer-size) buffer-size)))
 	     (setq buffer-size (buffer-size))
 	     (w3-region start end)
-	     (setq end (+ end (- (buffer-size) buffer-size))))
-	    ;; remove read-only text properties
-	    (let ((inhibit-read-only t))
-	      (remove-text-properties start end '(read-only nil)))
-	    (goto-char end)
+	     (setq end (+ end (- (buffer-size) buffer-size)))
+	     ;; remove read-only text properties
+	     (let ((inhibit-read-only t))
+	       (remove-text-properties start end '(read-only nil)))
+	     (goto-char end))
 	    (message "Inlining text/html... done")
 	    t )
 	(error (vm-set-mm-layout-display-error
 (defun vm-mime-display-internal-text/plain (layout &optional no-highlighting)
   (let ((start (point)) end old-size
 	(buffer-read-only nil)
+	(m (vm-mm-layout-message layout))
 	(charset (or (vm-mime-get-parameter layout "charset") "us-ascii")))
     (if (not (vm-mime-charset-internally-displayable-p charset))
 	(progn
        (vm-mime-charset-decode-region charset start end)
        (set-marker end (+ end (- (buffer-size) old-size))))
       (or no-highlighting (vm-energize-urls-in-message-region start end))
+      (if (and vm-fill-paragraphs-containing-long-lines
+	       (not no-highlighting))
+	  (let ((needmsg (> (- (vm-text-end-of m)
+			       (vm-text-of m))
+			    12000)))
+	    (if needmsg
+		(message "Searching for paragraphs to fill..."))
+	    (vm-fill-paragraphs-containing-long-lines
+	     vm-fill-paragraphs-containing-long-lines
+	     start end)
+	    (if needmsg
+		(message "Searching for paragraphs to fill... done"))))
       (goto-char end)
       t )))
 
 	     (funcall (or function (extent-property e 'vm-mime-function))
 		      e))))))
 
+(defun vm-mime-reader-map-save-file ()
+  (interactive)
+  (vm-mime-run-display-function-at-point 'vm-mime-send-body-to-file))
+
+(defun vm-mime-reader-map-pipe-to-command ()
+  (interactive)
+  (vm-mime-run-display-function-at-point
+   'vm-mime-pipe-body-to-queried-command))
+
+(defun vm-mime-reader-map-pipe-to-printer ()
+  (interactive)
+  (vm-mime-run-display-function-at-point 'vm-mime-send-body-to-printer))
+
+(defun vm-mime-reader-map-display-using-external-viewer ()
+  (interactive)
+  (vm-mime-run-display-function-at-point
+   'vm-mime-display-body-using-external-viewer))
+
+(defun vm-mime-reader-map-display-using-default ()
+  (interactive)
+  (vm-mime-run-display-function-at-point 'vm-mime-display-body-as-text))
+
 ;; for the karking compiler
 (defvar vm-menu-mime-dispose-menu)
 
 
 (defun vm-mime-insert-button (caption action layout disposable)
   (let ((start (point))	e
-	(keymap (make-sparse-keymap))
+	(keymap vm-mime-reader-map)
 	(buffer-read-only nil))
     (if (fboundp 'set-keymap-parents)
 	(if (current-local-map)
 	    (set-keymap-parents keymap (list (current-local-map))))
-      (setq keymap (nconc keymap (current-local-map))))
-    (define-key keymap "\r" 'vm-mime-run-display-function-at-point)
-    (if (and (vm-mouse-xemacs-mouse-p) vm-popup-menu-on-mouse-3)
-	(define-key keymap 'button3 'vm-menu-popup-mime-dispose-menu))
+      (setq keymap (append keymap (current-local-map))))
     (if (not (bolp))
 	(insert "\n"))
     (insert caption "\n")
 	    (or (not (file-exists-p file))
 		(y-or-n-p "File exists, overwrite? ")
 		(error "Aborted"))
-	    (write-region (point-min) (point-max) file nil nil))
+	    ;; Bind the function jka-compr-get-compression-info to
+	    ;; somethign that will return nil so that jka-compr
+	    ;; won't compress already compressed data.  This is a
+	    ;; crock, but I'm tired of hearing about this.
+	    (let ((jk-func (and (fboundp 'jka-compr-get-compression-info)
+				(symbol-function
+				 'jka-compr-get-compression-info))))
+	      (unwind-protect
+		  (progn
+		    (fset 'jka-compr-get-compression-info 'ignore)
+		    (write-region (point-min) (point-max) file nil nil))
+		(if jk-func
+		    (fset 'jka-compr-get-compression-info jk-func)
+		  (fmakunbound 'jka-compr-get-compression-info)))))
 	(and work-buffer (kill-buffer work-buffer))))))
 
 (defun vm-mime-pipe-body-to-command (command layout &optional discard-output)
 			     (extent-property e 'vm-mime-type))
 			    'no-conversion
 			  'binary))
+		       ;; no transformations!
+		       (format-alist nil)
 		       ;; don't let buffer-file-coding-system be changed
-		       ;; by insert-file-contents-literally.  The
+		       ;; by insert-file-contents.  The
 		       ;; value we bind to it to here isn't important.
 		       (buffer-file-coding-system 'binary))
-		   (insert-file-contents-literally object))))
+		   (insert-file-contents object))))
 	  ;; gather information about the object from the extent.
 	  (if (setq already-mimed (extent-property e 'vm-mime-encoded))
 	      (setq layout (vm-mime-parse-entity
 			      (overlay-get o 'vm-mime-type))
 			     'no-conversion
 			   'binary))
+			;; no transformations!
+			(format-alist nil)
 			;; don't let buffer-file-coding-system be
 			;; changed by insert-file-contents.  The
 			;; value we bind to it to here isn't
 	((markerp object) (copy-marker object))
 	(t object)))
 
-(defun vm-multiple-frames-possible-p () 
-  (cond (vm-xemacs-p 
-	 (or (memq 'win (device-matching-specifier-tag-list))
-	     (featurep 'tty-frames)))
-        (vm-fsfemacs-p 
-         (fboundp 'make-frame))))
- 
-(defun vm-mouse-support-possible-p () 
-  (cond (vm-xemacs-p 
-         (featurep 'window-system)) 
-        (vm-fsfemacs-p 
-         (fboundp 'track-mouse))))
- 
-(defun vm-mouse-support-possible-here-p ()
-  (cond (vm-xemacs-p
-	 (memq 'win (device-matching-specifier-tag-list)))
-	(vm-fsfemacs-p
-	 (memq window-system '(x win32)))))
-
-(defun vm-menu-support-possible-p ()
-  (cond (vm-xemacs-p
-	 (featurep 'menubar))
-	(vm-fsfemacs-p
-	 (fboundp 'menu-bar-mode))))
- 
-(defun vm-toolbar-support-possible-p ()
-  (and vm-xemacs-p (featurep 'toolbar)))
-
-(defun vm-multiple-fonts-possible-p ()
-  (cond (vm-xemacs-p
-	 (memq (device-type) '(x mswindows)))
-	(vm-fsfemacs-p
-	 (or (eq window-system 'x)
-	     (eq window-system 'win32)))))
-
-(defun vm-images-possible-here-p ()
-  (and vm-xemacs-p (memq (device-type) '(x mswindows))))
-
 (defun vm-run-message-hook (message &optional hook-variable)
   (save-excursion
     (set-buffer (vm-buffer-of message))
       ((fboundp 'find-charset-region)
        (fset 'vm-charsets-in-region 'find-charset-region)))
 
+(cond ((fboundp 'coding-system-name)
+       (fset 'vm-coding-system-name 'coding-system-name))
+      (t
+       (fset 'vm-coding-system-name 'symbol-name)))
+
 (defun vm-collapse-whitespace ()
   (goto-char (point-min))
   (while (re-search-forward "[ \t\n]+" nil 0)
     (replace-match " " t t)))
+
+(defun vm-fill-paragraphs-containing-long-lines (len start end)
+  (let ((done nil)
+	(buffer-read-only nil)
+	(fill-column (1- len))
+	;; user doesn't want long line, so set this to zero for them.
+	(filladapt-fill-column-forward-fuzz 0))
+    (save-excursion
+      (vm-save-restriction
+       (widen)
+       (or (markerp end) (setq end (vm-marker end)))
+       (goto-char start)
+       (while (not done)
+	 (re-search-forward "$" end t)
+	 (if (>= (current-column) len)
+	     (fill-paragraph nil))
+	 (forward-line)
+	 (setq done (>= (point) end)))))))
 
 (provide 'vm-mouse)
 
-(defun vm-mouse-fsfemacs-mouse-p ()
-  (and vm-fsfemacs-p
-       (fboundp 'set-mouse-position)))
-
-(defun vm-mouse-xemacs-mouse-p ()
-  (and vm-xemacs-p
-       (fboundp 'set-mouse-position)))
-
 (defun vm-mouse-set-mouse-track-highlight (start end &optional overlay)
   (if (null overlay)
 	(cond (vm-fsfemacs-p
 	;; selectable objects are handled by an extent keymap
 	;; binding that points to a more specific function.  But
 	;; this might come in handy later if I want selectable
-	;; objects that don't have an extent or extent keymap
-	;; attached.
+	;; objects that don't have an extent keymap attached.
 	((vm-mouse-xemacs-mouse-p)
 	 (set-buffer (window-buffer (event-window event)))
 	 (and (event-point event) (goto-char (event-point event)))
   (if new-netscape
       (apply 'vm-run-background-command vm-netscape-program
 	     (append vm-netscape-program-switches (list url)))
-    (or (equal 0 (apply 'vm-run-command vm-netscape-program "-remote" 
-			(append (list (concat "openURL(" url
+    (or (equal 0 (apply 'vm-run-command vm-netscape-program
+			(append vm-netscape-program-switches
+				(list "-remote"
+				      (concat "openURL(" url
 					      (if new-window ",new-window" "")
-					      ")"))
-				vm-netscape-program-switches)))
+					      ")")))))
 	(vm-mouse-send-url-to-netscape url t new-window)))
   (message "Sending URL to Netscape... done"))
 
 
    (vm-narrow-for-preview)
    (if (or vm-mime-display-function
+	   (natnump vm-fill-paragraphs-containing-long-lines)
 	   (and vm-display-using-mime
 		(not (vm-mime-plain-message-p (car vm-message-pointer)))))
        (let ((layout (vm-mm-layout (car vm-message-pointer))))
 	 (vm-mime-error (vm-set-mime-layout-of (car vm-message-pointer)
 					       (car (cdr data)))
 			(message "%s" (car (cdr data))))))
+  (if (and (natnump vm-fill-paragraphs-containing-long-lines)
+	   (vm-mime-plain-message-p (car vm-message-pointer)))
+      (let ((needmsg (> (- (vm-text-end-of (car vm-message-pointer))
+			   (vm-text-of (car vm-message-pointer)))
+			12000)))
+	(if needmsg
+	    (message "Searching for paragraphs to fill..."))
+	(vm-fill-paragraphs-containing-long-lines
+	 vm-fill-paragraphs-containing-long-lines
+	 (vm-text-of (car vm-message-pointer))
+	 (vm-text-end-of (car vm-message-pointer)))
+	(if needmsg
+	    (message "Searching for paragraphs to fill... done"))))
   (vm-save-buffer-excursion
    (save-excursion
      (save-excursion
 		in-reply-to (and (not (equal "" in-reply-to)) in-reply-to))
 	  (and subject (stringp vm-reply-subject-prefix)
 	       (let ((case-fold-search t))
-		 (and
 		  (not
 		   (equal
 		    (string-match (regexp-quote vm-reply-subject-prefix)
 				  subject)
-		    0))
-		  (or
-		   (not (stringp vm-subject-ignored-prefix))
-		   (not
-		    (equal
-		     (string-match vm-subject-ignored-prefix subject)
-		     0)))))
+		    0)))
 	       (setq subject (concat vm-reply-subject-prefix subject))))
 	 (t (cond ((setq tmp (vm-get-header-contents (car mp) "Reply-To:"
 						     ", "))
 		        switch-function yank-action
 			send-actions)
   (interactive)
+  (vm-session-initialization)
   (if continue
       (vm-continue-composing-message)
     (let ((buffer (vm-mail-internal
 (defun vm-mode (&optional read-only)
   "Major mode for reading mail.
 
-This is VM 6.67.
+This is VM 6.71.
 
 Commands:
    h - summarize folder contents
    vm-display-buffer-hook
    vm-display-using-mime
    vm-edit-message-hook
+   vm-fill-paragraphs-containing-long-lines
+   vm-flush-interval
    vm-folder-directory
    vm-folder-read-only
    vm-follow-summary-cursor
       'vm-display-using-mime
       'vm-edit-message-hook
       'vm-edit-message-mode
+      'vm-fill-paragraphs-containing-long-lines
       'vm-flush-interval
       'vm-folder-directory
       'vm-folder-read-only
 	((and vm-fsfemacs-p
 	      (= emacs-major-version 20)
 	      (< emacs-minor-version 4))
-	 (error "VM must be run on Emacs 20.3 or a later v20 version."))))
+	 (error "VM must be run on Emacs 20.4 or a later v20 version."))))
 
 (defun vm-set-debug-flags ()
   (or stack-trace-on-error
   (let ((m-list (vm-select-marked-or-prefixed-messages count))
 	(action-labels (vm-parse string
 "[\000-\040,\177-\377]*\\([^\000-\040,\177-\377]+\\)[\000-\040,\177-\377]*"))
-	labels act-labels)
+	labels act-labels m mm-list)
     (if (and add m-list)
 	(if (eq add 'all)
 	    (progn
 	      (setq act-labels (cdr act-labels)))
 	    (setq action-labels newlist))))
     (while m-list
+      (setq m (car m-list))
+      (if (and add (vm-virtual-message-p m))
+	  (let ((labels action-labels))
+	    (save-excursion
+	      (set-buffer (vm-buffer-of (vm-real-message-of m)))
+	      (while labels
+		(intern (car labels) vm-label-obarray)
+		(setq labels (cdr labels))))))
+      (if add
+	  (save-excursion
+	    (setq mm-list (vm-virtual-messages-of m))
+	    (while mm-list
+	      (let ((labels action-labels))
+		(set-buffer (vm-buffer-of (car mm-list)))
+		(while labels
+		  (intern (car labels) vm-label-obarray)
+		  (setq labels (cdr labels))))
+	      (setq labels (cdr labels)))))
       (setq act-labels action-labels
 	    labels (copy-sequence (vm-labels-of (car m-list))))
       (if add
   "*Non-nil value means to preview messages even if they've already been read.
 A nil value causes VM to preview messages only if new or unread.")
 
+(defvar vm-fill-paragraphs-containing-long-lines nil
+  "*Non-nil numeric value N causes VM to fill paragraphs that
+contain lines spanning N columns or more.  Only plain text
+messages and text/plain MIME parts will be filled.  The message
+itself is not modified; its text is copied into a presentation
+buffer before the filling is done.")
+
 (defvar vm-display-using-mime t
   "*Non-nil value means VM should display messages using MIME.
 MIME (Multipurpose Internet Mail Extensions) is a set of
 `vm-mime-internal-content-types').  If none of the parts can be
 displayed internally, behavior reverts to that of 'best.")
 
-(defvar vm-mime-default-face-charsets '("us-ascii" "iso-8859-1")
+(defvar vm-mime-default-face-charsets
+  (if vm-fsfemacs-mule-p
+      '("us-ascii")
+    '("us-ascii" "iso-8859-1"))
   "*List of character sets that can be displayed using the `default' face.
 The default face is what you normally see when you edit text in Emacs.
 The font assigned to the default face can typically display one or two
     ("audio" . "%-35.35(%d%) [%k to %a]")
     ("video" . "%-35.35(%d%) [%k to %a]")
     ("image" . "%-35.35(%d%) [%k to %a]")
-    ("application/octet-stream" . "%-35.35(%d, %f%) [%k to %a]"))
+    ("application/octet-stream" . "%-35.35(%d, %f%) [%k to %a]")
+    ;; for parse errors
+    ("error/error" . "%d"))
   "*List of types and formats for MIME buttons.
 When VM does not display a MIME object immediately, it displays a
 button or tag line in its place that describes the object and what you
    e - the content transfer encoding, either \"base64\" or
        \"quoted-printable\".
    f - the suggested file name to save the object into, as
-       specified either in the Content-DIsposition header, or the
-       \"name\" parameter for objects of type \"appliciation\".
+       specified either in the Content-Disposition header, or the
+       \"name\" parameter for objects of type \"application\".
    k - how to activate the button.  Usually \"Press RETURN\" or
        \"Click mouse-2\".
    n - for multipart types this is the number of bundled parts,
     map )
   "Keymap for the buffers created by VM's vm-edit-message command.")
 
+(defvar vm-mime-reader-map
+  (let ((map (make-sparse-keymap)))
+    (define-key map "$s" 'vm-mime-reader-map-save-file)
+    (define-key map "$|" 'vm-mime-reader-map-pipe-to-command)
+    (define-key map "$p" 'vm-mime-reader-map-pipe-to-printer)
+    (define-key map "$d" 'vm-mime-reader-map-display-using-default)
+    (define-key map "$e" 'vm-mime-reader-map-display-using-external-viewer)
+    (define-key map "\r" 'vm-mime-run-display-function-at-point)
+    (cond ((vm-mouse-xemacs-mouse-p)
+	   (define-key map 'button3 'vm-menu-popup-mime-dispose-menu)))
+    (cond ((fboundp 'set-keymap-name)
+	   (set-keymap-name map 'vm-mime-reader-map)))
+    map )
+  "Keymap for the MIME buttons in VM folder buffers.")
+
 (defvar vm-folder-history nil
   "List of folders visited this Emacs session.")
 
     ("multipart/digest" . "read digest")
     ("multipart/parallel" . "display parts in parallel")
     ("multipart" . "display parts")
-    ("message/partial" . "attempt message aseembly")
+    ("message/partial" . "attempt message assembly")
     ("message" . "display message")
     ("audio" . "play audio")
     ("video" . "display video")
 (make-variable-buffer-local 'vm-folder-garbage-alist)
 ;; Environment primitives, needed for MULE code that follows
 (defconst vm-mime-header-list '("MIME-Version:" "Content-"))
-(defconst vm-xemacs-p nil)
-(defconst vm-xemacs-mule-p nil)
-(defconst vm-fsfemacs-p nil)
-(defconst vm-fsfemacs-mule-p nil)
-(defun vm-xemacs-p () vm-xemacs-p)
-(defun vm-xemacs-mule-p () vm-xemacs-mule-p)
-(defun vm-fsfemacs-p () vm-fsfemacs-p)
-(defun vm-fsfemacs-mule-p () vm-fsfemacs-mule-p)
-(defun vm-note-emacs-version ()
-  (setq vm-xemacs-p (string-match "XEmacs" emacs-version)
-	vm-xemacs-mule-p (and vm-xemacs-p (featurep 'mule)
-			      ;; paranoia
-			      (fboundp 'set-buffer-file-coding-system))
-	vm-fsfemacs-p (not vm-xemacs-p)
-	vm-fsfemacs-mule-p (and (not vm-xemacs-mule-p) (featurep 'mule)
-				(fboundp 'set-buffer-file-coding-system))))
-(vm-note-emacs-version)
 
 (defconst vm-mime-mule-charset-to-coding-alist
   (cond (vm-fsfemacs-mule-p
 
 (provide 'vm-version)
 
-(defconst vm-version "6.67"
+(defconst vm-version "6.71"
   "Version number of VM.")
 
 (defun vm-version ()
   "Returns the value of the variable vm-version."
   vm-version)
+
+(defconst vm-xemacs-p nil)
+(defconst vm-xemacs-mule-p nil)
+(defconst vm-fsfemacs-p nil)
+(defconst vm-fsfemacs-mule-p nil)
+(defun vm-xemacs-p () vm-xemacs-p)
+(defun vm-xemacs-mule-p () vm-xemacs-mule-p)
+(defun vm-fsfemacs-p () vm-fsfemacs-p)
+(defun vm-fsfemacs-mule-p () vm-fsfemacs-mule-p)
+(defun vm-note-emacs-version ()
+  (setq vm-xemacs-p (string-match "XEmacs" emacs-version)
+	vm-xemacs-mule-p (and vm-xemacs-p (featurep 'mule)
+			      ;; paranoia
+			      (fboundp 'set-buffer-file-coding-system))
+	vm-fsfemacs-p (not vm-xemacs-p)
+	vm-fsfemacs-mule-p (and (not vm-xemacs-mule-p) (featurep 'mule)
+				(fboundp 'set-buffer-file-coding-system))))
+(vm-note-emacs-version)
+
+(defun vm-mouse-fsfemacs-mouse-p ()
+  (and vm-fsfemacs-p
+       (fboundp 'set-mouse-position)))
+
+(defun vm-mouse-xemacs-mouse-p ()
+  (and vm-xemacs-p
+       (fboundp 'set-mouse-position)))
+
+(defun vm-menu-fsfemacs-menus-p ()
+  (and vm-fsfemacs-p
+       (fboundp 'menu-bar-mode)))
+
+(defun vm-menu-xemacs-menus-p ()
+  (and vm-xemacs-p
+       (fboundp 'set-buffer-menubar)))
+
+(defun vm-multiple-frames-possible-p () 
+  (cond (vm-xemacs-p 
+	 (or (memq 'win (device-matching-specifier-tag-list))
+	     (featurep 'tty-frames)))
+        (vm-fsfemacs-p 
+         (fboundp 'make-frame))))
+ 
+(defun vm-mouse-support-possible-p () 
+  (cond (vm-xemacs-p 
+         (featurep 'window-system)) 
+        (vm-fsfemacs-p 
+         (fboundp 'track-mouse))))
+ 
+(defun vm-mouse-support-possible-here-p ()
+  (cond (vm-xemacs-p
+	 (memq 'win (device-matching-specifier-tag-list)))
+	(vm-fsfemacs-p
+	 (memq window-system '(x win32)))))
+
+(defun vm-menu-support-possible-p ()
+  (cond (vm-xemacs-p
+	 (featurep 'menubar))
+	(vm-fsfemacs-p
+	 (fboundp 'menu-bar-mode))))
+ 
+(defun vm-toolbar-support-possible-p ()
+  (and vm-xemacs-p (featurep 'toolbar)))
+
+(defun vm-multiple-fonts-possible-p ()
+  (cond (vm-xemacs-p
+	 (memq (device-type) '(x mswindows)))
+	(vm-fsfemacs-p
+	 (or (eq window-system 'x)
+	     (eq window-system 'win32)))))
+
+(defun vm-images-possible-here-p ()
+  (and vm-xemacs-p (memq (device-type) '(x mswindows))))
+