I was wrong. The mail I sent had a bad MIME encoded subject header,
which is done by VM. It is not VM's fault, however.
The incorrect header was caused by the following expressions in vm-
rfaddons.el: vm-mime-encode-headers
(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)))))
I was using emacs 23.0.60, and that bug of encoding-coding-region
seemed to be fixed. As a result, the var "end" was greater than it
should have been. In my case of testing, the region between "start"
and "end" was including the end mark "?=" and part of the following
line. Then, the end mark "?=" was eaten by vm-mime-Q-encode-region.
Now, I have changed the code to be:
(when (and coding (not (eq coding 'no-conversion)))
(encode-coding-region start end coding))
and things are fine.
Hi Yuning,
thanks for reporting this and debugging it.
I wonder if it also works if the code is changed as seen below?
The difference is, that the end is now a marker which should move
automatically with deletion or insertion ...
Bye,
Robert.
=== modified file 'lisp/vm-rfaddons.el'
--- lisp/vm-rfaddons.el 2008-04-07 18:54:02 +0000
+++ lisp/vm-rfaddons.el 2008-06-05 20:33:21 +0000
@@ -1445,7 +1445,7 @@
(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)
+ end (vm-marker (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)
@@ -1455,12 +1455,7 @@
(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-coding-region start end coding))
;; encode unprintable chars in header
(vm-mime-Q-encode-region start end)
;; insert start mark