129 |
:group 'tar) |
:group 'tar) |
130 |
|
|
131 |
(defvar tar-parse-info nil) |
(defvar tar-parse-info nil) |
|
;; Be sure that this variable holds byte position, not char position. |
|
132 |
(defvar tar-header-offset nil) |
(defvar tar-header-offset nil) |
133 |
(defvar tar-superior-buffer nil) |
(defvar tar-superior-buffer nil) |
134 |
(defvar tar-superior-descriptor nil) |
(defvar tar-superior-descriptor nil) |
135 |
(defvar tar-subfile-mode nil) |
(defvar tar-subfile-mode nil) |
136 |
|
(defvar tar-file-name-coding-system nil) |
137 |
|
|
138 |
(put 'tar-parse-info 'permanent-local t) |
(put 'tar-parse-info 'permanent-local t) |
139 |
(put 'tar-header-offset 'permanent-local t) |
(put 'tar-header-offset 'permanent-local t) |
140 |
(put 'tar-superior-buffer 'permanent-local t) |
(put 'tar-superior-buffer 'permanent-local t) |
141 |
(put 'tar-superior-descriptor 'permanent-local t) |
(put 'tar-superior-descriptor 'permanent-local t) |
142 |
|
(put 'tar-file-name-coding-system 'permanent-local t) |
143 |
|
|
144 |
(defmacro tar-setf (form val) |
(defmacro tar-setf (form val) |
145 |
"A mind-numbingly simple implementation of setf." |
"A mind-numbingly simple implementation of setf." |
232 |
(setq linkname (substring string tar-link-offset link-end)) |
(setq linkname (substring string tar-link-offset link-end)) |
233 |
(if default-enable-multibyte-characters |
(if default-enable-multibyte-characters |
234 |
(setq name |
(setq name |
235 |
(decode-coding-string name (or file-name-coding-system |
(decode-coding-string name tar-file-name-coding-system) |
|
'undecided)) |
|
236 |
linkname |
linkname |
237 |
(decode-coding-string linkname (or file-name-coding-system |
(decode-coding-string linkname |
238 |
'undecided)))) |
tar-file-name-coding-system))) |
239 |
(if (and (null link-p) (string-match "/$" name)) (setq link-p 5)) ; directory |
(if (and (null link-p) (string-match "/$" name)) (setq link-p 5)) ; directory |
240 |
(make-tar-header |
(make-tar-header |
241 |
name |
name |
302 |
;; Add up all of the characters except the ones in the checksum field. |
;; Add up all of the characters except the ones in the checksum field. |
303 |
;; Add that field as if it were filled with spaces. |
;; Add that field as if it were filled with spaces. |
304 |
(while (< i chk-field-start) |
(while (< i chk-field-start) |
305 |
(setq sum (+ sum (aref string i)) |
(setq sum (+ sum (multibyte-char-to-unibyte (aref string i))) |
306 |
i (1+ i))) |
i (1+ i))) |
307 |
(setq i chk-field-end) |
(setq i chk-field-end) |
308 |
(while (< i 512) |
(while (< i 512) |
309 |
(setq sum (+ sum (aref string i)) |
(setq sum (+ sum (multibyte-char-to-unibyte (aref string i))) |
310 |
i (1+ i))) |
i (1+ i))) |
311 |
(+ sum (* 32 8)))) |
(+ sum (* 32 8)))) |
312 |
|
|
434 |
(cons (tar-header-block-summarize (tar-desc-tokens tar-desc)) |
(cons (tar-header-block-summarize (tar-desc-tokens tar-desc)) |
435 |
(cons "\n" |
(cons "\n" |
436 |
summaries)))) |
summaries)))) |
437 |
|
(if default-enable-multibyte-characters |
438 |
|
(set-buffer-multibyte t 'to)) |
439 |
(let ((total-summaries (apply 'concat summaries))) |
(let ((total-summaries (apply 'concat summaries))) |
|
(if (multibyte-string-p total-summaries) |
|
|
(set-buffer-multibyte t)) |
|
440 |
(insert total-summaries)) |
(insert total-summaries)) |
441 |
(make-local-variable 'tar-header-offset) |
(make-local-variable 'tar-header-offset) |
442 |
(setq tar-header-offset (point)) |
(setq tar-header-offset (point)) |
443 |
(narrow-to-region 1 tar-header-offset) |
(narrow-to-region 1 tar-header-offset) |
|
(if enable-multibyte-characters |
|
|
(setq tar-header-offset (position-bytes tar-header-offset))) |
|
444 |
(set-buffer-modified-p nil)))) |
(set-buffer-modified-p nil)))) |
445 |
|
|
446 |
(defvar tar-mode-map nil "*Local keymap for Tar mode listings.") |
(defvar tar-mode-map nil "*Local keymap for Tar mode listings.") |
551 |
(set (make-local-variable 'revert-buffer-function) 'tar-mode-revert) |
(set (make-local-variable 'revert-buffer-function) 'tar-mode-revert) |
552 |
(set (make-local-variable 'local-enable-local-variables) nil) |
(set (make-local-variable 'local-enable-local-variables) nil) |
553 |
(set (make-local-variable 'next-line-add-newlines) nil) |
(set (make-local-variable 'next-line-add-newlines) nil) |
554 |
|
(set (make-local-variable 'tar-file-name-coding-system) |
555 |
|
(or file-name-coding-system |
556 |
|
default-file-name-coding-system |
557 |
|
locale-coding-system)) |
558 |
;; Prevent loss of data when saving the file. |
;; Prevent loss of data when saving the file. |
559 |
(set (make-local-variable 'file-precious-flag) t) |
(set (make-local-variable 'file-precious-flag) t) |
560 |
(auto-save-mode 0) |
(auto-save-mode 0) |
561 |
(set (make-local-variable 'write-contents-hooks) '(tar-mode-write-file)) |
(set (make-local-variable 'write-contents-hooks) '(tar-mode-write-file)) |
562 |
(widen) |
(widen) |
563 |
(if (and (boundp 'tar-header-offset) tar-header-offset) |
(if (and (boundp 'tar-header-offset) tar-header-offset) |
564 |
(narrow-to-region 1 (byte-to-position tar-header-offset)) |
(narrow-to-region 1 tar-header-offset) |
565 |
(tar-summarize-buffer) |
(tar-summarize-buffer) |
566 |
(tar-next-line 0))) |
(tar-next-line 0))) |
567 |
|
|
683 |
;; `:' is not allowed on Windows |
;; `:' is not allowed on Windows |
684 |
(concat tarname "!" name))) |
(concat tarname "!" name))) |
685 |
(buffer (get-file-buffer new-buffer-file-name)) |
(buffer (get-file-buffer new-buffer-file-name)) |
686 |
(just-created nil)) |
(just-created nil) |
687 |
|
(pos (point))) |
688 |
(unless buffer |
(unless buffer |
689 |
(setq buffer (generate-new-buffer bufname)) |
(setq buffer (generate-new-buffer bufname)) |
690 |
(setq bufname (buffer-name buffer)) |
(setq bufname (buffer-name buffer)) |
691 |
(setq just-created t) |
(setq just-created t) |
692 |
(unwind-protect |
(unwind-protect |
693 |
(progn |
(let (coding) |
694 |
(widen) |
(narrow-to-region start end) |
695 |
(set-buffer-multibyte nil) |
(goto-char start) |
696 |
|
(setq coding (or coding-system-for-read |
697 |
|
(and set-auto-coding-function |
698 |
|
(funcall set-auto-coding-function |
699 |
|
name (point-max))))) |
700 |
|
(if (or (not coding) |
701 |
|
(eq (coding-system-type coding) 'undecided)) |
702 |
|
(setq coding (detect-coding-region start end t))) |
703 |
|
(if (eq (coding-system-type coding) 'undecided) |
704 |
|
(setq coding |
705 |
|
(coding-system-change-text-conversion coding |
706 |
|
'us-ascii))) |
707 |
(save-excursion |
(save-excursion |
708 |
(set-buffer buffer) |
(set-buffer buffer) |
709 |
(if enable-multibyte-characters |
(if (and enable-multibyte-characters |
710 |
(progn |
(eq (coding-system-type 'raw-text) coding)) |
711 |
;; We must avoid unibyte->multibyte conversion. |
(set-buffer-multibyte nil)) |
|
(set-buffer-multibyte nil) |
|
|
(insert-buffer-substring tar-buffer start end) |
|
|
(set-buffer-multibyte t)) |
|
|
(insert-buffer-substring tar-buffer start end)) |
|
712 |
(goto-char (point-min)) |
(goto-char (point-min)) |
713 |
(setq buffer-file-name new-buffer-file-name) |
(setq buffer-file-name new-buffer-file-name) |
714 |
(setq buffer-file-truename |
(setq buffer-file-truename |
715 |
(abbreviate-file-name buffer-file-name)) |
(abbreviate-file-name buffer-file-name))) |
716 |
;; We need to mimic the parts of insert-file-contents |
(decode-coding-region start end coding buffer) |
717 |
;; which determine the coding-system and decode the text. |
(save-excursion |
718 |
(let ((coding |
(set-buffer buffer) |
719 |
(or coding-system-for-read |
(goto-char (point-min)) |
|
(and set-auto-coding-function |
|
|
(save-excursion |
|
|
(funcall set-auto-coding-function |
|
|
name (- (point-max) (point))))))) |
|
|
(multibyte enable-multibyte-characters) |
|
|
(detected (detect-coding-region |
|
|
1 (min 16384 (point-max)) t))) |
|
|
(if coding |
|
|
(or (numberp (coding-system-eol-type coding)) |
|
|
(setq coding (coding-system-change-eol-conversion |
|
|
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))))) |
|
|
(if (or (eq coding 'no-conversion) |
|
|
(eq (coding-system-type coding) 5)) |
|
|
(setq multibyte (set-buffer-multibyte nil))) |
|
|
(or multibyte |
|
|
(setq coding |
|
|
(coding-system-change-text-conversion |
|
|
coding 'raw-text))) |
|
|
(decode-coding-region 1 (point-max) coding) |
|
|
(set-buffer-file-coding-system coding)) |
|
720 |
;; Set the default-directory to the dir of the |
;; Set the default-directory to the dir of the |
721 |
;; superior buffer. |
;; superior buffer. |
722 |
(setq default-directory |
(setq default-directory |
734 |
(tar-subfile-mode 1)) |
(tar-subfile-mode 1)) |
735 |
(set-buffer tar-buffer)) |
(set-buffer tar-buffer)) |
736 |
(narrow-to-region 1 tar-header-offset) |
(narrow-to-region 1 tar-header-offset) |
737 |
(set-buffer-multibyte tar-buffer-multibyte))) |
(goto-char pos))) |
738 |
(if view-p |
(if view-p |
739 |
(view-buffer buffer (and just-created 'kill-buffer)) |
(view-buffer buffer (and just-created 'kill-buffer)) |
740 |
(if (eq other-window-p 'display) |
(if (eq other-window-p 'display) |
791 |
(size (tar-header-size tokens)) |
(size (tar-header-size tokens)) |
792 |
(start (+ (tar-desc-data-start descriptor) tar-header-offset -1)) |
(start (+ (tar-desc-data-start descriptor) tar-header-offset -1)) |
793 |
(end (+ start size)) |
(end (+ start size)) |
|
(multibyte enable-multibyte-characters) |
|
794 |
(inhibit-file-name-handlers inhibit-file-name-handlers) |
(inhibit-file-name-handlers inhibit-file-name-handlers) |
795 |
(inhibit-file-name-operation inhibit-file-name-operation)) |
(inhibit-file-name-operation inhibit-file-name-operation)) |
796 |
(save-restriction |
(save-restriction |
804 |
(and (eq inhibit-file-name-operation 'write-region) |
(and (eq inhibit-file-name-operation 'write-region) |
805 |
inhibit-file-name-handlers)) |
inhibit-file-name-handlers)) |
806 |
inhibit-file-name-operation 'write-region)) |
inhibit-file-name-operation 'write-region)) |
807 |
(unwind-protect |
(let ((coding-system-for-write 'no-conversion)) |
808 |
(let ((coding-system-for-write 'no-conversion)) |
(write-region start end to-file nil nil nil t))) |
|
(set-buffer-multibyte nil) |
|
|
(write-region start end to-file nil nil nil t)) |
|
|
(set-buffer-multibyte multibyte))) |
|
809 |
(message "Copied tar entry %s to %s" name to-file))) |
(message "Copied tar entry %s to %s" name to-file))) |
810 |
|
|
811 |
(defun tar-flag-deleted (p &optional unflag) |
(defun tar-flag-deleted (p &optional unflag) |
834 |
(tar-flag-deleted (- p) t)) |
(tar-flag-deleted (- p) t)) |
835 |
|
|
836 |
|
|
|
;; When this function is called, it is sure that the buffer is unibyte. |
|
837 |
(defun tar-expunge-internal () |
(defun tar-expunge-internal () |
838 |
"Expunge the tar-entry specified by the current line." |
"Expunge the tar-entry specified by the current line." |
839 |
(let* ((descriptor (tar-current-descriptor)) |
(let* ((descriptor (tar-current-descriptor)) |
885 |
(interactive) |
(interactive) |
886 |
(if (or noconfirm |
(if (or noconfirm |
887 |
(y-or-n-p "Expunge files marked for deletion? ")) |
(y-or-n-p "Expunge files marked for deletion? ")) |
888 |
(let ((n 0) |
(let ((n 0)) |
|
(multibyte enable-multibyte-characters)) |
|
|
(set-buffer-multibyte nil) |
|
889 |
(save-excursion |
(save-excursion |
890 |
(goto-char (point-min)) |
(goto-char (point-min)) |
891 |
(while (not (eobp)) |
(while (not (eobp)) |
896 |
;; after doing the deletions, add any padding that may be necessary. |
;; after doing the deletions, add any padding that may be necessary. |
897 |
(tar-pad-to-blocksize) |
(tar-pad-to-blocksize) |
898 |
(narrow-to-region 1 tar-header-offset)) |
(narrow-to-region 1 tar-header-offset)) |
|
(set-buffer-multibyte multibyte) |
|
899 |
(if (zerop n) |
(if (zerop n) |
900 |
(message "Nothing to expunge.") |
(message "Nothing to expunge.") |
901 |
(message "%s files expunged. Be sure to save this buffer." n))))) |
(message "%s files expunged. Be sure to save this buffer." n))))) |
906 |
(interactive) |
(interactive) |
907 |
(save-excursion |
(save-excursion |
908 |
(goto-char (point-min)) |
(goto-char (point-min)) |
909 |
(while (< (position-bytes (point)) tar-header-offset) |
(while (< (point) tar-header-offset) |
910 |
(if (not (eq (following-char) ?\ )) |
(if (not (eq (following-char) ?\ )) |
911 |
(progn (delete-char 1) (insert " "))) |
(progn (delete-char 1) (insert " "))) |
912 |
(forward-line 1)))) |
(forward-line 1)))) |
976 |
(list (read-string "New name: " |
(list (read-string "New name: " |
977 |
(tar-header-name (tar-desc-tokens (tar-current-descriptor)))))) |
(tar-header-name (tar-desc-tokens (tar-current-descriptor)))))) |
978 |
(if (string= "" new-name) (error "zero length name")) |
(if (string= "" new-name) (error "zero length name")) |
979 |
(if (> (length new-name) 98) (error "name too long")) |
(let ((encoded-new-name (encode-coding-string new-name |
980 |
(tar-setf (tar-header-name (tar-desc-tokens (tar-current-descriptor))) |
tar-file-name-coding-system))) |
981 |
new-name) |
(if (> (length encoded-new-name) 98) (error "name too long")) |
982 |
(tar-alter-one-field 0 |
(tar-setf (tar-header-name (tar-desc-tokens (tar-current-descriptor))) |
983 |
(substring (concat new-name (make-string 99 0)) 0 99))) |
new-name) |
984 |
|
(tar-alter-one-field 0 |
985 |
|
(substring (concat encoded-new-name (make-string 99 0)) 0 99)))) |
986 |
|
|
987 |
|
|
988 |
(defun tar-chmod-entry (new-mode) |
(defun tar-chmod-entry (new-mode) |
999 |
|
|
1000 |
(defun tar-alter-one-field (data-position new-data-string) |
(defun tar-alter-one-field (data-position new-data-string) |
1001 |
(let* ((descriptor (tar-current-descriptor)) |
(let* ((descriptor (tar-current-descriptor)) |
1002 |
(tokens (tar-desc-tokens descriptor)) |
(tokens (tar-desc-tokens descriptor))) |
|
(multibyte enable-multibyte-characters)) |
|
1003 |
(unwind-protect |
(unwind-protect |
1004 |
(save-excursion |
(save-excursion |
1005 |
;; |
;; |
1009 |
(forward-line 1) |
(forward-line 1) |
1010 |
(delete-region p (point)) |
(delete-region p (point)) |
1011 |
(insert (tar-header-block-summarize tokens) "\n") |
(insert (tar-header-block-summarize tokens) "\n") |
1012 |
(setq tar-header-offset (position-bytes (point-max)))) |
(setq tar-header-offset (point-max))) |
1013 |
|
|
1014 |
(widen) |
(widen) |
|
(set-buffer-multibyte nil) |
|
1015 |
(let* ((start (+ (tar-desc-data-start descriptor) tar-header-offset -513))) |
(let* ((start (+ (tar-desc-data-start descriptor) tar-header-offset -513))) |
1016 |
;; |
;; |
1017 |
;; delete the old field and insert a new one. |
;; delete the old field and insert a new one. |
1018 |
(goto-char (+ start data-position)) |
(goto-char (+ start data-position)) |
1019 |
(delete-region (point) (+ (point) (length new-data-string))) ; <-- |
(delete-region (point) (+ (point) (length new-data-string))) ; <-- |
1020 |
(insert new-data-string) ; <-- |
|
1021 |
|
;; As new-data-string is unibyte, just inserting it will |
1022 |
|
;; make eight-bit chars to the corresponding multibyte |
1023 |
|
;; chars. This avoid that conversion, i.e., eight-bit |
1024 |
|
;; chars are converted to multibyte form of eight-bit |
1025 |
|
;; chars. |
1026 |
|
(insert (string-to-multibyte new-data-string)) |
1027 |
;; |
;; |
1028 |
;; compute a new checksum and insert it. |
;; compute a new checksum and insert it. |
1029 |
(let ((chk (tar-header-block-checksum |
(let ((chk (tar-header-block-checksum |
1041 |
chk (tar-header-name tokens)) |
chk (tar-header-name tokens)) |
1042 |
))) |
))) |
1043 |
(narrow-to-region 1 tar-header-offset) |
(narrow-to-region 1 tar-header-offset) |
|
(set-buffer-multibyte multibyte) |
|
1044 |
(tar-next-line 0)))) |
(tar-next-line 0)))) |
1045 |
|
|
1046 |
|
|
1064 |
(error "This buffer doesn't have an index into its superior tar file!")) |
(error "This buffer doesn't have an index into its superior tar file!")) |
1065 |
(save-excursion |
(save-excursion |
1066 |
(let ((subfile (current-buffer)) |
(let ((subfile (current-buffer)) |
|
(subfile-multibyte enable-multibyte-characters) |
|
1067 |
(coding buffer-file-coding-system) |
(coding buffer-file-coding-system) |
1068 |
(descriptor tar-superior-descriptor) |
(descriptor tar-superior-descriptor) |
1069 |
subfile-size) |
subfile-size) |
|
;; We must make the current buffer unibyte temporarily to avoid |
|
|
;; multibyte->unibyte conversion in `insert-buffer'. |
|
|
(set-buffer-multibyte nil) |
|
|
(setq subfile-size (buffer-size)) |
|
1070 |
(set-buffer tar-superior-buffer) |
(set-buffer tar-superior-buffer) |
1071 |
(let* ((tokens (tar-desc-tokens descriptor)) |
(let* ((tokens (tar-desc-tokens descriptor)) |
1072 |
(start (tar-desc-data-start descriptor)) |
(start (tar-desc-data-start descriptor)) |
1074 |
(size (tar-header-size tokens)) |
(size (tar-header-size tokens)) |
1075 |
(size-pad (ash (ash (+ size 511) -9) 9)) |
(size-pad (ash (ash (+ size 511) -9) 9)) |
1076 |
(head (memq descriptor tar-parse-info)) |
(head (memq descriptor tar-parse-info)) |
1077 |
(following-descs (cdr head)) |
(following-descs (cdr head))) |
|
(tar-buffer-multibyte enable-multibyte-characters)) |
|
1078 |
(if (not head) |
(if (not head) |
1079 |
(error "Can't find this tar file entry in its parent tar file!")) |
(error "Can't find this tar file entry in its parent tar file!")) |
1080 |
(unwind-protect |
(unwind-protect |
1081 |
(save-excursion |
(save-excursion |
|
(widen) |
|
|
(set-buffer-multibyte nil) |
|
1082 |
;; delete the old data... |
;; delete the old data... |
1083 |
(let* ((data-start (+ start tar-header-offset -1)) |
(let* ((data-start (+ start tar-header-offset -1)) |
1084 |
(data-end (+ data-start (ash (ash (+ size 511) -9) 9)))) |
(data-end (+ data-start (ash (ash (+ size 511) -9) 9)))) |
1085 |
(delete-region data-start data-end) |
(narrow-to-region data-start data-end) |
1086 |
|
(delete-region (point-min) (point-max)) |
1087 |
;; insert the new data... |
;; insert the new data... |
1088 |
(goto-char data-start) |
(goto-char data-start) |
1089 |
(insert-buffer subfile) |
(save-excursion |
1090 |
(setq subfile-size |
(set-buffer subfile) |
1091 |
(encode-coding-region |
(save-restriction |
1092 |
data-start (+ data-start subfile-size) coding)) |
(widen) |
1093 |
|
(encode-coding-region 1 (point-max) coding tar-superior-buffer))) |
1094 |
|
(setq subfile-size (- (point-max) (point-min))) |
1095 |
;; |
;; |
1096 |
;; pad the new data out to a multiple of 512... |
;; pad the new data out to a multiple of 512... |
1097 |
(let ((subfile-size-pad (ash (ash (+ subfile-size 511) -9) 9))) |
(let ((subfile-size-pad (ash (ash (+ subfile-size 511) -9) 9))) |
1098 |
(goto-char (+ data-start subfile-size)) |
(goto-char (point-max)) |
1099 |
(insert (make-string (- subfile-size-pad subfile-size) 0)) |
(insert (make-string (- subfile-size-pad subfile-size) 0)) |
1100 |
;; |
;; |
1101 |
;; update the data pointer of this and all following files... |
;; update the data pointer of this and all following files... |
1106 |
(+ (tar-desc-data-start desc) difference)))) |
(+ (tar-desc-data-start desc) difference)))) |
1107 |
;; |
;; |
1108 |
;; Update the size field in the header block. |
;; Update the size field in the header block. |
1109 |
|
(widen) |
1110 |
(let ((header-start (- data-start 512))) |
(let ((header-start (- data-start 512))) |
1111 |
(goto-char (+ header-start tar-size-offset)) |
(goto-char (+ header-start tar-size-offset)) |
1112 |
(delete-region (point) (+ (point) 12)) |
(delete-region (point) (+ (point) 12)) |
1145 |
;; Insert the new text after the old, before deleting, |
;; Insert the new text after the old, before deleting, |
1146 |
;; to preserve the window start. |
;; to preserve the window start. |
1147 |
(let ((line (tar-header-block-summarize tokens t))) |
(let ((line (tar-header-block-summarize tokens t))) |
1148 |
(if (multibyte-string-p line) |
(insert-before-markers line "\n")) |
|
(insert-before-markers (string-as-unibyte line) "\n") |
|
|
(insert-before-markers line "\n"))) |
|
1149 |
(delete-region p after) |
(delete-region p after) |
1150 |
(setq tar-header-offset (marker-position m))) |
(setq tar-header-offset (marker-position m))) |
1151 |
))) |
))) |
1152 |
;; after doing the insertion, add any final padding that may be necessary. |
;; after doing the insertion, add any final padding that may be necessary. |
1153 |
(tar-pad-to-blocksize)) |
(tar-pad-to-blocksize)) |
1154 |
(narrow-to-region 1 tar-header-offset) |
(narrow-to-region 1 tar-header-offset))) |
|
(set-buffer-multibyte tar-buffer-multibyte))) |
|
1155 |
(set-buffer-modified-p t) ; mark the tar file as modified |
(set-buffer-modified-p t) ; mark the tar file as modified |
1156 |
(tar-next-line 0) |
(tar-next-line 0) |
1157 |
(set-buffer subfile) |
(set-buffer subfile) |
|
;; Restore the buffer multibyteness. |
|
|
(set-buffer-multibyte subfile-multibyte) |
|
1158 |
(set-buffer-modified-p nil) ; mark the tar subfile as unmodified |
(set-buffer-modified-p nil) ; mark the tar subfile as unmodified |
1159 |
(message "Saved into tar-buffer `%s'. Be sure to save that buffer!" |
(message "Saved into tar-buffer `%s'. Be sure to save that buffer!" |
1160 |
(buffer-name tar-superior-buffer)) |
(buffer-name tar-superior-buffer)) |
1204 |
;; tar-header-offset turns out to be null for files fetched with W3, |
;; tar-header-offset turns out to be null for files fetched with W3, |
1205 |
;; at least. |
;; at least. |
1206 |
(let ((coding-system-for-write 'no-conversion)) |
(let ((coding-system-for-write 'no-conversion)) |
1207 |
(write-region (if tar-header-offset |
(write-region (or tar-header-offset |
1208 |
(byte-to-position tar-header-offset) |
(point-min)) |
|
(point-min)) |
|
1209 |
(point-max) |
(point-max) |
1210 |
buffer-file-name nil t)) |
buffer-file-name nil t)) |
1211 |
(tar-clear-modification-flags) |
(tar-clear-modification-flags) |
1212 |
(set-buffer-modified-p nil)) |
(set-buffer-modified-p nil)) |
1213 |
(narrow-to-region 1 (byte-to-position tar-header-offset))) |
(narrow-to-region 1 tar-header-offset)) |
1214 |
;; Return t because we've written the file. |
;; Return t because we've written the file. |
1215 |
t) |
t) |
1216 |
|
|