Function: mh-mime-save-parts

mh-mime-save-parts is an autoloaded, interactive and byte-compiled function defined in mh-mime.el.gz.

Signature

(mh-mime-save-parts PROMPT)

Documentation

Save attachments.

You can save all of the attachments at once with this command. The attachments are saved in the directory specified by the option mh-mime-save-parts-default-directory unless you use a prefix argument PROMPT in which case you are prompted for the directory. These directories may be superseded by MH profile components, since this function calls on "mhstore" ("mhn") to do the work.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-mime.el.gz
;;;###mh-autoload
(defun mh-mime-save-parts (prompt)
  "Save attachments.

You can save all of the attachments at once with this command.
The attachments are saved in the directory specified by the
option `mh-mime-save-parts-default-directory' unless you use a
prefix argument PROMPT in which case you are prompted for the
directory. These directories may be superseded by MH profile
components, since this function calls on \"mhstore\" (\"mhn\") to
do the work."
  (interactive "P")
  (let ((msg (if (eq major-mode 'mh-show-mode)
                 (mh-show-buffer-message-number)
               (mh-get-msg-num t)))
        (folder (if (eq major-mode 'mh-show-mode)
                    mh-show-folder-buffer
                  mh-current-folder))
        (command (if (mh-variant-p 'nmh) "mhstore" "mhn"))
        (directory
         (cond
          ((and (or prompt
                    (equal nil mh-mime-save-parts-default-directory)
                    (equal t mh-mime-save-parts-default-directory))
                (not mh-mime-save-parts-directory))
           (read-directory-name "Store in directory: " nil nil t))
          ((and (or prompt
                    (equal t mh-mime-save-parts-default-directory))
                mh-mime-save-parts-directory)
           (read-directory-name "Store in directory: "
                                mh-mime-save-parts-directory nil t))
          ((stringp mh-mime-save-parts-default-directory)
           mh-mime-save-parts-default-directory)
          (t
           mh-mime-save-parts-directory))))
    (if (and (equal directory "") mh-mime-save-parts-directory)
        (setq directory mh-mime-save-parts-directory))
    (if (not (file-directory-p directory))
        (message "No directory specified")
      (if (equal nil mh-mime-save-parts-default-directory)
          (setq mh-mime-save-parts-directory directory))
      (with-current-buffer (get-buffer-create mh-log-buffer)
        (let (default-directory)
          (cd directory)
          (setq mh-mime-save-parts-directory directory)
          (let ((initial-size (mh-truncate-log-buffer)))
            (apply #'call-process
                   (expand-file-name command mh-progs) nil t nil
                   (mh-list-to-string (list folder msg "-auto"
                                            (if (not (mh-variant-p 'nmh))
                                                "-store"))))
            (if (> (buffer-size) initial-size)
                (save-window-excursion
                  (switch-to-buffer-other-window mh-log-buffer)
                  (sit-for 3)))))))))