changeset 106563:b07b0e49769d

(report-emacs-bug): In message-mode, sort manually before storing original report text. (Bug#5178) Remove superfluous save-excursion.
author Glenn Morris <rgm@gnu.org>
date Sun, 13 Dec 2009 23:43:17 +0000
parents 0d89cb5de442
children fea46c7aca79
files lisp/ChangeLog lisp/mail/emacsbug.el
diffstat 2 files changed, 17 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Sun Dec 13 19:14:28 2009 +0000
+++ b/lisp/ChangeLog	Sun Dec 13 23:43:17 2009 +0000
@@ -1,3 +1,9 @@
+2009-12-13  Glenn Morris  <rgm@gnu.org>
+
+	* mail/emacsbug.el (report-emacs-bug): In message-mode, sort manually
+	before storing original report text.  (Bug#5178)
+	Remove superfluous save-excursion.
+
 2009-12-12  Michael Albinus  <michael.albinus@gmx.de>
 
 	* net/dbus.el (dbus-property-handler): Filter lambda forms out
--- a/lisp/mail/emacsbug.el	Sun Dec 13 19:14:28 2009 +0000
+++ b/lisp/mail/emacsbug.el	Sun Dec 13 23:43:17 2009 +0000
@@ -106,11 +106,14 @@
 	  (with-current-buffer (get-buffer-create "*Messages*")
 	    (point-max-marker)))
     (compose-mail reporting-address topic)
-    ;; The rest of this does not execute
-    ;; if the user was asked to confirm and said no.
+    ;; The rest of this does not execute if the user was asked to
+    ;; confirm and said no.
+    ;; Message-mode sorts the headers before sending.  We sort now so
+    ;; that report-emacs-bug-orig-text remains valid.  (Bug#5178)
+    (if (eq major-mode 'message-mode)
+        (message-sort-headers))
     (rfc822-goto-eoh)
     (forward-line 1)
-
     (let ((signature (buffer-substring (point) (point-max))))
       (delete-region (point) (point-max))
       (insert signature)
@@ -262,12 +265,11 @@
     ;; Make it less likely people will send empty messages.
     (if report-emacs-bug-send-hook
         (add-hook report-emacs-bug-send-hook 'report-emacs-bug-hook nil t))
-    (save-excursion
-      (goto-char (point-max))
-      (skip-chars-backward " \t\n")
-      (make-local-variable 'report-emacs-bug-orig-text)
-      (setq report-emacs-bug-orig-text
-            (buffer-substring-no-properties (point-min) (point))))
+    (goto-char (point-max))
+    (skip-chars-backward " \t\n")
+    (make-local-variable 'report-emacs-bug-orig-text)
+    (setq report-emacs-bug-orig-text
+          (buffer-substring-no-properties (point-min) (point)))
     (goto-char user-point)))
 
 (defun report-emacs-bug-info ()