Function: mh-store-buffer
mh-store-buffer is an interactive and byte-compiled function defined
in mh-funcs.el.gz.
Signature
(mh-store-buffer DIRECTORY)
Documentation
Unpack buffer created with "uudecode" or "shar".
See mh-store-msg for a description of DIRECTORY.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/mh-e/mh-funcs.el.gz
(defun mh-store-buffer (directory)
"Unpack buffer created with \"uudecode\" or \"shar\".
See `mh-store-msg' for a description of DIRECTORY."
(interactive (list (let ((udir (or mh-store-default-directory
default-directory)))
(read-directory-name "Store buffer in directory: "
udir udir nil))))
(let ((store-directory (expand-file-name directory))
(sh-start (save-excursion
(goto-char (point-min))
(if (re-search-forward
"^#![ \t]*/bin/sh\\|^#\\|^: " nil t)
(progn
;; The "cut here" pattern was removed from above
;; because it seemed to hurt more than help.
;; But keep this to make it easier to put it back.
(if (looking-at "^[^a-z0-9\"]*cut here\\b")
(forward-line 1))
(beginning-of-line)
(if (looking-at "^[#:]....+\n\\( ?\n\\)?end$")
nil ;most likely end of a uuencode
(point))))))
(command "sh")
(uudecode-filename "(unknown filename)")
log-begin)
(if (not sh-start)
(save-excursion
(goto-char (point-min))
(if (re-search-forward "^begin [0-7]+ " nil t)
(setq uudecode-filename
(buffer-substring (point)
(progn (end-of-line) (point)))))))
(with-current-buffer (get-buffer-create mh-log-buffer)
(setq log-begin (mh-truncate-log-buffer))
(if (not (file-directory-p store-directory))
(progn
(insert "mkdir " directory "\n")
(call-process "mkdir" nil mh-log-buffer t store-directory)))
(insert "cd " directory "\n")
(setq mh-store-default-directory directory)
(if (not sh-start)
(progn
(setq command "uudecode")
(insert uudecode-filename " being uudecoded...\n"))))
(set-window-start (display-buffer mh-log-buffer) log-begin) ;watch progress
(let ((default-directory (file-name-as-directory store-directory)))
(if (equal (call-process-region sh-start (point-max) command
nil mh-log-buffer t)
0)
(with-current-buffer mh-log-buffer
(insert "\n(mh-store finished)\n"))
(error "Error occurred during execution of %s" command)))))