]> git.eshelyaron.com Git - emacs.git/commitdiff
Make `C' in over tramp work in archive mode
authorLars Ingebrigtsen <larsi@gnus.org>
Sun, 17 Jul 2022 10:12:24 +0000 (12:12 +0200)
committerLars Ingebrigtsen <larsi@gnus.org>
Sun, 17 Jul 2022 10:12:58 +0000 (12:12 +0200)
* lisp/arc-mode.el (archive-copy-file): Make `C' in over tramp
work (bug#56574).

lisp/arc-mode.el

index dbb8c202091e0964574867b727e47ab2a75726ce..632ae578523deb97851ccad271f8a567b81182cd 100644 (file)
@@ -1087,11 +1087,17 @@ NEW-NAME."
         (let* ((descr (archive-get-descr))
                (archive (buffer-file-name))
                (extractor (archive-name "extract"))
-               (ename (archive--file-desc-ext-file-name descr)))
-          (with-temp-buffer
-            (set-buffer-multibyte nil)
-            (archive--extract-file extractor archive ename)
-            (write-region (point-min) (point-max) write-to)))))))
+               (ename (archive--file-desc-ext-file-name descr))
+               ;; If the archive is remote, we have to copy it to a
+               ;; local file first to make extraction work.
+               (copy (archive-maybe-copy archive)))
+          (unwind-protect
+              (with-temp-buffer
+                (set-buffer-multibyte nil)
+                (archive--extract-file extractor copy ename)
+                (write-region (point-min) (point-max) write-to))
+            (unless (equal copy archive)
+              (delete-file copy))))))))
 
 (defun archive-extract (&optional other-window-p event)
   "In archive mode, extract this entry of the archive into its own buffer."