changeset 7497:2308d6e6404c

(tar-extract): Put tar name into subfile visited name. (tar-subfile-save-buffer): When updating the desc line, insert new text after, then delete.
author Richard M. Stallman <rms@gnu.org>
date Sat, 14 May 1994 09:18:02 +0000
parents 52b5bb0c70e8
children 0a30e271186f
files lisp/tar-mode.el
diffstat 1 files changed, 8 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/tar-mode.el	Sat May 14 08:59:22 1994 +0000
+++ b/lisp/tar-mode.el	Sat May 14 09:18:02 1994 +0000
@@ -683,7 +683,8 @@
 		(set-buffer buffer)
 		(insert-buffer-substring tar-buffer start end)
 		(goto-char 0)
-		(set-visited-file-name name) ; give it a name to decide mode.
+		;; Give it a name for lit-buffers and to decide mode.
+		(set-visited-file-name (concat tarname ":" name))
 		(normal-mode)  ; pick a mode.
 ;;; Without a file name, save-buffer doesn't work.
 ;;;		(set-visited-file-name nil)  ; nuke the name - not meaningful.
@@ -1078,10 +1079,14 @@
 	      (next-line position)
 	      (beginning-of-line)
 	      (let ((p (point))
+		    after
 		    (m (set-marker (make-marker) tar-header-offset)))
 		(forward-line 1)
-		(delete-region p (point))
+		(setq after (point))
+		;; Insert the new text after the old, before deleting,
+		;; to preserve the window start.
 		(insert-before-markers (summarize-tar-header-block tokens t) "\n")
+		(delete-region p after)
 		(setq tar-header-offset (marker-position m)))
 	      )))
 	;; after doing the insertion, add any final padding that may be necessary.
@@ -1090,7 +1095,7 @@
     (set-buffer-modified-p t)   ; mark the tar file as modified
     (set-buffer subfile)
     (set-buffer-modified-p nil) ; mark the tar subfile as unmodified
-    (message "saved into tar-buffer \"%s\" - remember to save that buffer!"
+    (message "saved into tar-buffer `%s' -- remember to save that buffer!"
 	     (buffer-name tar-superior-buffer))
     ;; Prevent ordinary saving from happening.
     t)))