Commits

Anonymous committed 26befe6

Sync VM to 8.0.11

  • Participants
  • Parent commits aae954b

Comments (0)

Files changed (19)

+VM 8.0.11
+
+  BUGFIXES:
+
+    * Removed dependency of vm-revno.el to other lisp sources to avoid
+      building it in a release bundle.  (Thanks to Ralf Fassel)
+
 VM 8.0.10
 
   NOTES:
 
   IMPROVEMENTS:
 
+    * Added missing documentation for `vm-user-agent', "?" binding and
+      'vm-delete-duplicate-messages'.  (Thanks to Alan Wehmann)
+
     * `vm-message-history.el' now uses a buffer similar to the summary for
       browsing the history.  The buffer replaces the summary buffer when
-      present.  Duplicate history entries will be removed.  
+      present.  Duplicate history entries will be removed.
+
+    * Define and use `vm-replace-in-string' which is `replace-in-string'
+      from XEmacs to avoid clashes with other GNU Emacs packages defining
+      it differently. Unfortunately, GNU Emacs still does not provide this
+      handy function. (Thanks to Jos� Miguel Figueroa)
+
+    * MIME encoding of header will automatically happen now and has been moved
+      from `vm-rfaddons.el' to `vm-mime.el' and `vm-vars.el'.
 
   BUGFIXES:
 
 
     * Decode (QP-)encoded clear text before decrypting it.
 
+    * Use nil as default for `vm-mime-8bit-composition-charset' and thus
+      enable proper detection of right charset.  (Thanks to Naoki Saito for
+      reporting and debugging)
+
+    * Fixed bug in `vm-mime-display-external-generic' for GNU Emacs 23 causing
+      corrupted content in the output file.  The old code has been replaced by
+      a call to `vm-mime-send-body-to-file' which avoids duplication and works.
+      There has been some special handling for `vm-fsfemacs-mule-p', but the
+      actual reason for this was unclear so it has been removed.
+
+    * Correctly handle `vm-enable-addons' being t.
+
+    * Correctly store UTF-8 strings in the X-VM-v5-Data header to avoid
+      corruption of summay lines. (Thanks to Yuning Feng for reporting)
+
+    * Correctly encode multibyte subjects. (Thanks to Yuning Feng for the
+      patch) 
+
+    * Use BASE64 for header encoding when there are special chars not quoted
+      by QP normally.  You may configure this by `vm-mime-encode-headers-type'.
+
+    * qp-decode program handles premature end of QP-encoded stream now
+      gracefully. (Thanks to Ralf Fassel for the bug report, fix and testing)
+
+    * Added missing newline after "Content-Type" when using the command
+      `vm-mime-attach-object-from-message'.  (Thanks to Dan Freed)
+
 VM 8.0.9
 
   BUGFIXES:

File lisp/vm-avirtual.el

 ;; Status:      Tested with XEmacs 21.4.19 & VM 7.19
 ;; Keywords:    VM, virtual folders 
 ;; X-URL:       http://www.robf.de/Hacking/elisp
-;; Version:     $Id$
 
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by

File lisp/vm-biff.el

 ;; Status:      Tested with XEmacs 21.4.15 & VM 7.18
 ;; Keywords:    VM helpers
 ;; X-URL:       http://www.robf.de/Hacking/elisp
-;; Version:     $Id$
 
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by

File lisp/vm-folder.el

 	      (let ((print-escape-newlines t))
 		(prin1-to-string attributes))
 	      "\n\t"
-	      (let ((print-escape-newlines t))
-		(prin1-to-string cache))
+	      (vm-mime-encode-words-in-string
+	       (let ((print-escape-newlines t))
+		 (prin1-to-string cache)))
 	      "\n\t"
 	      (let ((print-escape-newlines t))
 		(prin1-to-string (vm-labels-of m)))

File lisp/vm-grepmail.el

 ;; Status:      Tested with XEmacs 21.4.15 & VM 7.19
 ;; Keywords:    VM helpers
 ;; X-URL:       http://www.robf.de/Hacking/elisp
-;; Version:     $Id$
 
 ;;
 ;; This code is free software; you can redistribute it and/or modify

File lisp/vm-message-history.el

 
 ;; Author: Kevin Rodgers <ihs_4664@yahoo.com>
 ;; Created: 6 Oct 2003
-;; Version: $Revision$
 ;; Keywords: mail, history
-;; RCS: $Id$
 
 ;; This program is free software; you can redistribute it and/or
 ;; modify it under the terms of the GNU General Public License as

File lisp/vm-mime.el

 
 (defvar buffer-file-coding-system)
 
-;; TODO: Possible further work; integrate with the FSF's unify-8859-on-encoding-mode stuff.
+;; TODO: integrate with the FSF's unify-8859-on-encoding-mode stuff.
 (defun vm-determine-proper-charset (beg end)
   "Work out what MIME character set to use for sending a message.
 
 system that will encode all the characters in the message. If none is found,
 consults the variable `vm-mime-8bit-composition-charset' or uses `iso-2022-jp',
 which will preserve information for all the character sets of which Emacs is
