Index: arc-mode.el
===================================================================
RCS file: /pack/xemacscvs/XEmacs/packages/xemacs-packages/os-utils/arc-mode.el,v
retrieving revision 1.4
diff -u -r1.4 arc-mode.el
--- arc-mode.el	6 Jan 2003 18:31:19 -0000	1.4
+++ arc-mode.el	29 Jan 2005 13:49:41 -0000
@@ -1,9 +1,9 @@
 ;;; arc-mode.el --- simple editing of archives
 
-;; Copyright (C) 1995 Free Software Foundation, Inc.
+;; Copyright (C) 1995, 1997 Free Software Foundation, Inc.
 
-;; Author: Morten Welinder (terra@diku.dk)
-;; Keywords: data, unix
+;; Author: Morten Welinder <terra@diku.dk>
+;; Keywords: archives msdog editing major-mode
 ;; Favourite-brand-of-beer: None, I hate beer.
 
 ;; This file is part of XEmacs.
@@ -23,7 +23,9 @@
 ;; Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 ;; 02111-1307, USA.
 
-;;; Synched up with: FSF 19.34.
+;;; Synched up with: GNU Emacs 20.2, with differences in comparing chars with
+;;; `eq' instead of `=', and applying `char-int' to various `memq's, and
+;;; using #o instead of ?\ for octal numbers.  See also inline comments.
 
 ;;; Commentary:
 
@@ -336,27 +338,19 @@
 (make-variable-buffer-local 'archive-subfile-mode)
 (put 'archive-subfile-mode 'permanent-local t)
 
-;; buffer-file-type is a per-buffer variable in the msdog configuration
-(if (boundp 'buffer-file-type) nil
-  (defvar buffer-file-type nil
-    "*Nil for dos-style text file, non-nil otherwise.")
-  (make-variable-buffer-local 'buffer-file-type)
-  (put 'buffer-file-type 'permanent-local t)
-  (setq-default buffer-file-type nil))
-
 (defvar archive-subfile-dos nil
-  "Negation of `buffer-file-type' which see.")
+  "Negation of `buffer-file-type', which see.")
 (make-variable-buffer-local 'archive-subfile-dos)
 (put 'archive-subfile-dos 'permanent-local t)
 
-(defvar archive-files nil "Vector of file descriptors.  Each descriptor is
-a vector of [ext-file-name int-file-name case-fiddled mode ...]")
+(defvar archive-files nil
+  "Vector of file descriptors.
+Each descriptor is a vector of the form
+ [EXT-FILE-NAME INT-FILE-NAME CASE-FIDDLED MODE ...]")
 (make-variable-buffer-local 'archive-files)
 
-;; XEmacs change
-(defvar archive-xemacs
-  (string-match "\\(Lucid\\|XEmacs\\)" emacs-version)
-  "*Non-nil when running under Lucid Emacs or XEmacs.")
+;; XEmacs change: `archive-lemacs' removed, `running-xemacs' used instead.
+
 ;; -------------------------------------------------------------------------
 ;; Section: Support functions.
 
@@ -537,7 +531,8 @@
 	(setq require-final-newline nil)
 	(make-local-variable 'enable-local-variables)
 	(setq enable-local-variables nil)
-	(setq buffer-file-type t)
+	(if (boundp 'default-buffer-file-type)
+	    (setq buffer-file-type t))
 
 	(make-local-variable 'archive-read-only)
 	(setq archive-read-only (not (file-writable-p (buffer-file-name))))
@@ -564,6 +559,7 @@
 ;; Archive mode is suitable only for specially formatted data.
 (put 'archive-mode 'mode-class 'special)
 
+;; XEmacs addition
 (defun archive-quit ()
   "Bury the current archive buffer."
   (interactive)
@@ -598,6 +594,7 @@
   (define-key archive-mode-map "\M-\C-?" 'archive-unmark-all-files)
   (define-key archive-mode-map "v" 'archive-view)
   (define-key archive-mode-map "x" 'archive-expunge)
+  ;; XEmacs: "\177" -> 'backspace and 'delete.
   (define-key archive-mode-map 'backspace 'archive-unflag-backwards)
   (define-key archive-mode-map 'delete 'archive-unflag-backwards)
   (define-key archive-mode-map "E" 'archive-extract-other-window)
@@ -605,7 +602,7 @@
   (define-key archive-mode-map "G" 'archive-chgrp-entry)
   (define-key archive-mode-map "O" 'archive-chown-entry)
 
-  (if archive-xemacs
+  (if running-xemacs
       (progn
 	;; Not a nice "solution" but it'll have to do
 	(define-key archive-mode-map "q" 'archive-quit)
@@ -615,9 +612,9 @@
 			       archive-mode-map global-map))
 
   (define-key archive-mode-map
-    (if archive-xemacs 'button2 [mouse-2]) 'archive-mouse-extract)
+    (if running-xemacs 'button2 [mouse-2]) 'archive-mouse-extract)
 
-  (if archive-xemacs
+  (if running-xemacs
       ()				; out of luck
     ;; Get rid of the Edit menu bar item to save space.
     (define-key archive-mode-map [menu-bar edit] 'undefined)
@@ -726,7 +723,7 @@
     (archive-next-line no)))
 
 (defun archive-summarize-files (files)
-  "Insert a description of a list of files annotated with proper mouse face"
+  "Insert a description of a list of files annotated with proper mouse face."
   (setq archive-file-list-start (point-marker))
   (setq archive-file-name-indent (if files (aref (car files) 1) 0))
   ;; We don't want to do an insert for each element since that takes too
@@ -740,11 +737,10 @@
 	;; Using `concat' here copies the text also, so we can add
 	;; properties without problems.
 	(let ((text (concat (aref fil 0) "\n")))
-	  (if archive-xemacs
-	      ()			; out of luck
-	    (put-text-property (aref fil 1) (aref fil 2)
-			       'mouse-face 'highlight
-			       text))
+	  ;; XEmacs change: enabled for XEmacs too.
+	  (put-text-property (aref fil 1) (aref fil 2)
+			     'mouse-face 'highlight
+			     text)
 	  text)))
      files)))
   (setq archive-file-list-end (point-marker)))
@@ -846,8 +842,9 @@
           (make-local-variable 'local-write-file-hooks)
           (add-hook 'local-write-file-hooks 'archive-write-file-member)
           (setq archive-subfile-mode descr)
-	  (setq archive-subfile-dos nil
-		buffer-file-type t)
+	  (setq archive-subfile-dos nil)
+	  (if (boundp 'default-buffer-file-type)
+	      (setq buffer-file-type t))
 	  (if (fboundp extractor)
 	      (funcall extractor archive ename)
 	    (archive-*-extract archive ename (symbol-value extractor)))
@@ -865,6 +862,7 @@
 	  (run-hooks 'archive-extract-hooks))
 	(archive-maybe-update t))
       (if view-p
+	  ;; XEmacs change: `view-buffer's 2nd arg difference
           (progn
             (view-buffer buffer)
             (and just-created (setq view-exit-action 'kill-buffer)))
@@ -961,7 +959,8 @@
       (goto-char (point-min))
       (setq archive-subfile-dos
 	    (or force (not (search-forward-regexp "[^\r]\n" nil t))))
-      (setq buffer-file-type (not archive-subfile-dos))
+      (if (boundp 'default-buffer-file-type)
+	  (setq buffer-file-type (not archive-subfile-dos)))
       (if archive-subfile-dos
           (let ((modified (buffer-modified-p)))
             (buffer-disable-undo (current-buffer))
@@ -985,7 +984,8 @@
                   (while (search-forward "\n" nil t)
                     (replace-match "\r\n"))
                   (setq archive-subfile-dos nil)
-                  (setq buffer-file-type t)
+		  (if (boundp 'default-buffer-file-type)
+		      (setq buffer-file-type t))
                   ;; OK, we're now have explicit ^M^Js -- save and re-unixfy
                   (archive-write-file-member))
               (progn
@@ -1202,8 +1202,8 @@
 	  (archive-resummarize))
       (error "Renaming is not supported for this archive type"))))
 
-;; Revert the buffer and recompute the dired-like listing.
 (defun archive-mode-revert (&optional no-autosave no-confirm)
+  "Revert the buffer and recompute the dired-like listing."
   (let ((no (archive-get-lineno)))
     (setq archive-files nil)
     (let ((revert-buffer-function nil))
@@ -1591,7 +1591,7 @@
 ;; -------------------------------------------------------------------------
 
 ;; XEmacs addition
-;;;###autoload(add-to-list 'auto-mode-alist '("\\.\\(?:arc\\|zip\\|lzh\\|zoo\\)\\'" . archive-mode))
+;;;###autoload(add-to-list 'auto-mode-alist '("\\.\\(?:arc\\|[ejw]ar\\|zip\\|lzh\\|zoo\\)\\'" . archive-mode))
 
 (provide 'archive-mode)
 
