]> code.delx.au - gnu-emacs/blobdiff - lisp/arc-mode.el
(url-open-stream): Don't hide errors.
[gnu-emacs] / lisp / arc-mode.el
index a29ec10d400ffbf794b6cbdcc2344b87453fa347..abf38994235a62ec9bc018791d8be75351c3d222 100644 (file)
@@ -1,7 +1,7 @@
 ;;; 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
@@ -225,8 +225,7 @@ Archive and member name will be added."
     '("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
@@ -801,17 +800,13 @@ using `make-temp-file', and the generated name is returned."
              (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))
@@ -896,7 +891,7 @@ using `make-temp-file', and the generated name is returned."
 (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))
@@ -912,16 +907,18 @@ using `make-temp-file', and the generated name is returned."
          (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.