emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs/lisp ChangeLog mail/rmailedit.el


From: Glenn Morris
Subject: [Emacs-diffs] emacs/lisp ChangeLog mail/rmailedit.el
Date: Tue, 06 Oct 2009 02:37:25 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Glenn Morris <gm>       09/10/06 02:37:25

Modified files:
        lisp           : ChangeLog 
        lisp/mail      : rmailedit.el 

Log message:
        (rmail-cease-edit): If there is a Content-Type header we don't
        understand, don't insert another.  (Bug#4624)
        If changing mime charset, insert the new one in the right place.

CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/ChangeLog?cvsroot=emacs&r1=1.16368&r2=1.16369
http://cvs.savannah.gnu.org/viewcvs/emacs/lisp/mail/rmailedit.el?cvsroot=emacs&r1=1.61&r2=1.62

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16368
retrieving revision 1.16369
diff -u -b -r1.16368 -r1.16369
--- ChangeLog   6 Oct 2009 02:36:35 -0000       1.16368
+++ ChangeLog   6 Oct 2009 02:37:22 -0000       1.16369
@@ -1,3 +1,9 @@
+2009-10-06  Glenn Morris  <address@hidden>
+
+       * mail/rmailedit.el (rmail-cease-edit): If there is a Content-Type
+       header we don't understand, don't insert another.  (Bug#4624)
+       If changing mime charset, insert the new one in the right place.
+
 2009-10-06  Matthew Junker  <address@hidden>  (tiny change)
 
        * calendar/cal-tex.el (cal-tex-cursor-month-landscape)

Index: mail/rmailedit.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/mail/rmailedit.el,v
retrieving revision 1.61
retrieving revision 1.62
diff -u -b -r1.61 -r1.62
--- mail/rmailedit.el   10 Sep 2009 06:18:23 -0000      1.61
+++ mail/rmailedit.el   6 Oct 2009 02:37:24 -0000       1.62
@@ -168,35 +168,43 @@
                 (string= old (buffer-substring (point-min) (point-max))))
       (setq old nil)
       (goto-char (point-min))
+      ;; FIXME the edit may have inadvertently removed this.
+      (search-forward "\n\n")
+      (setq headers-end (point-marker))
+      (goto-char (point-min))
+      (save-restriction
+       (narrow-to-region (point) headers-end)
       ;; If they changed the message's encoding, rewrite the charset=
       ;; header for them, so that subsequent rmail-show-message
       ;; decodes it correctly.
-      (let ((buffer-read-only nil)
+       (let* ((buffer-read-only nil)
            (new-coding (coding-system-base edited-coding))
-           old-coding mime-charset mime-beg mime-end)
-       (when (re-search-forward rmail-mime-charset-pattern
-                                (1- (save-excursion (search-forward "\n\n")))
-                                'move)
-           (setq mime-beg (match-beginning 1)
-                 mime-end (match-end 1)
-                 old-coding (coding-system-from-name (match-string 1))))
-       (setq mime-charset
-             (symbol-name
+              (mime-charset (symbol-name
               (or (coding-system-get new-coding :mime-charset)
-                  (if (coding-system-equal new-coding 'undecided)
+                                 (if (coding-system-equal new-coding
+                                                          'undecided)
                       'us-ascii
                     new-coding))))
+              old-coding mime-beg mime-end content-type)
+         (if (re-search-forward rmail-mime-charset-pattern nil 'move)
+             (setq mime-beg (match-beginning 1)
+                   mime-end (match-end 1)
+                   old-coding (coding-system-from-name (match-string 1)))
+           (setq content-type (mail-fetch-field "Content-Type")))
        (cond
+          ;; No match for rmail-mime-charset-pattern, but there was some
+          ;; other Content-Type.  We should not insert another.  (Bug#4624)
+          (content-type)
         ((null old-coding)
          ;; If there was no charset= spec, insert one.
+           (backward-char 1)
          (insert "Content-type: text/plain; charset=" mime-charset "\n"))
         ((not (coding-system-equal (coding-system-base old-coding)
                                    new-coding))
+           (goto-char mime-end)
          (delete-region mime-beg mime-end)
-         (insert mime-charset))))
-      (goto-char (point-min))
-      (search-forward "\n\n")
-      (setq headers-end (point))
+           (insert mime-charset)))))
+      (goto-char headers-end)
       (setq new-headers (rmail-edit-headers-alist t))
       (rmail-swap-buffers-maybe)
       (narrow-to-region (rmail-msgbeg rmail-current-message)
@@ -205,6 +213,7 @@
        (setq limit
              (save-excursion
                (goto-char (point-min))
+               ;; FIXME this should not be using NOERROR.
                (search-forward "\n\n" nil t)))
        ;; All 3 of the functions we call below assume the buffer was
        ;; narrowed to just the headers of the message.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]