changeset 46926:dd4d628efd2e

(tar-subfile-mode): Use add-hook and remove-hook, and use write-file-functions instead of local-write-file-hooks. (tar-untar-buffer): Don't try to extract directories.
author Richard M. Stallman <rms@gnu.org>
date Sat, 17 Aug 2002 05:00:30 +0000
parents 9ce7894d4af8
children e1aab27b11be
files lisp/tar-mode.el
diffstat 1 files changed, 8 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/tar-mode.el	Sat Aug 17 04:59:14 2002 +0000
+++ b/lisp/tar-mode.el	Sat Aug 17 05:00:30 2002 +0000
@@ -388,11 +388,12 @@
 		   (dir (file-name-directory name))
 		   (start (+ (tar-desc-data-start descriptor) tar-header-offset -1))
 		   (end (+ start (tar-header-size tokens))))
-	      (message "Extracting %s" name)
-	      (if (and dir (not (file-exists-p dir)))
-		  (make-directory dir t))
-	      (write-region start end name)
-	      (set-file-modes name (tar-header-mode tokens)))))
+	      (unless (file-directory-p name)
+		(message "Extracting %s" name)
+		(if (and dir (not (file-exists-p dir)))
+		    (make-directory dir t))
+		(write-region start end name)
+		(set-file-modes name (tar-header-mode tokens))))))
       (set-buffer-multibyte multibyte))))
 
 (defun tar-summarize-buffer ()
@@ -604,14 +605,13 @@
 	    (not tar-subfile-mode)
 	    (> (prefix-numeric-value p) 0)))
   (cond (tar-subfile-mode
-	 (make-local-variable 'local-write-file-hooks)
-	 (setq local-write-file-hooks '(tar-subfile-save-buffer))
+	 (add-hook 'write-file-functions 'tar-subfile-save-buffer nil t)
 	 ;; turn off auto-save.
 	 (auto-save-mode -1)
 	 (setq buffer-auto-save-file-name nil)
 	 (run-hooks 'tar-subfile-mode-hook))
 	(t
-	 (kill-local-variable 'local-write-file-hooks))))
+	 (remove-hook 'write-file-functions 'tar-subfile-save-buffer t))))
 
 
 ;; Revert the buffer and recompute the dired-like listing.