Function: gnus-uu-unshar-article

gnus-uu-unshar-article is a byte-compiled function defined in gnus-uu.el.gz.

Signature

(gnus-uu-unshar-article PROCESS-BUFFER IN-STATE)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-uu.el.gz
;; This function is used by `gnus-uu-grab-articles' to treat
;; a shared article.
(defun gnus-uu-unshar-article (process-buffer _in-state)
  (let ((state (list 'ok))
	start-char)
    (with-current-buffer process-buffer
      (goto-char (point-min))
      (if (not (re-search-forward gnus-uu-shar-begin-string nil t))
	  (setq state (list 'wrong-type))
	(save-window-excursion
	  (save-excursion
	    (switch-to-buffer (current-buffer))
	    (delete-other-windows)
            (let ((buffer (generate-new-buffer "*Warning*")))
	      (unless
		  (unwind-protect
		      (with-current-buffer buffer
			(insert (substitute-command-keys
				 gnus-uu-unshar-warning))
			(goto-char (point-min))
			(display-buffer buffer)
                        (yes-or-no-p "This is a shell archive, unshar it?"))
		    (kill-buffer buffer))
		(setq state (list 'error))))))
	(unless (memq 'error state)
	  (beginning-of-line)
	  (setq start-char (point))
	  (call-process-region
	   start-char (point-max) shell-file-name nil
	   (gnus-get-buffer-create gnus-uu-output-buffer-name) nil
	   shell-command-switch
	   (concat "cd " gnus-uu-work-dir " "
		   gnus-shell-command-separator  " sh")))))
    state))