help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

make dired-do-compress to use zip instead of gzip


From: Xah Lee
Subject: make dired-do-compress to use zip instead of gzip
Date: Mon, 7 Apr 2008 11:39:20 -0700 (PDT)
User-agent: G2/1.0

is it possible to customize the Z shortcut in dired (dired-do-
compress) so that it uses zip instead of gzip?

i started to code the following:

(defun dired-do-zip ()
  "Zip or unzip marked (or next ARG) files."
  (interactive)
  (mapc 'zipit (dired-get-marked-files))
)

(defun zipit (fpath)
  "Zip the file."
  (let (suffix)
    (setq suffix (file-name-extension fpath))
    (if (eq suffix ".zip")
        (progn
          (shell-command (concat "unzip" fpath))
          )
      (progn
        (shell-command (concat "zip " fpath " " fpath ".zip") )
        ))))

but it's unsatisfactory for several reasons... it doesn't delete the
original (and if i add code to delete, it gets quite involved in
making sure the archive is complete), it doesn't update dired, it
doesn't check for overwritting files, ... etc.

  Xah
  xah@xahlee.org
∑ http://xahlee.org/

reply via email to

[Prev in Thread] Current Thread [Next in Thread]