Fix.
[elisp/semi.git] / mime-partial.el
index e085eab..2243882 100644 (file)
 
 (defun mime-combine-message/partial-pieces-automatically (entity situation)
   "Internal method for mime-view to combine message/partial messages
-automatically.  This function refers variable
-`mime-request-partial-message-method-alist' to select function to display
-partial messages using mime-view."
+automatically."
   (interactive)
   (let* ((id (cdr (assoc "id" situation)))
         (target (cdr (assq 'major-mode situation)))
         (subject-buf (eval (cdr (assq 'summary-buffer-exp situation))))
+        (mother (current-buffer))
         subject-id
         (root-dir (expand-file-name
                    (concat "m-prts-" (user-login-name))
@@ -48,18 +47,15 @@ partial messages using mime-view."
     (setq full-file (concat root-dir "/FULL"))
     
     (if (null target)
-       (error "%s is not supported. Sorry." target)
-      )
+       (error "%s is not supported. Sorry." target))
     
     ;; if you can't parse the subject line, try simple decoding method
     (if (or (file-exists-p full-file)
-           (not (y-or-n-p "Merge partials?"))
-           )
+           (not (y-or-n-p "Merge partials?")))
        (mime-store-message/partial-piece entity situation)
-      (setq subject-id (mime-read-field 'Subject entity))
+      (setq subject-id (mime-entity-read-field entity 'Subject))
       (if (string-match "[0-9\n]+" subject-id)
-         (setq subject-id (substring subject-id 0 (match-beginning 0)))
-       )
+         (setq subject-id (substring subject-id 0 (match-beginning 0))))
       (save-excursion
        (set-buffer subject-buf)
        (while (search-backward subject-id nil t))
@@ -68,26 +64,18 @@ partial messages using mime-view."
            (let* ((message
                    ;; request message at the cursor in Subject buffer.
                    (save-window-excursion
-                     (funcall request-partial-message-method)
-                     ))
+                     (funcall request-partial-message-method)))
                   (situation (mime-entity-situation message))
                   (the-id (cdr (assoc "id" situation))))
              (when (string= the-id id)
-               (save-excursion
-                 (set-buffer (mime-entity-buffer message))
-                 (mime-store-message/partial-piece message situation)
-                 )
+               (with-current-buffer mother
+                 (mime-store-message/partial-piece message situation))
                (if (file-exists-p full-file)
-                   (throw 'tag nil)
-                 ))
+                   (throw 'tag nil)))
              (if (not (progn
                         (end-of-line)
-                        (search-forward subject-id nil t)
-                        ))
-                 (error "not found")
-               )
-             ))
-         )))))
+                        (search-forward subject-id nil t)))
+                 (error "not found")))))))))
 
 
 ;;; @ end