Function: gnus-uu-treat-archive

gnus-uu-treat-archive is a byte-compiled function defined in gnus-uu.el.gz.

Signature

(gnus-uu-treat-archive FILE-PATH)

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-uu.el.gz
(defun gnus-uu-treat-archive (file-path)
  ;; Unpacks an archive.  Returns t if unpacking is successful.
  (let ((did-unpack t)
	action command dir)
    (setq action (gnus-uu-choose-action
		  file-path (append gnus-uu-user-archive-rules
				    (if gnus-uu-ignore-default-archive-rules
					nil
				      gnus-uu-default-archive-rules))))

    (when (not action)
      (error "No unpackers for the file %s" file-path))

    (string-match "/[^/]*$" file-path)
    (setq dir (substring file-path 0 (match-beginning 0)))

    (when (member action gnus-uu-destructive-archivers)
      (copy-file file-path (concat file-path "~") t))

    (setq command (format "cd %s ; %s" dir (gnus-uu-command action file-path)))

    (with-current-buffer (gnus-get-buffer-create gnus-uu-output-buffer-name)
      (erase-buffer))

    (gnus-message 5 "Unpacking: %s..." (gnus-uu-command action file-path))

    (if (eq 0 (call-process shell-file-name nil
			   (gnus-get-buffer-create gnus-uu-output-buffer-name)
			   nil shell-command-switch command))
	(message "")
      (gnus-message 2 "Error during unpacking of archive")
      (setq did-unpack nil))

    (when (member action gnus-uu-destructive-archivers)
      (rename-file (concat file-path "~") file-path t))

    did-unpack))