changeset 68130:dfa5a760e24f

* mh-comp.el (mh-insert-letter): If you choose a different folder, the cur message is used (closes SF #1205890). * mh-mime.el (mh-compose-forward): Use standard range argument instead of messages. Use more powerful mh-read-range instead of read-string. Sync docstring with manual (close SF #1205890).
author Bill Wohler <wohler@newt.com>
date Wed, 11 Jan 2006 07:46:57 +0000
parents 6f5da26b0df1
children b9b10fe7c97a
files lisp/mh-e/ChangeLog lisp/mh-e/mh-comp.el lisp/mh-e/mh-mime.el
diffstat 3 files changed, 54 insertions(+), 42 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/mh-e/ChangeLog	Wed Jan 11 02:03:24 2006 +0000
+++ b/lisp/mh-e/ChangeLog	Wed Jan 11 07:46:57 2006 +0000
@@ -1,5 +1,12 @@
 2006-01-10  Bill Wohler  <wohler@newt.com>
 
+	* mh-comp.el (mh-insert-letter): If you choose a different folder,
+	the cur message is used (closes SF #1205890).
+
+	* mh-mime.el (mh-compose-forward): Use standard range argument
+	instead of messages. Use more powerful mh-read-range instead of
+	read-string. Sync docstring with manual (close SF #1205890).
+
 	* mh-index.el (mh-index-search): Checking mh-find-path-run is
 	unnecessary.
 	(mh-index-next-folder): Don't back up a line when going backwards
--- a/lisp/mh-e/mh-comp.el	Wed Jan 11 02:03:24 2006 +0000
+++ b/lisp/mh-e/mh-comp.el	Wed Jan 11 07:46:57 2006 +0000
@@ -1514,23 +1514,33 @@
 (defun mh-insert-letter (folder message verbatim)
   "Insert a message.
 
-This command prompts you for the FOLDER and MESSAGE number and inserts
+This command prompts you for the FOLDER and MESSAGE number, which
+defaults to the current message in that folder. It then inserts
 the message, indented by `mh-ins-buf-prefix' (\"> \") unless
-`mh-yank-behavior' is set to one of the supercite flavors in which
-case supercite is used to format the message. Certain undesirable
-header fields (see `mh-invisible-header-fields-compiled') are removed
-before insertion.
+`mh-yank-behavior' is set to one of the supercite flavors in
+which case supercite is used to format the message. Certain
+undesirable header fields (see
+`mh-invisible-header-fields-compiled') are removed before
+insertion.
 
 If given a prefix argument VERBATIM, the header is left intact, the
 message is not indented, and \"> \" is not inserted before each line.
 This command leaves the mark before the letter and point after it."
   (interactive
-   (list (mh-prompt-for-folder "Message from" mh-sent-from-folder nil)
-         (read-string (concat "Message number"
-                              (if (numberp mh-sent-from-msg)
-                                  (format " (default %d): " mh-sent-from-msg)
-                                ": ")))
-         current-prefix-arg))
+   (let* ((folder
+           (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
+              (nth 0 (mh-translate-range folder "cur"))))
+          (message
+           (read-string (concat "Message number"
+                                (or (and default
+                                         (format " (default %d): " default))
+                                    ": ")))))
+     (list folder message current-prefix-arg)))
   (save-restriction
     (narrow-to-region (point) (point))
     (let ((start (point-min)))
--- a/lisp/mh-e/mh-mime.el	Wed Jan 11 02:03:24 2006 +0000
+++ b/lisp/mh-e/mh-mime.el	Wed Jan 11 07:46:57 2006 +0000
@@ -73,41 +73,36 @@
     (call-interactively 'mh-mh-attach-file)))
 
 ;;;###mh-autoload
-(defun mh-compose-forward (&optional description folder messages)
+(defun mh-compose-forward (&optional description folder range)
   "Add tag to forward a message.
 
 You are prompted for a content DESCRIPTION, the name of the
-FOLDER in which the messages to forward are located, and the
-MESSAGES' numbers.
+FOLDER in which the messages to forward are located, and a RANGE
+of messages, which defaults to the current message in that
+folder. Check the documentation of `mh-interactive-range' to see
+how RANGE is read in interactive use.
 
 The option `mh-compose-insertion' controls what type of tags are inserted."
-  (interactive (let*
-                   ((description (mml-minibuffer-read-description))
-                    (folder (mh-prompt-for-folder "Message from"
-                                                  mh-sent-from-folder nil))
-                    (messages (let ((default-message
-                                      (if (and (equal
-                                                folder mh-sent-from-folder)
-                                               (numberp mh-sent-from-msg))
-                                          mh-sent-from-msg
-                                        (nth 0 (mh-translate-range
-                                                folder "cur")))))
-                                (if default-message
-                                    (read-string
-                                     (format "Messages (default %d): "
-                                             default-message)
-                                     nil nil
-                                     (number-to-string default-message))
-                                  (read-string (format "Messages: "))))))
-                 (list description folder messages)))
-  (let
-      ((range))
-    (if (null messages)
-        (setq messages ""))
-    (setq range (mh-translate-range folder messages))
-    (if (null range)
-        (error "No messages in specified range"))
-    (dolist (message range)
+  (interactive
+   (let* ((description
+           (mml-minibuffer-read-description))
+          (folder
+           (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
+              (nth 0 (mh-translate-range folder "cur"))))
+          (range
+           (mh-read-range "Forward" folder
+                          (or (and default
+                                   (number-to-string default))
+                              t)
+                          t t)))
+     (list description folder range)))
+  (let ((messages (mapconcat 'identity (mh-list-to-string range) " ")))
+    (dolist (message (mh-translate-range folder messages))
       (if (equal mh-compose-insertion 'mml)
           (mh-mml-forward-message description folder (format "%s" message))
         (mh-mh-forward-message description folder (format "%s" message))))))
@@ -134,7 +129,7 @@
   "Regexp matching valid media types used in MIME attachment compositions.")
 
 (defvar mh-have-file-command 'undefined
-  "Cached value of `mh-have-file-command'.
+  "Cached value of function `mh-have-file-command'.
 Do not reference this variable directly as it might not have been
 initialized. Always use the command `mh-have-file-command'.")