diff options
| author | Andreas Schwab | 2000-12-12 17:56:49 +0000 |
|---|---|---|
| committer | Andreas Schwab | 2000-12-12 17:56:49 +0000 |
| commit | 38c6e0c73e4c03d6ec879bb2e6560d89b29313b0 (patch) | |
| tree | b1da5fb8ccea28a12221b0cdc41381da71870986 | |
| parent | 2ebf6139fcdec22fb8426fc988d874c8c2b81f68 (diff) | |
| download | emacs-38c6e0c73e4c03d6ec879bb2e6560d89b29313b0.tar.gz emacs-38c6e0c73e4c03d6ec879bb2e6560d89b29313b0.zip | |
(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.
| -rw-r--r-- | lisp/tar-mode.el | 20 |
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." | |||
| 678 | (end (+ start size))) | 678 | (end (+ start size))) |
| 679 | (let* ((tar-buffer (current-buffer)) | 679 | (let* ((tar-buffer (current-buffer)) |
| 680 | (tar-buffer-multibyte enable-multibyte-characters) | 680 | (tar-buffer-multibyte enable-multibyte-characters) |
| 681 | (tarname (if (buffer-file-name) | 681 | (tarname (buffer-name)) |
| 682 | (file-name-nondirectory (buffer-file-name)) | ||
| 683 | (buffer-name))) | ||
| 684 | (bufname (concat (file-name-nondirectory name) | 682 | (bufname (concat (file-name-nondirectory name) |
| 685 | " (" | 683 | " (" |
| 686 | tarname | 684 | tarname |
| 687 | ")")) | 685 | ")")) |
| 688 | (read-only-p (or buffer-read-only view-p)) | 686 | (read-only-p (or buffer-read-only view-p)) |
| 689 | (buffer (get-buffer bufname)) | 687 | (buffer (get-buffer bufname)) |
| 690 | (just-created nil)) | 688 | (just-created nil) |
| 691 | (if buffer | 689 | (new-buffer-file-name (expand-file-name |
| 690 | ;; `:' is not allowed on Windows | ||
| 691 | (concat tarname "!" name)))) | ||
| 692 | (if (and buffer | ||
| 693 | ;; Check that the buffer is visiting the same file | ||
| 694 | (equal (buffer-file-name buffer) new-buffer-file-name)) | ||
| 692 | nil | 695 | nil |
| 693 | (setq buffer (get-buffer-create bufname)) | 696 | (setq buffer (generate-new-buffer bufname)) |
| 697 | (setq bufname (buffer-name buffer)) | ||
| 694 | (setq just-created t) | 698 | (setq just-created t) |
| 695 | (unwind-protect | 699 | (unwind-protect |
| 696 | (progn | 700 | (progn |
| @@ -706,9 +710,7 @@ appear on disk when you save the tar-file's buffer." | |||
| 706 | (set-buffer-multibyte t)) | 710 | (set-buffer-multibyte t)) |
| 707 | (insert-buffer-substring tar-buffer start end)) | 711 | (insert-buffer-substring tar-buffer start end)) |
| 708 | (goto-char (point-min)) | 712 | (goto-char (point-min)) |
| 709 | (setq buffer-file-name | 713 | (setq buffer-file-name new-buffer-file-name) |
| 710 | ;; `:' is not allowed on Windows | ||
| 711 | (expand-file-name (concat tarname "!" name))) | ||
| 712 | (setq buffer-file-truename | 714 | (setq buffer-file-truename |
| 713 | (abbreviate-file-name buffer-file-name)) | 715 | (abbreviate-file-name buffer-file-name)) |
| 714 | ;; We need to mimic the parts of insert-file-contents | 716 | ;; We need to mimic the parts of insert-file-contents |