Function: archive-rar-summarize

archive-rar-summarize is a byte-compiled function defined in arc-mode.el.gz.

Signature

(archive-rar-summarize &optional FILE)

Source Code

;; Defined in /usr/src/emacs/lisp/arc-mode.el.gz
;; -------------------------------------------------------------------------
;;; Section: Rar Archives

(defun archive-rar-summarize (&optional file)
  ;; File is used internally for `archive-rar-exe-summarize'.
  (unless file (setq file buffer-file-name))
  (let* ((copy (file-local-copy file))
         (files ()))
    (with-temp-buffer
      (unwind-protect
          (call-process "lsar" nil t nil "-l" (or file copy))
        (if copy (delete-file copy)))
      (goto-char (point-min))
      (re-search-forward "^\\(?:\s+=+\\)+\s*\n")
      (while (looking-at (concat "^\s+[0-9.]+\s+D?-+\s+"   ; Flags
                                 "\\([0-9-]+\\)\s+"        ; Size
                                 "\\([-0-9.]+\\)%?\s+"      ; Ratio
                                 "\\([0-9a-zA-Z]+\\)\s+"   ; Mode
                                 "\\([0-9-]+\\)\s+"        ; Date
                                 "\\([0-9:]+\\)\s+"        ; Time
                                 "\\(.*\\)\n"              ; Name
                                 ))
        (goto-char (match-end 0))
        (let ((name (match-string 6))
              (size (match-string 1)))
          (push (archive--file-desc name name nil
                                    ;; Size
                                    (string-to-number size)
                                    ;; Date&Time.
                                    (concat (match-string 4) " " (match-string 5))
                                    :ratio (match-string 2))
                files))))
    (archive--summarize-descs (nreverse files))))