]> code.delx.au - gnu-emacs/commitdiff
(mh-insert-letter): If a message number isn't given, throw an error
authorBill Wohler <wohler@newt.com>
Fri, 21 Apr 2006 17:49:02 +0000 (17:49 +0000)
committerBill Wohler <wohler@newt.com>
Fri, 21 Apr 2006 17:49:02 +0000 (17:49 +0000)
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.

lisp/mh-e/ChangeLog
lisp/mh-e/mh-letter.el

index 89ca1dc04aacd2de4de6bc9f240a7bcd44bd8692..0a7c11e00a56d199e56644b24afa3357c6e291ef 100644 (file)
@@ -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.
index 9445b5ea41ffe6fc0174aab72cacfac00fc4f9c3..37cc8fcf31e86da4b3a5425cf3cef78b6c56dd93 100644 (file)
@@ -393,24 +393,26 @@ message is not indented, and \"> \" is not inserted before each line.
 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)