]> code.delx.au - gnu-emacs/blobdiff - lisp/arc-mode.el
*** empty log message ***
[gnu-emacs] / lisp / arc-mode.el
index 583b8c25426de77388a04c7007118a7a8cb1694d..7ac7a402c3ad0a7be7fef72ed3fe15110886b7cc 100644 (file)
@@ -2,7 +2,7 @@
 
 ;; Copyright (C) 1995, 1997, 1998, 2003 Free Software Foundation, Inc.
 
-;; Author: Morten Welinder <terra@diku.dk>
+;; Author: Morten Welinder <terra@gnu.org>
 ;; Keywords: archives msdog editing major-mode
 ;; Favourite-brand-of-beer: None, I hate beer.
 
@@ -324,16 +324,16 @@ Archive and member name will be added."
 ;; -------------------------------------------------------------------------
 ;; Section: Variables
 
-(defvar archive-subtype nil "*Symbol describing archive type.")
-(defvar archive-file-list-start nil "*Position of first contents line.")
-(defvar archive-file-list-end nil "*Position just after last contents line.")
-(defvar archive-proper-file-start nil "*Position of real archive's start.")
-(defvar archive-read-only nil "*Non-nil if the archive is read-only on disk.")
-(defvar archive-local-name nil "*Name of local copy of remote archive.")
-(defvar archive-mode-map nil "*Local keymap for archive mode listings.")
-(defvar archive-file-name-indent nil "*Column where file names start.")
+(defvar archive-subtype nil "Symbol describing archive type.")
+(defvar archive-file-list-start nil "Position of first contents line.")
+(defvar archive-file-list-end nil "Position just after last contents line.")
+(defvar archive-proper-file-start nil "Position of real archive's start.")
+(defvar archive-read-only nil "Non-nil if the archive is read-only on disk.")
+(defvar archive-local-name nil "Name of local copy of remote archive.")
+(defvar archive-mode-map nil "Local keymap for archive mode listings.")
+(defvar archive-file-name-indent nil "Column where file names start.")
 
-(defvar archive-remote nil "*Non-nil if the archive is outside file system.")
+(defvar archive-remote nil "Non-nil if the archive is outside file system.")
 (make-variable-buffer-local 'archive-remote)
 (put 'archive-remote 'permanent-local t)
 
@@ -341,14 +341,14 @@ Archive and member name will be added."
 (make-variable-buffer-local 'archive-member-coding-system)
 
 (defvar archive-alternate-display nil
-  "*Non-nil when alternate information is shown.")
+  "Non-nil when alternate information is shown.")
 (make-variable-buffer-local 'archive-alternate-display)
 (put 'archive-alternate-display 'permanent-local t)
 
-(defvar archive-superior-buffer nil "*In archive members, points to archive.")
+(defvar archive-superior-buffer nil "In archive members, points to archive.")
 (put 'archive-superior-buffer 'permanent-local t)
 
-(defvar archive-subfile-mode nil "*Non-nil in archive member buffers.")
+(defvar archive-subfile-mode nil "Non-nil in archive member buffers.")
 (make-variable-buffer-local 'archive-subfile-mode)
 (put 'archive-subfile-mode 'permanent-local t)
 
@@ -757,7 +757,7 @@ when parsing the archive."
    (apply
     (function concat)
     (mapcar
-     (function 
+     (function
       (lambda (fil)
        ;; Using `concat' here copies the text also, so we can add
        ;; properties without problems.
@@ -894,8 +894,7 @@ using `make-temp-file', and the generated name is returned."
        (setq last-coding-system-used coding))
       (set-buffer-modified-p nil)
       (kill-local-variable 'buffer-file-coding-system)
-      (after-insert-file-set-buffer-file-coding-system (- (point-max)
-                                                         (point-min))))))
+      (after-insert-file-set-coding (- (point-max) (point-min))))))
 
 (defun archive-mouse-extract (event)
   "Extract a file whose name you click on."
@@ -1417,7 +1416,8 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
     (while (progn (goto-char p)                ;beginning of a base header.
                  (looking-at "\\(.\\|\n\\)\\(.\\|\n\\)-l[hz][0-9ds]-"))
       (let* ((hsize   (char-after p))  ;size of the base header (level 0 and 1)
-             (csize   (archive-l-e (+ p 7) 4)) ;size of a compressed file to follow.
+            (csize   (archive-l-e (+ p 7) 4)) ;size of a compressed file to follow (level 0 and 2),
+                                       ;size of extended headers + the compressed file to follow (level 1).
              (ucsize  (archive-l-e (+ p 11) 4))        ;size of an uncompressed file.
             (time1   (archive-l-e (+ p 15) 2)) ;date/time (MSDOS format in level 0, 1 headers
             (time2   (archive-l-e (+ p 17) 2)) ;and UNIX format in level 2 header.)
@@ -1486,10 +1486,10 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
              (setq thsize (- neh p))))
        (if (= hdrlvl 0)  ;total header size
            (setq thsize hsize))
-       (setq fiddle  (string= efnname (upcase efnname)))
+       (setq fiddle  (if efnname (string= efnname (upcase efnname))))
        (setq ifnname (if fiddle (downcase efnname) efnname))
        (setq prname (if dir (concat dir ifnname) ifnname))
-       (setq width (string-width prname))
+       (setq width (if prname (string-width prname) 0))
        (setq modestr (if mode (archive-int-to-mode mode) "??????????"))
        (setq moddate (if (= hdrlvl 2)
                          (archive-unixdate time1 time2) ;level 2 header in UNIX format
@@ -1516,8 +1516,12 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
                                   (length text))
                           visual)
              files (cons (vector prname ifnname fiddle mode (1- p))
-                          files)
-              p (+ p thsize 2 csize))))
+                          files))
+       (cond ((= hdrlvl 1)
+              (setq p (+ p hsize 2 csize)))
+             ((or (= hdrlvl 2) (= hdrlvl 0))
+              (setq p (+ p thsize 2 csize))))
+       ))
     (goto-char (point-min))
     (set-buffer-multibyte default-enable-multibyte-characters)
     (let ((dash (concat (if archive-alternate-display
@@ -1797,4 +1801,5 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
 
 (provide 'arc-mode)
 
+;;; arch-tag: e5966a01-35ec-4f27-8095-a043a79b457b
 ;;; arc-mode.el ends here