Fix the expunge operation.
[bpt/emacs.git] / lisp / arc-mode.el
index 33d535c..ddbedeb 100644 (file)
@@ -230,7 +230,7 @@ be added."
                        (string :format "%v")))
   :group 'archive-zip)
 
-;; For several reasons the latter behaviour is not desirable in general.
+;; For several reasons the latter behavior is not desirable in general.
 ;; (1) It uses more disk space.  (2) Error checking is worse or non-
 ;; existent.  (3) It tends to do funny things with other systems' file
 ;; names.
@@ -723,7 +723,7 @@ archive.
                (string-match "\\.[aA][rR][cC]$"
                              (or buffer-file-name (buffer-name))))
           'arc)
-          ;; This pattern modelled on the BSD/GNU+Linux `file' command.
+          ;; This pattern modeled on the BSD/GNU+Linux `file' command.
           ;; Have seen capital "LHA's", and file has lower case "LHa's" too.
           ;; Note this regexp is also in archive-exe-p.
           ((looking-at "MZ\\(.\\|\n\\)\\{34\\}LH[aA]'s SFX ") 'lzh-exe)
@@ -1059,7 +1059,7 @@ using `make-temp-file', and the generated name is returned."
                 nil
                 nil
                 (append (cdr command) (list archive name))))
-    (cond ((and (numberp exit-status) (= exit-status 0))
+    (cond ((and (numberp exit-status) (zerop exit-status))
           (if (not (file-exists-p tmpfile))
               (ding (message "`%s': no such file or directory" tmpfile))
             (insert-file-contents tmpfile)
@@ -1117,7 +1117,7 @@ using `make-temp-file', and the generated name is returned."
                          (file-name-nondirectory buffer-file-name)
                        ""))))
   (with-current-buffer arcbuf
-    (or (eq major-mode 'archive-mode)
+    (or (derived-mode-p 'archive-mode)
        (error "Buffer is not an archive buffer"))
     (if archive-read-only
        (error "Archive is read-only")))
@@ -1171,7 +1171,7 @@ using `make-temp-file', and the generated name is returned."
          ;; the dired-like listing we created.
          (if (eq major-mode 'archive-mode)
              (archive-write-file tmpfile)
-           (write-region (point-min) (point-max) tmpfile nil 'nomessage))
+           (write-region nil nil tmpfile nil 'nomessage))
          ;; basic-save-buffer needs last-coding-system-used to have
          ;; the value used to write the file, so save it before any
          ;; further processing clobbers it (we restore it in
@@ -1190,9 +1190,8 @@ using `make-temp-file', and the generated name is returned."
                                  nil
                                  (append (cdr command)
                                          (list archive ename)))))
-            (if (equal exitcode 0)
-                nil
-              (error "Updating was unsuccessful (%S)" exitcode))))
+            (or (zerop exitcode)
+               (error "Updating was unsuccessful (%S)" exitcode))))
       (archive-delete-local tmpfile))))
 
 (defun archive-write-file (&optional file)
@@ -1732,7 +1731,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
                         str archive-file-name-coding-system)))
             (isdir   (and (= ucsize 0)
                           (string= (file-name-nondirectory efnname) "")))
-            (mode    (cond ((memq creator '(2 3)) ; Unix + VMS
+            (mode    (cond ((memq creator '(2 3)) ; Unix
                             (archive-l-e (+ p 40) 2))
                            ((memq creator '(0 5 6 7 10 11 15)) ; Dos etc.
                             (logior ?\444
@@ -1801,7 +1800,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
               (oldmode (aref fil 3))
               (newval  (archive-calc-mode oldmode newmode t))
               (inhibit-read-only t))
-         (cond ((memq creator '(2 3)) ; Unix + VMS
+         (cond ((memq creator '(2 3)) ; Unix
                 (goto-char (+ p 40))
                 (delete-char 2)
                 (insert-unibyte (logand newval 255) (lsh newval -8)))