emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 25979c8 1/2: Use unar and lsar to handle RAR archiv


From: Nicolas Petton
Subject: [Emacs-diffs] master 25979c8 1/2: Use unar and lsar to handle RAR archives in arc-mode
Date: Wed, 30 Sep 2015 08:13:37 +0000

branch: master
commit 25979c8e35e0f4fdb21b873b6976177df0b02e02
Author: Nicolas Petton <address@hidden>
Commit: Nicolas Petton <address@hidden>

    Use unar and lsar to handle RAR archives in arc-mode
    
    * lisp/arc-mode.el (archive-rar-extract, archive-extract-by-file): Rely
    on unar and lsar instead of unrar-free for RAR archives (Bug#17663).
---
 lisp/arc-mode.el |   31 +++++++++++++++----------------
 1 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el
index f852f2d..7d2cab3 100644
--- a/lisp/arc-mode.el
+++ b/lisp/arc-mode.el
@@ -1162,7 +1162,7 @@ using `make-temp-file', and the generated name is 
returned."
                   nil
                   `(:file ,stdout-file)
                   nil
-                  (append (cdr command) (list archive name dest)))
+                   `(,archive ,name ,@(cdr command) ,dest))
          (with-temp-buffer
            (insert-file-contents stdout-file)
            (goto-char (point-min))
@@ -2038,27 +2038,26 @@ This doesn't recover lost files, it just undoes changes 
in the buffer itself."
          (maxsize 5)
          (files ()))
     (with-temp-buffer
-      (call-process "unrar-free" nil t nil "--list" (or file copy))
+      (call-process "lsar" nil t nil "-l" (or file copy))
       (if copy (delete-file copy))
       (goto-char (point-min))
-      (re-search-forward "^-+\n")
-      (while (looking-at (concat " \\(.*\\)\n" ;Name.
-                                 ;; Size ; Packed.
-                                 " +\\([0-9]+\\) +[0-9]+"
-                                 ;; Ratio ; Date'
-                                 " +\\([0-9%]+\\) +\\([-0-9]+\\)"
-                                 ;; Time ; Attr.
-                                 " +\\([0-9:]+\\) +[^ \n]\\{6,10\\}"
-                                 ;; CRC; Meth ; Var.
-                                 " +[0-9A-F]+ +[^ \n]+ +[0-9.]+\n"))
+      (re-search-forward "^\\(\s+=+\s?+\\)+\n")
+      (while (looking-at (concat "^\s+[0-9.]+\s+-+\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 1))
-              (size (match-string 2)))
+        (let ((name (match-string 6))
+              (size (match-string 1)))
           (if (> (length name) maxname) (setq maxname (length name)))
           (if (> (length size) maxsize) (setq maxsize (length size)))
           (push (vector name name nil nil
                         ;; Size, Ratio.
-                        size (match-string 3)
+                        size (match-string 2)
                         ;; Date, Time.
                         (match-string 4) (match-string 5))
                 files))))
@@ -2091,7 +2090,7 @@ This doesn't recover lost files, it just undoes changes 
in the buffer itself."
       ;; The code below assumes the name is relative and may do undesirable
       ;; things otherwise.
       (error "Can't extract files with non-relative names")
-    (archive-extract-by-file archive name '("unrar-free" "--extract") "All 
OK")))
+    (archive-extract-by-file archive name `("unar" "-no-directory" "-o") 
"Successfully extracted")))
 
 ;;; Section: Rar self-extracting .exe archives.
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]