-aware--at the expense of being incompatible with the recipient's software, if
+aware - at the expense of being incompatible with the recipient's software, if
 that recipient is outside of East Asia."
   (save-excursion
     (save-restriction
     (if (and (processp process) (eq (process-status process) 'run))
 	t
       (cond ((or (null tempfile) (null (file-exists-p tempfile)))
-	     (cond (vm-fsfemacs-mule-p
-		    (let (work-buffer (target (current-buffer)))
-		      (unwind-protect
-			  (save-excursion
-			    (setq work-buffer (vm-make-work-buffer))
-			    (set-buffer work-buffer)
-			    (vm-mime-insert-mime-body layout)
-			    (vm-mime-transfer-decode-region layout
-							    (point-min)
-							    (point-max))
-			    (set-buffer-multibyte t)
-			    (set-buffer target)
-			    (setq start (point))
-			    (insert-buffer-substring work-buffer)
-			    (setq end (point-marker)))
-			(and work-buffer (kill-buffer work-buffer)))))
-		   (t
-		    (setq start (point))
-		    (vm-mime-insert-mime-body layout)
-		    (setq end (point-marker))
-		    (vm-mime-transfer-decode-region layout start end)))
 	     (setq suffix (vm-mime-extract-filename-suffix layout)
 		   suffix (or suffix
 			      (vm-mime-find-filename-suffix-for-type layout)))
 		   (or (vm-mime-get-disposition-parameter layout "filename")
 		       (vm-mime-get-parameter layout "name")))
 	     (setq tempfile (vm-make-tempfile suffix basename))
-	     (vm-register-message-garbage-files (list tempfile))
-	     (let ((buffer-file-type buffer-file-type)
-		   (selective-display nil)
-		   buffer-file-coding-system)
-	       ;; Tell DOS/Windows NT whether the file is binary
-	       (setq buffer-file-type
-		     (not (vm-mime-text-type-layout-p layout)))
-	       ;; Tell XEmacs/MULE not to mess with the bits unless
-	       ;; this is a text type.
-	       (if (fboundp 'set-buffer-file-coding-system)
-		   (if (vm-mime-text-type-layout-p layout)
-		       (set-buffer-file-coding-system
-			(vm-line-ending-coding-system) nil)
-		     (set-buffer-file-coding-system
-		      (vm-binary-coding-system) t)))
-	       (write-region start end tempfile nil 0)
-	       (delete-region start end))))
+             (vm-register-message-garbage-files (list tempfile))
+             (vm-mime-send-body-to-file layout nil tempfile t)))
 
       ;; quote file name for shell command only
       (or (cdr program-list)
 	(setq e-alist (cdr e-alist))))
     matched))
 
