]> code.delx.au - gnu-emacs/blobdiff - lisp/tar-mode.el
*** empty log message ***
[gnu-emacs] / lisp / tar-mode.el
index 6bf2df158749f2d3cbd5feb5a15b27efb97ddde2..0e57d541dfe6ae259563837cac8b02c5708eb295 100644 (file)
@@ -1,7 +1,7 @@
 ;;; tar-mode.el --- simple editing of tar files from GNU emacs
 
-;; Copyright (C) 1990,91,93,94,95,96,97,98,99,2000,01,2004
-;; Free Software Foundation, Inc.
+;; Copyright (C) 1990, 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+;;   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
 
 ;; Author: Jamie Zawinski <jwz@lucid.com>
 ;; Maintainer: FSF
@@ -22,8 +22,8 @@
 
 ;; You should have received a copy of the GNU General Public License
 ;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
 
 ;;; Commentary:
 
@@ -579,6 +579,7 @@ See also: variables `tar-update-datestamp' and `tar-anal-blocksize'.
   (set (make-local-variable 'file-precious-flag) t)
   (auto-save-mode 0)
   (set (make-local-variable 'write-contents-functions) '(tar-mode-write-file))
+  (buffer-disable-undo)
   (widen)
   (if (and (boundp 'tar-header-offset) tar-header-offset)
       (narrow-to-region (point-min) (byte-to-position tar-header-offset))
@@ -734,7 +735,9 @@ appear on disk when you save the tar-file's buffer."
                             (and set-auto-coding-function
                                  (save-excursion
                                    (funcall set-auto-coding-function
-                                            name (- (point-max) (point)))))))
+                                            name (- (point-max) (point)))))
+                            (car (find-operation-coding-system
+                                  'insert-file-contents name t))))
                        (multibyte enable-multibyte-characters)
                        (detected (detect-coding-region
                                   (point-min)
@@ -746,13 +749,7 @@ appear on disk when you save the tar-file's buffer."
                                          coding
                                          (coding-system-eol-type detected))))
                      (setq coding
-                           (or (find-new-buffer-file-coding-system detected)
-                               (let ((file-coding
-                                      (find-operation-coding-system
-                                       'insert-file-contents buffer-file-name)))
-                                 (if (consp file-coding)
-                                     (setq file-coding (car file-coding))
-                                   file-coding)))))
+                           (find-new-buffer-file-coding-system detected)))
                    (if (or (eq coding 'no-conversion)
                            (eq (coding-system-type coding) 5))
                        (setq multibyte (set-buffer-multibyte nil)))
@@ -1119,7 +1116,7 @@ to make your changes permanent."
        (descriptor tar-superior-descriptor)
        subfile-size)
     ;; We must make the current buffer unibyte temporarily to avoid
-    ;; multibyte->unibyte conversion in `insert-buffer'.
+    ;; multibyte->unibyte conversion in `insert-buffer-substring'.
     (set-buffer-multibyte nil)
     (setq subfile-size (buffer-size))
     (set-buffer tar-superior-buffer)
@@ -1143,7 +1140,7 @@ to make your changes permanent."
          (delete-region data-start data-end)
          ;; insert the new data...
          (goto-char data-start)
-         (insert-buffer subfile)
+         (insert-buffer-substring subfile)
          (setq subfile-size
                (encode-coding-region
                 data-start (+ data-start subfile-size) coding))