;;; 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.
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)
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))
(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
;; 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))