-(defun vm-mime-send-body-to-file (layout &optional default-filename file)
+(defun vm-mime-send-body-to-file (layout &optional default-filename file
+                                         overwrite)
   (if (not (vectorp layout))
       (setq layout (vm-extent-property layout 'vm-mime-layout)))
   (or default-filename
 		  (set-buffer-file-coding-system (vm-binary-coding-system) t)))
 	    (vm-mime-insert-mime-body layout)
 	    (vm-mime-transfer-decode-region layout (point-min) (point-max))
-	    (or (not (file-exists-p file))
-		(y-or-n-p "File exists, overwrite? ")
-		(error "Aborted"))
+            (unless (or overwrite (not (file-exists-p file)))
+              (or (y-or-n-p "File exists, overwrite? ")
+                  (error "Aborted")))
 	    ;; Bind the jka-compr-compression-info-list to nil so
 	    ;; that jka-compr won't compress already compressed
 	    ;; data.  This is a crock, but as usual I'm getting
 	    (vm-mime-transfer-decode-region layout start (point-max))
 	    (goto-char (point-min))
 	    (vm-reorder-message-headers nil nil "Content-Transfer-Encoding:")
-	    (insert "Content-Transfer-Encoding: binary")
+	    (insert "Content-Transfer-Encoding: binary\n")
 	    (set-buffer composition)
 	    (vm-mime-attach-object work-buffer
 				   (car (vm-mm-layout-type layout))
 	       (vm-set-mm-layout-parts layout nil)
 	       (vm-set-mm-layout-display-error layout nil)))))))
 
