Mercurial > emacs
changeset 2349:7ae960b9e275
(mh-unshar) Added.
author | Eric S. Raymond <esr@snark.thyrsus.com> |
---|---|
date | Thu, 25 Mar 1993 01:49:59 +0000 |
parents | 581cda633215 |
children | 368fe26e6f33 |
files | lisp/=mh-e.el |
diffstat | 1 files changed, 47 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/=mh-e.el Thu Mar 25 01:47:39 1993 +0000 +++ b/lisp/=mh-e.el Thu Mar 25 01:49:59 1993 +0000 @@ -2740,6 +2740,52 @@ (if (re-search-forward "^$\\|^-+$" nil nil) (forward-line arg))) + +(defun mh-unshar (dir) + "Unshar the current message in the directory given by DIR." + (interactive "DUnshar in directory: ") + (let ((default-directory default-directory) + (errbuf " *Unshar Output*") + (curbuf (current-buffer)) + (show-buffer mh-show-buffer) + start + ) + (setq dir (expand-file-name dir)) + (if (not (eq system-type 'vax-vms)) + (setq dir (file-name-as-directory dir))) + (mh-show nil) ;;; force showing of current message + (save-excursion + (set-buffer show-buffer) + (goto-char (point-min)) + (message "Looking for start of shar package ...") + (if (or (re-search-forward "^#![ \t]*/bin/sh" nil t) + (and (re-search-forward "^[^a-z0-9\"]*cut here" nil t) + (forward-line 1)) + (re-search-forward "^#" nil t) + (re-search-forward "^: " nil t) + ) + (progn + (beginning-of-line) + (setq start (point)) + (set-buffer curbuf) + (pop-to-buffer errbuf) + (kill-region (point-max) (point-min)) + (insert (format "Unsharing in directory \"%s\" ...\n\n" dir)) + (message "Please wait ...") + (sit-for 0) + (set-buffer show-buffer) + (setq default-directory dir) + (call-process-region start (point-max) + "/bin/sh" nil errbuf t) + (pop-to-buffer curbuf) + (message "Unshar done") + ) + (error "Can't find start of shar file") + ) + ) + ) + ) + ;;; Build the folder-mode keymap: @@ -2762,6 +2808,7 @@ (define-key mh-folder-mode-map "\ef" 'mh-visit-folder) (define-key mh-folder-mode-map "\ek" 'mh-kill-folder) (define-key mh-folder-mode-map "\el" 'mh-list-folders) +(define-key mh-folder-mode-map "\en" 'mh-unshar) (define-key mh-folder-mode-map "\eo" 'mh-write-msg-to-file) (define-key mh-folder-mode-map "\ep" 'mh-pack-folder) (define-key mh-folder-mode-map "\es" 'mh-search-folder)