changeset 70169:10be49d855c4

(mh-insert-letter): If a message number isn't given, throw an error rather than using a potentially incorrect message number (closes SF #1473729). In addition, use the cur message if mh-sent-from-msg is nil (when sending a message, in contrast to replying). Move conversion of int to string into interactive stanza so body can assume variables are of proper type.
author Bill Wohler <wohler@newt.com>
date Fri, 21 Apr 2006 17:49:02 +0000
parents 60bff6b0c656
children de6c9508749d
files lisp/mh-e/ChangeLog lisp/mh-e/mh-letter.el
diffstat 2 files changed, 20 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mh-e/ChangeLog	Fri Apr 21 14:07:05 2006 +0000
+++ b/lisp/mh-e/ChangeLog	Fri Apr 21 17:49:02 2006 +0000
@@ -1,3 +1,13 @@
+2006-04-21  Bill Wohler  <wohler@newt.com>
+
+	* mh-letter.el (mh-insert-letter): If a message number isn't
+	given, throw an error rather than using a potentially incorrect
+	message number (closes SF #1473729). In addition, use the cur
+	message if mh-sent-from-msg is nil (when sending a message, in
+	contrast to replying). Move conversion of int to string into
+	interactive stanza so body can assume variables are of proper
+	type.
+
 2006-04-20  Bill Wohler  <wohler@newt.com>
 
 	* mh-tool-bar.el (image-load-path): Define to shush compiler.
--- a/lisp/mh-e/mh-letter.el	Fri Apr 21 14:07:05 2006 +0000
+++ b/lisp/mh-e/mh-letter.el	Fri Apr 21 17:49:02 2006 +0000
@@ -393,24 +393,26 @@
 This command leaves the mark before the letter and point after it."
   (interactive
    (let* ((folder
-           (mh-prompt-for-folder "Message from"
-                                 mh-sent-from-folder nil))
+           (mh-prompt-for-folder "Message from" mh-sent-from-folder nil))
           (default
-            (if (and (equal folder mh-sent-from-folder)
-                     (numberp mh-sent-from-msg))
-                mh-sent-from-msg
+            (if (equal folder mh-sent-from-folder)
+                (or mh-sent-from-msg (nth 0 (mh-translate-range folder "cur")))
               (nth 0 (mh-translate-range folder "cur"))))
           (message
            (read-string (concat "Message number"
                                 (or (and default
                                          (format " (default %d): " default))
-                                    ": ")))))
+                                    ": "))
+                        nil nil
+                        (if (numberp default)
+                            (int-to-string default)
+                          default))))
      (list folder message current-prefix-arg)))
+  (if (equal message "")
+      (error "No message number given"))
   (save-restriction
     (narrow-to-region (point) (point))
     (let ((start (point-min)))
-      (if (and (equal message "") (numberp mh-sent-from-msg))
-          (setq message (int-to-string mh-sent-from-msg)))
       (insert-file-contents
        (expand-file-name message (mh-expand-file-name folder)))
       (when (not verbatim)