+(defun vm-mime-encode-words (&optional encoding)
+  (goto-char (point-min))
+
+  ;; find right encoding 
+  (setq encoding (or encoding vm-mime-encode-headers-type))
+  (save-excursion
+    (when (stringp encoding)
+      (setq encoding 
+            (if (re-search-forward encoding (point-max) t)
+                'B
+              'Q))))
+  ;; now encode the words 
+  (let ((case-fold-search nil)
+        start end charset coding)
+    (while (re-search-forward vm-mime-encode-words-regexp (point-max) t)
+      (setq start (match-beginning 0)
+            end   (vm-marker (match-end 0))
+            charset (or (vm-determine-proper-charset start end)
+                        vm-mime-8bit-composition-charset)
+            coding (vm-string-assoc charset vm-mime-mule-charset-to-coding-alist)
+            coding (and coding (cadr coding)))
+      ;; encode coding system body
+      (when (and coding (not (eq coding 'no-conversion)))
+        (encode-coding-region start end coding))
+      ;; encode 
+      (if (eq encoding 'Q)
+          (vm-mime-Q-encode-region start end)
+        (vm-mime-base64-encode-region  start end))
+      ;; insert start and end markers 
+      (goto-char start)
+      (insert "=?" charset "?" (format "%s" encoding) "?")
+      (setq start (point))
+      (goto-char end)
+      (insert "?=")
+      ;; goto end for next round
+      (goto-char end))))
+
+;;;###autoload
+(defun vm-mime-encode-words-in-string (string &optional encoding)
+  (vm-with-string-as-temp-buffer string 'vm-mime-encode-words))
+
+(defun vm-mime-encode-headers ()
+  "Encodes the headers of a message.
+
+Only the words containing a non 7bit ASCII char are encoded, but not the whole
+header as this will cause trouble for the recipients and authors headers.
+
+Whitespace between encoded words is trimmed during decoding and thus those
+should be encoded together."
+  (interactive)
+  (save-excursion 
+    (let ((headers (concat "^\\(" vm-mime-encode-headers-regexp "\\):"))
+          (case-fold-search nil)
+          (encoding vm-mime-encode-headers-type)
+          body-start
+          start end)
+      (goto-char (point-min))
+      (search-forward mail-header-separator)
+      (setq body-start (vm-marker (match-beginning 0)))
+      (goto-char (point-min))
+      
+      (while (re-search-forward headers body-start t)
+        (goto-char (match-end 0))
+        (setq start (point))
+        (when (not (looking-at "\\s-"))
+          (insert " ")
+          (backward-char 1))
+        (save-excursion
+          (setq end (or (and (re-search-forward "^[^ \t:]+:" body-start t)
+                             (match-beginning 0))
+                        body-start)))
+        (vm-save-restriction
+         (narrow-to-region start end)
+         (vm-mime-encode-words))
+        (goto-char end)))))
+
 ;;;###autoload
 (defun vm-mime-encode-composition ()
  "MIME encode the current mail composition buffer.
   (interactive)
 
   (vm-disable-modes vm-disable-modes-before-encoding)
-  
+
+  (vm-mime-encode-headers)
+
   (buffer-enable-undo)
   (let ((unwind-needed t)
 	(mybuffer (current-buffer)))

File lisp/vm-misc.el

 ;; 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 
 ;;; Code:
+
+;; Taken from XEmacs as GNU Emacs is missing `replace-in-string' and defining
+;; it may cause clashes with other packages defining it differently, in fact
+;; we could also call the function `replace-regexp-in-string' as Roland
+;; Winkler pointed out.
+(defun vm-replace-in-string (str regexp newtext &optional literal)
+  "Replace all matches in STR for REGEXP with NEWTEXT string,
+ and returns the new string.
+Optional LITERAL non-nil means do a literal replacement.
+Otherwise treat `\\' in NEWTEXT as special:
+  `\\&' in NEWTEXT means substitute original matched text.
+  `\\N' means substitute what matched the Nth `\\(...\\)'.
+       If Nth parens didn't match, substitute nothing.
+  `\\\\' means insert one `\\'.
+  `\\u' means upcase the next character.
+  `\\l' means downcase the next character.
+  `\\U' means begin upcasing all following characters.
+  `\\L' means begin downcasing all following characters.
+  `\\E' means terminate the effect of any `\\U' or `\\L'."
+  (if (> (length str) 50)
+      (let ((cfs case-fold-search))
+	(with-temp-buffer
+          (setq case-fold-search cfs)
+	  (insert str)
+	  (goto-char 1)
+	  (while (re-search-forward regexp nil t)
+	    (replace-match newtext t literal))
+	  (buffer-string)))
+    (let ((start 0) newstr)
+      (while (string-match regexp str start)
+        (setq newstr (replace-match newtext t literal str)
+              start (+ (match-end 0) (- (length newstr) (length str)))
+              str newstr))
+      str)))
+
 (defun vm-delete-non-matching-strings (regexp list &optional destructively)
   "Delete strings matching REGEXP from LIST.
 Optional third arg non-nil means to destructively alter LIST, instead of

File lisp/vm-pcrisis.el

 ;;
 ;; Maintainer: Robert Widhopf-Fenk <hack@robf.de>
 ;; X-URL:       http://www.robf.de/Hacking/elisp
-;; Revision     $Id$
 ;;
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
             (progn
               (vmpc-delete-header hdrfield)
               (if (string-match regexp hdr)
-                  (setq hdr (replace-in-string hdr regexp hdrcont))
+                  (setq hdr (vm-replace-in-string hdr regexp hdrcont))
                 (setq hdr (if sep (concat hdr sep hdrcont)
                             (concat hdr hdrcont))))
               (vmpc-insert-header hdrfield hdr)

File lisp/vm-pgg.el

 ;; Status:      Tested with XEmacs 21.4.19 & VM 7.19
 ;; Keywords:    VM helpers
 ;; X-URL:       http://www.robf.de/Hacking/elisp
-;; Version:     $Id$
 
 ;;
 ;; This code is free software; you can redistribute it and/or modify

File lisp/vm-pine.el

 ;; Status:      Tested with XEmacs 21.4.19 & VM 7.19
 ;; Keywords:    vm draft handling
 ;; X-URL:       http://www.robf.de/Hacking/elisp
-;; Version:     $Id$
 
 ;;
 ;; This code is free software; you can redistribute it and/or modify

File lisp/vm-ps-print.el

 ;; Status:	Tested with XEmacs 21.4.15 & VM 7.18
 ;; Keywords:	extensions, vm, ps-print
 ;; X-URL:       http://www.robf.de/Hacking/elisp
-;; Version:     $Id$
 ;;
 ;; This code is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by

File lisp/vm-reply.el

   (let ((r vm-drop-buffer-name-chars))
     (if (eq r t) (setq r "[^\x0-\x80]"))
     (if (and buffer-name r)
-        (replace-in-string buffer-name r "_" t)
+        (vm-replace-in-string buffer-name r "_" t)
       buffer-name)))
 
 ;;;###autoload

File lisp/vm-rfaddons.el

 ;; Status:      Tested with XEmacs 21.4.19 & VM 7.19
 ;; Keywords:    VM helpers
 ;; X-URL:       http://www.robf.de/Hacking/elisp
-;; Version:     $Id$
 
 ;;
 ;; This code is free software; you can redistribute it and/or modify
 (if vm-xemacs-p (require 'overlay))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-;; GNU Emacs seems to miss some functions
-(if (not (functionp 'replace-in-string))
-    ;; actually this is dired-replace-in-string slightly modified 
-    (defun replace-in-string (string regexp newtext &optional literal)
-      ;; Replace REGEXP with NEWTEXT everywhere in STRING and return result.
-      ;; NEWTEXT is taken literally---no \\DIGIT escapes will be recognized.
-      (let ((result "") (start 0) mb me)
-        (while (string-match regexp string start)
-          (setq mb (match-beginning 0)
-                me (match-end 0)
-                result (concat result (substring string start mb) newtext)
-                start me))
-        (concat result (substring string start)))))
-
-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (defmacro vm-rfaddons-check-option (option option-list &rest body)
   "Evaluate body if option is in OPTION-LIST or OPTION-LIST is nil."
   (list 'if (list 'member option option-list)
     (unless (functionp 'replace-regexp-in-string)
       (defun replace-regexp-in-string (regexp rep string
                                               &optional fixedcase literal)
-        (replace-in-string string regexp rep literal)))
+        (vm-replace-in-string string regexp rep literal)))
     (unless (functionp 'line-end-position)
       (defun line-end-position ()
         (save-excursion (end-of-line) (point))))
       (unless (functionp 'replace-regexp-in-string)
         (defun replace-regexp-in-string (regexp rep string
                                                 &optional fixedcase literal)
-          (replace-in-string string regexp rep literal))))
+          (vm-replace-in-string string regexp rep literal))))
     (require 'longlines)
     (vm-fill-paragraphs-containing-long-lines-by-longlines
      (ad-get-arg 0) (ad-get-arg 1) (ad-get-arg 2)))
   (let ((buffer-read-only nil)
         (real-mime-type (vm-mime-find-type-of-message/external-body layout)))
     (vm-mime-insert-button
-     (replace-in-string
+     (vm-replace-in-string
       (format " external: %s %s"
               (if (vm-mime-get-parameter layout "name")
                   (file-name-nondirectory (vm-mime-get-parameter layout "name"))
                     format)
                 (aset tmplayout 0 (list real-mime-type))
                 (setq format (vm-mime-find-format-for-layout tmplayout))
-                (setq format (replace-in-string format "^%-[0-9]+.[0-9]+"
+                (setq format (vm-replace-in-string format "^%-[0-9]+.[0-9]+"
                                                 "%-15.15" t))
                 (vm-mime-sprintf format tmplayout)))
       "save to a file\\]"
                      basedir))
                (setq basedir (replace-match "" nil nil basedir)))
            
-           (setq subdir (replace-in-string subdir "\\s-\\s-+" " " t))
-           (setq subdir (replace-in-string subdir "[^A-Za-z0-9\241-_-]+" "_" t))
-           (setq subdir (replace-in-string subdir "?_-?_" "-" nil))
-           (setq subdir (replace-in-string subdir "^_+" "" t))
-           (setq subdir (replace-in-string subdir "_+$" "" t))
+           (setq subdir (vm-replace-in-string subdir "\\s-\\s-+" " " t))
+           (setq subdir (vm-replace-in-string subdir "[^A-Za-z0-9\241-_-]+" "_" t))
+           (setq subdir (vm-replace-in-string subdir "?_-?_" "-" nil))
+           (setq subdir (vm-replace-in-string subdir "^_+" "" t))
+           (setq subdir (vm-replace-in-string subdir "_+$" "" t))
            (concat basedir "/" subdir)))
         (t
          (eval vm-mime-auto-save-all-attachments-subdir))))
     (while header-list
       (setq contents (vm-mail-mode-get-header-contents (car header-list)))
       (if (and contents (string-match "@[^,\"]*@" contents))
-          (setq errors (replace-in-string
+          (setq errors (vm-replace-in-string
                         (format "Missing separator in %s \"%s\"!  "
                                 (car header-list)
                                 (match-string 0 contents))
           (insert (read-string "Subject: "))))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
-(defcustom vm-mime-encode-headers-regexp
-  "Subject\\|\\(\\(Resent-\\)?\\(From\\|To\\|CC\\|BCC\\)\\)\\|Organization"
-  "*A regexp matching the headers which should be encoded."
-  :group 'vm-rfaddons
-  :type '(regexp))
-
-(defcustom vm-mime-encode-headers-words-regexp
-  (let ((8bit-word "\\([^ \t\n\r]*[^\x0-\x7f]+[^ \t\n\r]*\\)+"))
-    (concat "\\s-\\(" 8bit-word "\\(\\s-+" 8bit-word "\\)*\\)"))
-  "*A regexp matching a set of consecutive words which must be encoded."
-  :group 'vm-rfaddons
-  :type '(regexp))
-
-;;;###autoload
-(defun vm-mime-encode-headers ()
-  "Encodes the headers of a message.
-
-Only the words containing a non 7bit ASCII char are encoded, but not the whole
-header as this will cause trouble for the recipients and authors headers.
-
-Whitespace between encoded words is trimmed during decoding and thus those
-should be encoded together."
-  (interactive)
-  (save-excursion 
-    (let ((headers (concat "^\\(" vm-mime-encode-headers-regexp "\\):"))
-          bodysep)
-      
-      (goto-char (point-min))
-      (search-forward mail-header-separator)
-      (setq bodysep (vm-marker (match-beginning 0)))
-      (goto-char (point-min))
-      
-      (while (re-search-forward headers bodysep t)
-        (goto-char (match-end 0))
-        (when (not (looking-at "\\s-"))
-          (insert " ")
-          (backward-char 1))
-        (let (hend charset coding q-encoding start end)
-          (save-excursion
-            (setq hend (or (and (re-search-forward "^[^ \t:]+:" bodysep t)
-                                (match-beginning 0))
-                           bodysep)
-                  hend  (vm-marker hend)))
-          ;; search for words containing chars in the upper 8bit range
-          (while
-	      (let ((case-fold-search nil))
-		(re-search-forward vm-mime-encode-headers-words-regexp hend t))
-            (setq start (match-beginning 1)
-                  end   (match-end 1)
-                  charset (or (vm-determine-proper-charset start end)
-                              vm-mime-8bit-composition-charset)
-                  coding (vm-string-assoc charset vm-mime-mule-charset-to-coding-alist)
-                  coding (and coding (cadr coding)))
-            ;; insert end mark 
-            (goto-char end)
-            (insert "?=")
-            ;; encode coding system body
-            (when (and coding (not (eq coding 'no-conversion)))
-              (goto-char end)
-              ;; this is a bug of encode-coding-region, it does not return
-              ;; the right length of the new text, but always 0
-              (let ((old-buffer-size (buffer-size)))
-                (encode-coding-region start end coding)
-                (setq end (+ end (- (buffer-size) old-buffer-size)))))
-            ;; encode unprintable chars in header
-            (vm-mime-Q-encode-region start end)
-            ;; insert start mark
-            (goto-char start)
-            (insert "=?" charset "?Q?")
-            (goto-char end)))))))
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 (defface vm-shrunken-headers-face 
   '((t (:background "gray")))

File lisp/vm-serial.el

 ;; Status:      Tested with XEmacs 21.4.15 & VM 7.19
 ;; Keywords:    sending mail, default mail, multiple recipients, serial mails
 ;; X-URL:       http://www.robf.de/Hacking/elisp
-;; Version:     $Id$
 
 ;;
 ;; This code is free software; you can redistribute it and/or modify

File lisp/vm-summary-faces.el

 ;; Status:      Tested with XEmacs 21.4.15 & VM 7.18
 ;; Keywords:    VM 
 ;; X-URL:       http://www.robf.de/Hacking/elisp
-;; Version:     $Id$
 
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by

File lisp/vm-vars.el

   :group 'vm
   :type 'string)
 
-(defcustom vm-mime-8bit-composition-charset "iso-8859-1"
+(defcustom vm-mime-8bit-composition-charset nil
   "*Character set that VM should assume if it finds non-US-ASCII characters
 in a composition buffer.  Composition buffers are assumed to use
 US-ASCII unless the buffer contains a byte with the high bit set.
 of the buffer to a single MIME character set that can display all
 the buffer's characters."
   :group 'vm
-  :type 'string)
+  :type '(choice (string :tag "iso-8859-1" "iso-8859-1")
+                 (string :tag "iso-2022-jp" "iso-2022-jp")
+                 (string :tag "User defined")
+                 (const  :tag "Auto select" nil)))
 
 (defcustom vm-mime-8bit-text-transfer-encoding 'quoted-printable
   "*Symbol specifying what kind of transfer encoding to use on 8bit
   :group 'vm
   :type '(repeat (cons string string)))
 
+(defcustom vm-mime-encode-headers-regexp
+  "Subject\\|\\(\\(Resent-\\)?\\(From\\|To\\|CC\\|BCC\\)\\)\\|Organization"
+  "*A regexp matching the headers which should be encoded."
+  :group 'vm
+  :type '(regexp))
+
+(defcustom vm-mime-encode-headers-words-regexp
+  (let ((8bit-word "\\([^ \t\n\r]*[^\x0-\x7f]+[^ \t\n\r]*\\)+"))
+    (concat "\\s-\\(" 8bit-word "\\(\\s-+" 8bit-word "\\)*\\)"))
+  "*A regexp matching a set of consecutive words which must be encoded."
+  :group 'vm
+  :type '(regexp))
+
+(defcustom vm-mime-encode-headers-type 'B
+  "*The encoding type to use for encoding headers."
+  :group 'vm
+  :type '(choice (const :tag "QP" 'Q)
+                 (const :tag "BASE64" 'B)
+                 (regexp :tag "BASE64 on match of " "[^- !#-'*+/-9=?A-Z^-~]")))
+
+
+(defcustom vm-mime-encode-words-regexp "[^\x0-\x7f]+"
+  "*A regexp matching a sequence of 8 bit chars."
+  :group 'vm
+  :type '(regexp))
+
 (defcustom vm-mime-max-message-size nil
   "*Largest MIME message that VM should send without fragmentation.
 The value should be an integer which specifies the size in bytes.

File lisp/vm-vcard.el

 ;; Keywords: extensions
 ;; Created: 1997-10-03
 
-;; $Id$
 
 ;; This program is free software; you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 	(vm-load-init-file)
 	(when vm-enable-addons
 	  (vm-rfaddons-infect-vm 0 vm-enable-addons)
-	  (when (or (member 'summary-faces vm-enable-addons)
-		    (eq t vm-enable-addons))
+	  (when (or (eq t vm-enable-addons)
+                    (member 'summary-faces vm-enable-addons))
 	    (require 'vm-summary-faces)
 	    (vm-summary-faces-mode 1)))
 	(if (not vm-window-configuration-file)