diff options
| author | Nicolas Petton | 2015-09-30 10:04:09 +0200 |
|---|---|---|
| committer | Nicolas Petton | 2015-09-30 10:13:26 +0200 |
| commit | 25979c8e35e0f4fdb21b873b6976177df0b02e02 (patch) | |
| tree | b3dbde8cf5e21c45cb4992b43b7457f273aca01a | |
| parent | 9a241ddfff0ad51782b8ea2e45042c6e941e2a95 (diff) | |
| download | emacs-25979c8e35e0f4fdb21b873b6976177df0b02e02.tar.gz emacs-25979c8e35e0f4fdb21b873b6976177df0b02e02.zip | |
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).
| -rw-r--r-- | 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 f852f2d1a40..7d2cab3edee 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." | |||
| 1162 | nil | 1162 | nil |
| 1163 | `(:file ,stdout-file) | 1163 | `(:file ,stdout-file) |
| 1164 | nil | 1164 | nil |
| 1165 | (append (cdr command) (list archive name dest))) | 1165 | `(,archive ,name ,@(cdr command) ,dest)) |
| 1166 | (with-temp-buffer | 1166 | (with-temp-buffer |
| 1167 | (insert-file-contents stdout-file) | 1167 | (insert-file-contents stdout-file) |
| 1168 | (goto-char (point-min)) | 1168 | (goto-char (point-min)) |
| @@ -2038,27 +2038,26 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." | |||
| 2038 | (maxsize 5) | 2038 | (maxsize 5) |
| 2039 | (files ())) | 2039 | (files ())) |
| 2040 | (with-temp-buffer | 2040 | (with-temp-buffer |
| 2041 | (call-process "unrar-free" nil t nil "--list" (or file copy)) | 2041 | (call-process "lsar" nil t nil "-l" (or file copy)) |
| 2042 | (if copy (delete-file copy)) | 2042 | (if copy (delete-file copy)) |
| 2043 | (goto-char (point-min)) | 2043 | (goto-char (point-min)) |
| 2044 | (re-search-forward "^-+\n") | 2044 | (re-search-forward "^\\(\s+=+\s?+\\)+\n") |
| 2045 | (while (looking-at (concat " \\(.*\\)\n" ;Name. | 2045 | (while (looking-at (concat "^\s+[0-9.]+\s+-+\s+" ; Flags |
| 2046 | ;; Size ; Packed. | 2046 | "\\([0-9-]+\\)\s+" ; Size |
| 2047 | " +\\([0-9]+\\) +[0-9]+" | 2047 | "\\([0-9.%]+\\)\s+" ; Ratio |
| 2048 | ;; Ratio ; Date' | 2048 | "\\([0-9a-zA-Z]+\\)\s+" ; Mode |
| 2049 | " +\\([0-9%]+\\) +\\([-0-9]+\\)" | 2049 | "\\([0-9-]+\\)\s+" ; Date |
| 2050 | ;; Time ; Attr. | 2050 | "\\([0-9:]+\\)\s+" ; Time |
| 2051 | " +\\([0-9:]+\\) +[^ \n]\\{6,10\\}" | 2051 | "\\(.*\\)\n" ; Name |
| 2052 | ;; CRC; Meth ; Var. | 2052 | )) |
| 2053 | " +[0-9A-F]+ +[^ \n]+ +[0-9.]+\n")) | ||
| 2054 | (goto-char (match-end 0)) | 2053 | (goto-char (match-end 0)) |
| 2055 | (let ((name (match-string 1)) | 2054 | (let ((name (match-string 6)) |
| 2056 | (size (match-string 2))) | 2055 | (size (match-string 1))) |
| 2057 | (if (> (length name) maxname) (setq maxname (length name))) | 2056 | (if (> (length name) maxname) (setq maxname (length name))) |
| 2058 | (if (> (length size) maxsize) (setq maxsize (length size))) | 2057 | (if (> (length size) maxsize) (setq maxsize (length size))) |
| 2059 | (push (vector name name nil nil | 2058 | (push (vector name name nil nil |
| 2060 | ;; Size, Ratio. | 2059 | ;; Size, Ratio. |
| 2061 | size (match-string 3) | 2060 | size (match-string 2) |
| 2062 | ;; Date, Time. | 2061 | ;; Date, Time. |
| 2063 | (match-string 4) (match-string 5)) | 2062 | (match-string 4) (match-string 5)) |
| 2064 | files)))) | 2063 | files)))) |
| @@ -2091,7 +2090,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." | |||
| 2091 | ;; The code below assumes the name is relative and may do undesirable | 2090 | ;; The code below assumes the name is relative and may do undesirable |
| 2092 | ;; things otherwise. | 2091 | ;; things otherwise. |
| 2093 | (error "Can't extract files with non-relative names") | 2092 | (error "Can't extract files with non-relative names") |
| 2094 | (archive-extract-by-file archive name '("unrar-free" "--extract") "All OK"))) | 2093 | (archive-extract-by-file archive name `("unar" "-no-directory" "-o") "Successfully extracted"))) |
| 2095 | 2094 | ||
| 2096 | ;;; Section: Rar self-extracting .exe archives. | 2095 | ;;; Section: Rar self-extracting .exe archives. |
| 2097 | 2096 | ||