]> code.delx.au - gnu-emacs/blobdiff - lisp/arc-mode.el
Merge from mainline.
[gnu-emacs] / lisp / arc-mode.el
index 3b7603b8c0ef1e6a3c47301c10b85db88cfbdea3..ee32d89365403d1bad2ce2952387129b3943c80d 100644 (file)
@@ -1,10 +1,10 @@
 ;;; arc-mode.el --- simple editing of archives
 
 ;; Copyright (C) 1995, 1997, 1998, 2001, 2002, 2003, 2004, 2005, 2006,
-;;   2007, 2008, 2009  Free Software Foundation, Inc.
+;;   2007, 2008, 2009, 2010  Free Software Foundation, Inc.
 
 ;; Author: Morten Welinder <terra@gnu.org>
-;; Keywords: archives msdog editing major-mode
+;; Keywords: files archives msdog editing major-mode
 ;; Favourite-brand-of-beer: None, I hate beer.
 
 ;; This file is part of GNU Emacs.
@@ -818,15 +818,22 @@ If FNAME is something our underlying filesystem can't grok, or if another
 file by that name already exists in DIR, a unique new name is generated
 using `make-temp-file', and the generated name is returned."
   (let ((fullname (expand-file-name fname dir))
-       (alien (string-match file-name-invalid-regexp fname)))
-    (if (or alien (file-exists-p fullname))
-       (make-temp-file
+       (alien (string-match file-name-invalid-regexp fname))
+       (tmpfile
         (expand-file-name
          (if (if (fboundp 'msdos-long-file-names)
                  (not (msdos-long-file-names)))
              "am"
            "arc-mode.")
-         dir))
+         dir)))
+    (if (or alien (file-exists-p fullname))
+       (progn
+         ;; Maked sure all the leading directories in
+         ;; archive-local-name exist under archive-tmpdir, so that
+         ;; the directory structure recorded in the archive is
+         ;; reconstructed in the temporary directory.
+         (make-directory (file-name-directory tmpfile) t)
+         (make-temp-file tmpfile))
       fullname)))
 
 (defun archive-maybe-copy (archive)
@@ -843,11 +850,6 @@ using `make-temp-file', and the generated name is returned."
                   archive)))
          (setq archive-local-name
                (archive-unique-fname archive-name archive-tmpdir))
-         ;; Maked sure all the leading directories in
-         ;; archive-local-name exist under archive-tmpdir, so that
-         ;; the directory structure recorded in the archive is
-         ;; reconstructed in the temporary directory.
-         (make-directory (file-name-directory archive-local-name) t)
          (save-restriction
            (widen)
            (write-region start (point-max) archive-local-name nil 'nomessage))
@@ -1780,9 +1782,16 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
     (apply 'vector (nreverse files))))
 
 (defun archive-zip-extract (archive name)
-  (if (equal (car archive-zip-extract) "pkzip")
+  (if (member-ignore-case (car archive-zip-extract) '("pkunzip" "pkzip"))
       (archive-*-extract archive name archive-zip-extract)
-    (archive-extract-by-stdout archive name archive-zip-extract)))
+    (archive-extract-by-stdout
+     archive
+     ;; unzip expands wildcards in NAME, so we need to quote it.
+     ;; FIXME: Does pkunzip need similar treatment?
+     (if (equal (car archive-zip-extract) "unzip")
+        (shell-quote-argument name)
+       name)
+     archive-zip-extract)))
 
 (defun archive-zip-write-file-member (archive descr)
   (archive-*-write-file-member
@@ -1902,7 +1911,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
                                  ;; Ratio ; Date'
                                  " +\\([0-9%]+\\) +\\([-0-9]+\\)"
                                  ;; Time ; Attr.
-                                 " +\\([0-9:]+\\) +......"
+                                 " +\\([0-9:]+\\) +[^ \n]\\{6,10\\}"
                                  ;; CRC; Meth ; Var.
                                  " +[0-9A-F]+ +[^ \n]+ +[0-9.]+\n"))
         (goto-char (match-end 0))