diff options
| author | Juri Linkov | 2019-02-17 23:07:43 +0200 |
|---|---|---|
| committer | Juri Linkov | 2019-02-17 23:07:43 +0200 |
| commit | 4f24b4a6dff0c257d1c1ea49338efcdff59446b0 (patch) | |
| tree | 50c073cfd31126ddd1f3b779347cfc8d7b61056f | |
| parent | adeea448bcbf12b8f6f33af0ddc9867fa49f5b4a (diff) | |
| download | emacs-4f24b4a6dff0c257d1c1ea49338efcdff59446b0.tar.gz emacs-4f24b4a6dff0c257d1c1ea49338efcdff59446b0.zip | |
* lisp/tar-mode.el (tar--try-jka-compr): Remove. (Bug#34251)
(tar-extract): Call archive-try-jka-compr instead of tar--try-jka-compr.
* lisp/arc-mode.el (archive-try-jka-compr): Call set-buffer-multibyte
after erase-buffer.
| -rw-r--r-- | lisp/arc-mode.el | 2 | ||||
| -rw-r--r-- | lisp/tar-mode.el | 23 |
2 files changed, 3 insertions, 22 deletions
diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index 2b5b6166ad5..8de01030195 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el | |||
| @@ -967,8 +967,8 @@ using `make-temp-file', and the generated name is returned." | |||
| 967 | ;; Don't re-compress this data just before decompressing it. | 967 | ;; Don't re-compress this data just before decompressing it. |
| 968 | (jka-compr-inhibit t)) | 968 | (jka-compr-inhibit t)) |
| 969 | (write-region (point-min) (point-max) tmpfile nil 'quiet)) | 969 | (write-region (point-min) (point-max) tmpfile nil 'quiet)) |
| 970 | (set-buffer-multibyte t) | ||
| 971 | (erase-buffer) | 970 | (erase-buffer) |
| 971 | (set-buffer-multibyte t) | ||
| 972 | (insert-file-contents tmpfile)) | 972 | (insert-file-contents tmpfile)) |
| 973 | (delete-file tmpfile))))) | 973 | (delete-file tmpfile))))) |
| 974 | 974 | ||
diff --git a/lisp/tar-mode.el b/lisp/tar-mode.el index c5382d3f3d1..599da9ac807 100644 --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el | |||
| @@ -95,6 +95,7 @@ | |||
| 95 | ;;; Code: | 95 | ;;; Code: |
| 96 | 96 | ||
| 97 | (eval-when-compile (require 'cl-lib)) | 97 | (eval-when-compile (require 'cl-lib)) |
| 98 | (require 'arc-mode) | ||
| 98 | 99 | ||
| 99 | (defgroup tar nil | 100 | (defgroup tar nil |
| 100 | "Simple editing of tar files." | 101 | "Simple editing of tar files." |
| @@ -852,26 +853,6 @@ actually appear on disk when you save the tar-file's buffer." | |||
| 852 | (goto-char (posn-point (event-end event))) | 853 | (goto-char (posn-point (event-end event))) |
| 853 | (tar-extract)) | 854 | (tar-extract)) |
| 854 | 855 | ||
| 855 | (defun tar--try-jka-compr () | ||
| 856 | (when (and auto-compression-mode | ||
| 857 | (jka-compr-get-compression-info buffer-file-name)) | ||
| 858 | (let* ((basename (file-name-nondirectory buffer-file-name)) | ||
| 859 | (tmpname (if (string-match ":\\([^:]+\\)\\'" basename) | ||
| 860 | (match-string 1 basename) basename)) | ||
| 861 | (tmpfile (make-temp-file (file-name-sans-extension tmpname) | ||
| 862 | nil | ||
| 863 | (file-name-extension tmpname 'period)))) | ||
| 864 | (unwind-protect | ||
| 865 | (progn | ||
| 866 | (let ((coding-system-for-write 'no-conversion) | ||
| 867 | ;; Don't re-compress this data just before decompressing it. | ||
| 868 | (jka-compr-inhibit t)) | ||
| 869 | (write-region (point-min) (point-max) tmpfile nil 'quiet)) | ||
| 870 | (set-buffer-multibyte t) | ||
| 871 | (erase-buffer) | ||
| 872 | (insert-file-contents tmpfile)) | ||
| 873 | (delete-file tmpfile))))) | ||
| 874 | |||
| 875 | (defun tar-file-name-handler (op &rest args) | 856 | (defun tar-file-name-handler (op &rest args) |
| 876 | "Helper function for `tar-extract'." | 857 | "Helper function for `tar-extract'." |
| 877 | (or (eq op 'file-exists-p) | 858 | (or (eq op 'file-exists-p) |
| @@ -951,7 +932,7 @@ actually appear on disk when you save the tar-file's buffer." | |||
| 951 | (setq buffer-file-name new-buffer-file-name) | 932 | (setq buffer-file-name new-buffer-file-name) |
| 952 | (setq buffer-file-truename | 933 | (setq buffer-file-truename |
| 953 | (abbreviate-file-name buffer-file-name)) | 934 | (abbreviate-file-name buffer-file-name)) |
| 954 | (tar--try-jka-compr) ;Pretty ugly hack :-( | 935 | (archive-try-jka-compr) ;Pretty ugly hack :-( |
| 955 | ;; Force buffer-file-coding-system to what | 936 | ;; Force buffer-file-coding-system to what |
| 956 | ;; decode-coding-region actually used. | 937 | ;; decode-coding-region actually used. |
| 957 | (set-buffer-file-coding-system last-coding-system-used t) | 938 | (set-buffer-file-coding-system last-coding-system-used t) |