]> code.delx.au - gnu-emacs/blobdiff - lisp/arc-mode.el
(report_file_error): String pointer args now point to
[gnu-emacs] / lisp / arc-mode.el
index 4afb71509c7473df7b0717468d06d6a656e2cfe3..7265cb09045804ff54331dc556f21593cd9555c1 100644 (file)
@@ -88,7 +88,7 @@
 ;;             Each member header points to the next.  The archive is
 ;;             terminated by a bogus header with a zero next link.
 ;; -------------------------------------
-;; HOOKS: `foo' means one the the supported archive types.
+;; HOOKS: `foo' means one of the supported archive types.
 ;;
 ;; archive-mode-hook
 ;; archive-foo-mode-hook
   :group 'archive)
 
 (defcustom archive-tmpdir
+  ;; make-temp-name is safe here because we use this name
+  ;; to create a directory.
   (make-temp-name
    (expand-file-name (if (eq system-type 'ms-dos) "ar" "archive.tmp")
                     temporary-file-directory))
@@ -209,14 +211,12 @@ Archive and member name will be added."
 ;; ------------------------------
 ;; Zip archive configuration
 
-(defcustom archive-zip-use-pkzip (memq system-type '(ms-dos windows-nt))
-  "*If non-nil then pkzip option are used instead of zip options.
-Only set to true for msdog systems!"
-  :type 'boolean
-  :group 'archive-zip)
-
 (defcustom archive-zip-extract
-  (if archive-zip-use-pkzip '("pkunzip" "-e" "-o-") '("unzip" "-qq" "-c"))
+  (if (locate-file "unzip" nil 'file-executable-p)
+      '("unzip" "-qq" "-c")
+    (if (locate-file "pkunzip" nil 'file-executable-p)
+       '("pkunzip" "-e" "-o-")
+      '("unzip" "-qq" "-c")))
   "*Program and its options to run in order to extract a zip file member.
 Extraction should happen to standard output.  Archive and member name will
 be added.  If `archive-zip-use-pkzip' is non-nil then this program is
@@ -233,7 +233,11 @@ expected to extract to a file junking the directory part of the name."
 ;; names.
 
 (defcustom archive-zip-expunge
-  (if archive-zip-use-pkzip '("pkzip" "-d") '("zip" "-d" "-q"))
+  (if (locate-file "zip" nil 'file-executable-p)
+      '("zip" "-d" "-q")
+    (if (locate-file "pkzip" nil 'file-executable-p)
+        '("pkzip" "-d")
+      '("zip" "-d" "-q")))
   "*Program and its options to run in order to delete zip file members.
 Archive and member names will be added."
   :type '(list (string :tag "Program")
@@ -243,7 +247,11 @@ Archive and member names will be added."
   :group 'archive-zip)
 
 (defcustom archive-zip-update
-  (if archive-zip-use-pkzip '("pkzip" "-u" "-P") '("zip" "-q"))
+  (if (locate-file "zip" nil 'file-executable-p)
+      '("zip" "-q")
+    (if (locate-file "pkzip" nil 'file-executable-p)
+        '("pkzip" "-u" "-P")
+      '("zip" "-q")))
   "*Program and its options to run in order to update a zip file member.
 Options should ensure that specified directory will be put into the zip
 file.  Archive and member name will be added."
@@ -254,7 +262,11 @@ file.  Archive and member name will be added."
   :group 'archive-zip)
 
 (defcustom archive-zip-update-case
-  (if archive-zip-use-pkzip archive-zip-update '("zip" "-q" "-k"))
+  (if (locate-file "zip" nil 'file-executable-p)
+      '("zip" "-q" "-k")
+    (if (locate-file "pkzip" nil 'file-executable-p)
+        '("pkzip" "-u" "-P")
+      '("zip" "-q" "-k")))
   "*Program and its options to run in order to update a case fiddled zip member.
 Options should ensure that specified directory will be put into the zip file.
 Archive and member name will be added."
@@ -447,7 +459,7 @@ the mode is invalid.  If ERROR is nil then nil will be returned."
 (defun archive-dostime (time)
   "Stringify dos packed TIME record."
   (let ((hour (logand (ash time -11) 31))
-        (minute (logand (ash time -5) 53))
+        (minute (logand (ash time -5) 63))
         (second (* 2 (logand time 31)))) ; 2 seconds resolution
     (format "%02d:%02d:%02d" hour minute second)))
 
@@ -692,7 +704,7 @@ archive.
                (string-match "\\.[aA][rR][cC]$"
                              (or buffer-file-name (buffer-name))))
           'arc)
-         (t (error "Buffer format not recognized.")))))
+         (t (error "Buffer format not recognized")))))
 ;; -------------------------------------------------------------------------
 (defun archive-summarize (&optional shut-up)
   "Parse the contents of the archive file in the current buffer.
@@ -746,9 +758,11 @@ when parsing the archive."
        (let ((text (concat (aref fil 0) "\n")))
          (if archive-lemacs
              ()                        ; out of luck
-           (put-text-property (aref fil 1) (aref fil 2)
-                              'mouse-face 'highlight
-                              text))
+           (add-text-properties
+            (aref fil 1) (aref fil 2)
+            '(mouse-face highlight
+              help-echo "mouse-2: extract this file into a buffer")
+            text))
          text)))
      files)))
   (setq archive-file-list-end (point-marker)))
@@ -1633,7 +1647,7 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
     (apply 'vector (nreverse files))))
 
 (defun archive-zip-extract (archive name)
-  (if archive-zip-use-pkzip
+  (if (equal (car archive-zip-extract) "pkzip")
       (archive-*-extract archive name archive-zip-extract)
     (archive-extract-by-stdout archive name archive-zip-extract)))
 
@@ -1742,4 +1756,4 @@ This doesn't recover lost files, it just undoes changes in the buffer itself."
 
 (provide 'arc-mode)
 
-;; arc-mode.el ends here.
+;;; arc-mode.el ends here