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: Thu, 15 Oct 2009 06:00:32 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Glenn Morris <gm>       09/10/15 06:00:30

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

Log message:
        (rmail-cease-edit): Give an error if the end of the headers cannot be
        located.  Simplify, subtracting superflous save-excursions.
        (See 
http://lists.gnu.org/archive/html/bug-gnu-emacs/2009-10/msg00182.html)

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

Patches:
Index: ChangeLog
===================================================================
RCS file: /sources/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.16427
retrieving revision 1.16428
diff -u -b -r1.16427 -r1.16428
--- ChangeLog   15 Oct 2009 01:50:18 -0000      1.16427
+++ ChangeLog   15 Oct 2009 06:00:20 -0000      1.16428
@@ -1,3 +1,9 @@
+2009-10-15  Glenn Morris  <address@hidden>
+
+       * mail/rmailedit.el (rmail-cease-edit): Give an error if the end of
+       the headers cannot be located.  Simplify, subtracting superflous
+       save-excursions.
+
 2009-10-15  Stefan Monnier  <address@hidden>
 
        Replace completion-base-size by completion-base-position to fix bugs

Index: mail/rmailedit.el
===================================================================
RCS file: /sources/emacs/emacs/lisp/mail/rmailedit.el,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -b -r1.62 -r1.63
--- mail/rmailedit.el   6 Oct 2009 02:37:24 -0000       1.62
+++ mail/rmailedit.el   15 Oct 2009 06:00:30 -0000      1.63
@@ -126,19 +126,23 @@
       (with-current-buffer rmail-summary-buffer
        (rmail-summary-enable)))
   (widen)
+  (goto-char (point-min))
+  ;; This is far from ideal.  The edit may have inadvertently
+  ;; removed the blank line at the end of the headers, but there
+  ;; are almost certainly other blank lines.
+  (or (search-forward "\n\n" nil t)
+      (error "There must be a blank line at the end of the headers"))
   ;; Disguise any "From " lines so they don't start a new message.
-  (save-excursion
     (goto-char (point-min))
     (or rmail-old-pruned (forward-line 1))
     (while (re-search-forward "^>*From " nil t)
       (beginning-of-line)
       (insert ">")
-      (forward-line)))
+    (forward-line))
   ;; Make sure buffer ends with a blank line so as not to run this
   ;; message together with the following one.
-  (save-excursion
     (goto-char (point-max))
-    (rmail-ensure-blank-line))
+  (rmail-ensure-blank-line)
   (let ((old rmail-old-text)
        (pruned rmail-old-pruned)
        ;; People who know what they are doing might have modified the
@@ -168,7 +172,6 @@
                 (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))
@@ -204,20 +207,16 @@
            (goto-char mime-end)
            (delete-region mime-beg mime-end)
            (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)
                        (rmail-msgend rmail-current-message))
-      (save-restriction
-       (setq limit
-             (save-excursion
                (goto-char (point-min))
-               ;; FIXME this should not be using NOERROR.
-               (search-forward "\n\n" nil t)))
+      (setq limit (search-forward "\n\n"))
+      (save-restriction
        ;; All 3 of the functions we call below assume the buffer was
        ;; narrowed to just the headers of the message.
-       (narrow-to-region (rmail-msgbeg rmail-current-message) limit)
+       (narrow-to-region (point-min) limit)
        (setq character-coding
              (mail-fetch-field "content-transfer-encoding")
              is-text-message (rmail-is-text-p)
@@ -256,9 +255,8 @@
     ;;??? BROKEN perhaps.
 ;;;    (if (boundp 'rmail-summary-vector)
 ;;;    (aset rmail-summary-vector (1- rmail-current-message) nil))
-    (save-excursion
       (rmail-show-message)
-      (rmail-toggle-header (if pruned 1 0))))
+    (rmail-toggle-header (if pruned 1 0)))
   (run-hooks 'rmail-mode-hook))
 
 (defun rmail-abort-edit ()




reply via email to

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