Function: mh-bare-components

mh-bare-components is a byte-compiled function defined in mh-comp.el.gz.

Signature

(mh-bare-components FORMFILE)

Documentation

Generate a temporary, clean components file from FORMFILE.

Return the path to the temporary file.

Source Code

;; Defined in /usr/src/emacs/lisp/mh-e/mh-comp.el.gz
(defun mh-bare-components (formfile)
  "Generate a temporary, clean components file from FORMFILE.
Return the path to the temporary file."
  ;; Let comp(1) create the skeleton for us. This is particularly
  ;; important with nmh-1.5, because its default "components" needs
  ;; some processing before it can be used. Unfortunately, comp(1)
  ;; didn't have a -build option until later versions of nmh. So, to
  ;; avoid the possibility of clobbering an existing draft, create
  ;; a temporary directory and use it as the drafts folder. Then
  ;; copy the skeleton to a regular temp file, and return the
  ;; regular temp file.
  (let (new
        (temp-folder (make-temp-file
                      (concat mh-user-path "draftfolder.") t)))
    (mh-exec-cmd "comp" "-nowhatnowproc"
                 "-draftfolder" (format "+%s"
                                        (file-name-nondirectory temp-folder))
                 (if (stringp formfile)
                     (list "-form" formfile)))
    (setq new (make-temp-file "comp."))
    (rename-file (concat temp-folder "/" "1") new t)
    ;; The temp folder could contain various metadata files.  Rather
    ;; than trying to enumerate all the known files, just do a
    ;; recursive delete on the directory.
    (delete-directory temp-folder t)
    new))