comparison lisp/tar-mode.el @ 59569:7042d543a356

(tar-extract): Bind buffer-undo-list to t.
author Richard M. Stallman <rms@gnu.org>
date Sat, 15 Jan 2005 18:10:12 +0000
parents 97a3201f82ef
children 5a0fcfdcc95e
comparison
equal deleted inserted replaced
59568:3c6c2682ad8f 59569:7042d543a356
713 (progn 713 (progn
714 (widen) 714 (widen)
715 (set-buffer-multibyte nil) 715 (set-buffer-multibyte nil)
716 (save-excursion 716 (save-excursion
717 (set-buffer buffer) 717 (set-buffer buffer)
718 (if enable-multibyte-characters 718 (let ((buffer-undo-list t))
719 (progn 719 (if enable-multibyte-characters
720 ;; We must avoid unibyte->multibyte conversion. 720 (progn
721 (set-buffer-multibyte nil) 721 ;; We must avoid unibyte->multibyte conversion.
722 (insert-buffer-substring tar-buffer start end) 722 (set-buffer-multibyte nil)
723 (set-buffer-multibyte t)) 723 (insert-buffer-substring tar-buffer start end)
724 (insert-buffer-substring tar-buffer start end)) 724 (set-buffer-multibyte t))
725 (goto-char (point-min)) 725 (insert-buffer-substring tar-buffer start end))
726 (setq buffer-file-name new-buffer-file-name) 726 (goto-char (point-min))
727 (setq buffer-file-truename 727 (setq buffer-file-name new-buffer-file-name)
728 (abbreviate-file-name buffer-file-name)) 728 (setq buffer-file-truename
729 ;; We need to mimic the parts of insert-file-contents 729 (abbreviate-file-name buffer-file-name))
730 ;; which determine the coding-system and decode the text. 730 ;; We need to mimic the parts of insert-file-contents
731 (let ((coding 731 ;; which determine the coding-system and decode the text.
732 (or coding-system-for-read 732 (let ((coding
733 (and set-auto-coding-function 733 (or coding-system-for-read
734 (save-excursion 734 (and set-auto-coding-function
735 (funcall set-auto-coding-function 735 (save-excursion
736 name (- (point-max) (point))))))) 736 (funcall set-auto-coding-function
737 (multibyte enable-multibyte-characters) 737 name (- (point-max) (point)))))))
738 (detected (detect-coding-region 738 (multibyte enable-multibyte-characters)
739 (point-min) 739 (detected (detect-coding-region
740 (min (+ (point-min) 16384) (point-max)) t))) 740 (point-min)
741 (if coding 741 (min (+ (point-min) 16384) (point-max)) t)))
742 (or (numberp (coding-system-eol-type coding)) 742 (if coding
743 (vectorp (coding-system-eol-type detected)) 743 (or (numberp (coding-system-eol-type coding))
744 (setq coding (coding-system-change-eol-conversion 744 (vectorp (coding-system-eol-type detected))
745 coding 745 (setq coding (coding-system-change-eol-conversion
746 (coding-system-eol-type detected)))) 746 coding
747 (setq coding 747 (coding-system-eol-type detected))))
748 (or (find-new-buffer-file-coding-system detected)
749 (let ((file-coding
750 (find-operation-coding-system
751 'insert-file-contents buffer-file-name)))
752 (if (consp file-coding)
753 (setq file-coding (car file-coding))
754 file-coding)))))
755 (if (or (eq coding 'no-conversion)
756 (eq (coding-system-type coding) 5))
757 (setq multibyte (set-buffer-multibyte nil)))
758 (or multibyte
759 (setq coding 748 (setq coding
760 (coding-system-change-text-conversion 749 (or (find-new-buffer-file-coding-system detected)
761 coding 'raw-text))) 750 (let ((file-coding
762 (decode-coding-region (point-min) (point-max) coding) 751 (find-operation-coding-system
763 (set-buffer-file-coding-system coding)) 752 'insert-file-contents buffer-file-name)))
764 ;; Set the default-directory to the dir of the 753 (if (consp file-coding)
765 ;; superior buffer. 754 (setq file-coding (car file-coding))
766 (setq default-directory 755 file-coding)))))
767 (save-excursion 756 (if (or (eq coding 'no-conversion)
768 (set-buffer tar-buffer) 757 (eq (coding-system-type coding) 5))
769 default-directory)) 758 (setq multibyte (set-buffer-multibyte nil)))
770 (normal-mode) ; pick a mode. 759 (or multibyte
771 (rename-buffer bufname) 760 (setq coding
772 (make-local-variable 'tar-superior-buffer) 761 (coding-system-change-text-conversion
773 (make-local-variable 'tar-superior-descriptor) 762 coding 'raw-text)))
774 (setq tar-superior-buffer tar-buffer) 763 (decode-coding-region (point-min) (point-max) coding)
775 (setq tar-superior-descriptor descriptor) 764 (set-buffer-file-coding-system coding))
776 (setq buffer-read-only read-only-p) 765 ;; Set the default-directory to the dir of the
777 (set-buffer-modified-p nil) 766 ;; superior buffer.
767 (setq default-directory
768 (save-excursion
769 (set-buffer tar-buffer)
770 default-directory))
771 (normal-mode) ; pick a mode.
772 (rename-buffer bufname)
773 (make-local-variable 'tar-superior-buffer)
774 (make-local-variable 'tar-superior-descriptor)
775 (setq tar-superior-buffer tar-buffer)
776 (setq tar-superior-descriptor descriptor)
777 (setq buffer-read-only read-only-p)
778 (set-buffer-modified-p nil))
778 (tar-subfile-mode 1)) 779 (tar-subfile-mode 1))
779 (set-buffer tar-buffer)) 780 (set-buffer tar-buffer))
780 (narrow-to-region (point-min) tar-header-offset) 781 (narrow-to-region (point-min) tar-header-offset)
781 (set-buffer-multibyte tar-buffer-multibyte))) 782 (set-buffer-multibyte tar-buffer-multibyte)))
782 (if view-p 783 (if view-p