summaryrefslogtreecommitdiff
path: root/lisp/tar-mode.el
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2000-12-12 17:56:49 +0000
committerAndreas Schwab <schwab@suse.de>2000-12-12 17:56:49 +0000
commit38c6e0c73e4c03d6ec879bb2e6560d89b29313b0 (patch)
treeb1da5fb8ccea28a12221b0cdc41381da71870986 /lisp/tar-mode.el
parent2ebf6139fcdec22fb8426fc988d874c8c2b81f68 (diff)
downloademacs-38c6e0c73e4c03d6ec879bb2e6560d89b29313b0.tar.gz
(tar-extract): Base the name of the subfile buffer
on the name of the tar buffer. Verify that the existing buffer is visiting the same subfile.
Diffstat (limited to 'lisp/tar-mode.el')
-rw-r--r--lisp/tar-mode.el20
1 files changed, 11 insertions, 9 deletions
diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el
index 5c5bdae4170..264bc37f2e6 100644
--- a/lisp/tar-mode.el
+++ b/lisp/tar-mode.el
@@ -678,19 +678,23 @@ appear on disk when you save the tar-file's buffer."
(end (+ start size)))
(let* ((tar-buffer (current-buffer))
(tar-buffer-multibyte enable-multibyte-characters)
- (tarname (if (buffer-file-name)
- (file-name-nondirectory (buffer-file-name))
- (buffer-name)))
+ (tarname (buffer-name))
(bufname (concat (file-name-nondirectory name)
" ("
tarname
")"))
(read-only-p (or buffer-read-only view-p))
(buffer (get-buffer bufname))
- (just-created nil))
- (if buffer
+ (just-created nil)
+ (new-buffer-file-name (expand-file-name
+ ;; `:' is not allowed on Windows
+ (concat tarname "!" name))))
+ (if (and buffer
+ ;; Check that the buffer is visiting the same file
+ (equal (buffer-file-name buffer) new-buffer-file-name))
nil
- (setq buffer (get-buffer-create bufname))
+ (setq buffer (generate-new-buffer bufname))
+ (setq bufname (buffer-name buffer))
(setq just-created t)
(unwind-protect
(progn
@@ -706,9 +710,7 @@ appear on disk when you save the tar-file's buffer."
(set-buffer-multibyte t))
(insert-buffer-substring tar-buffer start end))
(goto-char (point-min))
- (setq buffer-file-name
- ;; `:' is not allowed on Windows
- (expand-file-name (concat tarname "!" name)))
+ (setq buffer-file-name new-buffer-file-name)
(setq buffer-file-truename
(abbreviate-file-name buffer-file-name))
;; We need to mimic the parts of insert-file-contents