/[emacs]/emacs/lisp/tar-mode.el
ViewVC logotype

Diff of /emacs/lisp/tar-mode.el

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.90 by monnier, Fri Sep 27 20:55:33 2002 UTC revision 1.91 by lektu, Tue Feb 4 12:07:54 2003 UTC
# Line 41  Line 41 
41  ;; This code now understands the extra fields that GNU tar adds to tar files.  ;; This code now understands the extra fields that GNU tar adds to tar files.
42    
43  ;; This interacts correctly with "uncompress.el" in the Emacs library,  ;; This interacts correctly with "uncompress.el" in the Emacs library,
44  ;; which you get with  ;; which you get with
45  ;;  ;;
46  ;;  (autoload 'uncompress-while-visiting "uncompress")  ;;  (autoload 'uncompress-while-visiting "uncompress")
47  ;;  (setq auto-mode-alist (cons '("\\.Z$" . uncompress-while-visiting)  ;;  (setq auto-mode-alist (cons '("\\.Z$" . uncompress-while-visiting)
# Line 49  Line 49 
49  ;;  ;;
50  ;; Do not attempt to use tar-mode.el with crypt.el, you will lose.  ;; Do not attempt to use tar-mode.el with crypt.el, you will lose.
51    
52  ;;    ***************   TO DO   ***************  ;;    ***************   TO DO   ***************
53  ;;  ;;
54  ;; o  chmod should understand "a+x,og-w".  ;; o  chmod should understand "a+x,og-w".
55  ;;  ;;
56  ;; o  It's not possible to add a NEW file to a tar archive; not that  ;; o  It's not possible to add a NEW file to a tar archive; not that
57  ;;    important, but still...  ;;    important, but still...
58  ;;  ;;
59  ;; o  The code is less efficient that it could be - in a lot of places, I  ;; o  The code is less efficient that it could be - in a lot of places, I
# Line 64  Line 64 
64  ;;    of an archive, where <esc> would leave you in a subfile-edit buffer.  ;;    of an archive, where <esc> would leave you in a subfile-edit buffer.
65  ;;    (Like the Meta-R command of the Zmacs mail reader.)  ;;    (Like the Meta-R command of the Zmacs mail reader.)
66  ;;  ;;
67  ;; o  Sometimes (but not always) reverting the tar-file buffer does not  ;; o  Sometimes (but not always) reverting the tar-file buffer does not
68  ;;    re-grind the listing, and you are staring at the binary tar data.  ;;    re-grind the listing, and you are staring at the binary tar data.
69  ;;    Typing 'g' again immediately after that will always revert and re-grind  ;;    Typing 'g' again immediately after that will always revert and re-grind
70  ;;    it, though.  I have no idea why this happens.  ;;    it, though.  I have no idea why this happens.
# Line 76  Line 76 
76  ;;    might be a problem if the tar write-file-hook does not come *first* on  ;;    might be a problem if the tar write-file-hook does not come *first* on
77  ;;    the list.  ;;    the list.
78  ;;  ;;
79  ;; o  Block files, sparse files, continuation files, and the various header  ;; o  Block files, sparse files, continuation files, and the various header
80  ;;    types aren't editable.  Actually I don't know that they work at all.  ;;    types aren't editable.  Actually I don't know that they work at all.
81    
82  ;; Rationale:  ;; Rationale:
# Line 103  Line 103 
103  (defcustom tar-anal-blocksize 20  (defcustom tar-anal-blocksize 20
104    "*The blocksize of tar files written by Emacs, or nil, meaning don't care.    "*The blocksize of tar files written by Emacs, or nil, meaning don't care.
105  The blocksize of a tar file is not really the size of the blocks; rather, it is  The blocksize of a tar file is not really the size of the blocks; rather, it is
106  the number of blocks written with one system call.  When tarring to a tape,  the number of blocks written with one system call.  When tarring to a tape,
107  this is the size of the *tape* blocks, but when writing to a file, it doesn't  this is the size of the *tape* blocks, but when writing to a file, it doesn't
108  matter much.  The only noticeable difference is that if a tar file does not  matter much.  The only noticeable difference is that if a tar file does not
109  have a blocksize of 20, tar will tell you that; all this really controls is  have a blocksize of 20, tar will tell you that; all this really controls is
# Line 117  If this is true, then editing and saving Line 117  If this is true, then editing and saving
117  tar file will update its datestamp.  If false, the datestamp is unchanged.  tar file will update its datestamp.  If false, the datestamp is unchanged.
118  You may or may not want this - it is good in that you can tell when a file  You may or may not want this - it is good in that you can tell when a file
119  in a tar archive has been changed, but it is bad for the same reason that  in a tar archive has been changed, but it is bad for the same reason that
120  editing a file in the tar archive at all is bad - the changed version of  editing a file in the tar archive at all is bad - the changed version of
121  the file never exists on disk."  the file never exists on disk."
122    :type 'boolean    :type 'boolean
123    :group 'tar)    :group 'tar)
# Line 201  This information is useful, but it takes Line 201  This information is useful, but it takes
201    
202  (defun tar-header-block-tokenize (string)  (defun tar-header-block-tokenize (string)
203    "Return a `tar-header' structure.    "Return a `tar-header' structure.
204  This is a list of name, mode, uid, gid, size,  This is a list of name, mode, uid, gid, size,
205  write-date, checksum, link-type, and link-name."  write-date, checksum, link-type, and link-name."
206    (cond ((< (length string) 512) nil)    (cond ((< (length string) 512) nil)
207          (;(some 'plusp string)           ; <-- oops, massive cycle hog!          (;(some 'plusp string)           ; <-- oops, massive cycle hog!
# Line 555  is visible (and the real data of the buf Line 555  is visible (and the real data of the buf
555  ;;;###autoload  ;;;###autoload
556  (define-derived-mode tar-mode nil "Tar"  (define-derived-mode tar-mode nil "Tar"
557    "Major mode for viewing a tar file as a dired-like listing of its contents.    "Major mode for viewing a tar file as a dired-like listing of its contents.
558  You can move around using the usual cursor motion commands.  You can move around using the usual cursor motion commands.
559  Letters no longer insert themselves.  Letters no longer insert themselves.
560  Type `e' to pull a file out of the tar file and into its own buffer;  Type `e' to pull a file out of the tar file and into its own buffer;
561  or click mouse-2 on the file's line in the Tar mode buffer.  or click mouse-2 on the file's line in the Tar mode buffer.
562  Type `c' to copy an entry from the tar file into another file on disk.  Type `c' to copy an entry from the tar file into another file on disk.
563    
564  If you edit a sub-file of this archive (as with the `e' command) and  If you edit a sub-file of this archive (as with the `e' command) and
565  save it with Control-x Control-s, the contents of that buffer will be  save it with Control-x Control-s, the contents of that buffer will be
566  saved back into the tar-file buffer; in this way you can edit a file  saved back into the tar-file buffer; in this way you can edit a file
567  inside of a tar archive without extracting it and re-archiving it.  inside of a tar archive without extracting it and re-archiving it.
568    
569  See also: variables `tar-update-datestamp' and `tar-anal-blocksize'.  See also: variables `tar-update-datestamp' and `tar-anal-blocksize'.
# Line 764  appear on disk when you save the tar-fil Line 764  appear on disk when you save the tar-fil
764                    (decode-coding-region (point-min) (point-max) coding)                    (decode-coding-region (point-min) (point-max) coding)
765                    (set-buffer-file-coding-system coding))                    (set-buffer-file-coding-system coding))
766                  ;; Set the default-directory to the dir of the                  ;; Set the default-directory to the dir of the
767                  ;; superior buffer.                  ;; superior buffer.
768                  (setq default-directory                  (setq default-directory
769                        (save-excursion                        (save-excursion
770                          (set-buffer tar-buffer)                          (set-buffer tar-buffer)
# Line 775  appear on disk when you save the tar-fil Line 775  appear on disk when you save the tar-fil
775                  (make-local-variable 'tar-superior-descriptor)                  (make-local-variable 'tar-superior-descriptor)
776                  (setq tar-superior-buffer tar-buffer)                  (setq tar-superior-buffer tar-buffer)
777                  (setq tar-superior-descriptor descriptor)                  (setq tar-superior-descriptor descriptor)
778                  (setq buffer-read-only read-only-p)                              (setq buffer-read-only read-only-p)
779                  (set-buffer-modified-p nil)                  (set-buffer-modified-p nil)
780                  (tar-subfile-mode 1))                  (tar-subfile-mode 1))
781                (set-buffer tar-buffer))                (set-buffer tar-buffer))
# Line 1064  for this to be permanent." Line 1064  for this to be permanent."
1064              (delete-region p (point))              (delete-region p (point))
1065              (insert (tar-header-block-summarize tokens) "\n")              (insert (tar-header-block-summarize tokens) "\n")
1066              (setq tar-header-offset (position-bytes (point-max))))              (setq tar-header-offset (position-bytes (point-max))))
1067              
1068            (widen)            (widen)
1069            (set-buffer-multibyte nil)            (set-buffer-multibyte nil)
1070            (let* ((start (+ (tar-desc-data-start descriptor) tar-header-offset -513)))            (let* ((start (+ (tar-desc-data-start descriptor) tar-header-offset -513)))

Legend:
Removed from v.1.90  
changed lines
  Added in v.1.91

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26