;;; arc-mode.el --- simple editing of archives
;; Copyright (C) 1995, 1997, 1998, 2002, 2003, 2004,
-;; 2005 Free Software Foundation, Inc.
+;; 2005, 2006 Free Software Foundation, Inc.
;; Author: Morten Welinder <terra@gnu.org>
;; Keywords: archives msdog editing major-mode
'("unzip" "-qq" "-c"))
"*Program and its options to run in order to extract a zip file member.
Extraction should happen to standard output. Archive and member name will
-be added. If `archive-zip-use-pkzip' is non-nil then this program is
-expected to extract to a file junking the directory part of the name."
+be added."
:type '(list (string :tag "Program")
(repeat :tag "Options"
:inline t
(archive-name
(or (and archive-subfile-mode (aref archive-subfile-mode 0))
archive)))
- (make-directory archive-tmpdir t)
- ;; If ARCHIVE includes leading directories, make sure they
- ;; exist under archive-tmpdir.
- (let ((arch-dir (file-name-directory archive)))
- (if arch-dir
- (make-directory (concat
- (file-name-as-directory archive-tmpdir)
- arch-dir)
- t)))
(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))
(defun archive-extract (&optional other-window-p event)
"In archive mode, extract this entry of the archive into its own buffer."
(interactive (list nil last-input-event))
- (if event (mouse-set-point event))
+ (if event (posn-set-point (event-end event)))
(let* ((view-p (eq other-window-p 'view))
(descr (archive-get-descr))
(ename (aref descr 0))
(read-only-p (or archive-read-only
view-p
(string-match file-name-invalid-regexp ename)))
+ (arcfilename (expand-file-name (concat arcname ":" iname)))
(buffer (get-buffer bufname))
(just-created nil))
- (if buffer
+ (if (and buffer
+ (string= (buffer-file-name buffer) arcfilename))
nil
(setq archive (archive-maybe-copy archive))
+ (setq bufname (generate-new-buffer-name bufname))
(setq buffer (get-buffer-create bufname))
(setq just-created t)
(with-current-buffer buffer
- (setq buffer-file-name
- (expand-file-name (concat arcname ":" iname)))
+ (setq buffer-file-name arcfilename)
(setq buffer-file-truename
(abbreviate-file-name buffer-file-name))
;; Set the default-directory to the dir of the superior buffer.