Subject: bug#8968: arc-mode 7z writing support

From: Juri Linkov <[email-masked]>
Date: Tue, 05 Jul 2011 01:22:18 +0300

>> I'd like to install a patch that implements update/delete operations
>> for 7z archives in arc-mode.el:
>
> Go ahead,

Done.

Some users prefer using 7z even for operations on zip archives.

This patch provides the right default values for them in case
7z is installed on the system instead of zip/unzip.

For searching the available programs it uses exactly the same logic
as already is implemented in `archive-zip-extract' (i.e. first try
to find zip/unzip, then 7z, and finally pkzip/pkunzip):

=== modified file 'lisp/arc-mode.el'
--- lisp/arc-mode.el	2011-04-19 13:44:55 +0000
+++ lisp/arc-mode.el	2011-07-04 21:44:48 +0000
@@ -235,10 +235,10 @@ (defcustom archive-zip-extract
 ;; names.
 
 (defcustom archive-zip-expunge
-  (if (and (not (executable-find "zip"))
-           (executable-find "pkzip"))
-      '("pkzip" "-d")
-    '("zip" "-d" "-q"))
+  (cond ((executable-find "zip")     '("zip" "-d" "-q"))
+	((executable-find "7z")      '("7z" "d"))
+	((executable-find "pkzip")   '("pkzip" "-d"))
+	(t                           '("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")
@@ -248,10 +248,10 @@ (defcustom archive-zip-expunge
   :group 'archive-zip)
 
 (defcustom archive-zip-update
-  (if (and (not (executable-find "zip"))
-           (executable-find "pkzip"))
-      '("pkzip" "-u" "-P")
-    '("zip" "-q"))
+  (cond ((executable-find "zip")     '("zip" "-q"))
+	((executable-find "7z")      '("7z" "u"))
+	((executable-find "pkzip")   '("pkzip" "-u" "-P"))
+	(t                           '("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."
@@ -262,10 +262,10 @@ (defcustom archive-zip-update
   :group 'archive-zip)
 
 (defcustom archive-zip-update-case
-  (if (and (not (executable-find "zip"))
-           (executable-find "pkzip"))
-      '("pkzip" "-u" "-P")
-    '("zip" "-q" "-k"))
+  (cond ((executable-find "zip")     '("zip" "-q" "-k"))
+	((executable-find "7z")      '("7z" "u"))
+	((executable-find "pkzip")   '("pkzip" "-u" "-P"))
+	(t                           '("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."