tùy chọn Bạn đã có ...
Để giải nén một file .zip, bạn chỉ cần thêm vào biến 'dired-compress-file-suffixes
(eval-after-load "dired-aux"
'(add-to-list 'dired-compress-file-suffixes
'("\\.zip\\'" ".zip" "unzip")))
Bây giờ Z
quan trọng trong dired sẽ nhận ra .zip mở rộng và giải nén tệp nén .zip. Đã được hỗ trợ là gunzip
, bunzip2
, uncompress
và dictunzip
.
Nếu bạn muốn đánh dấu tập tin và thêm chúng vào một .zip lưu trữ, bạn có thể sử dụng sau đây để làm z
ràng buộc để nén tập các file rõ rệt:
(eval-after-load "dired"
'(define-key dired-mode-map "z" 'dired-zip-files))
(defun dired-zip-files (zip-file)
"Create an archive containing the marked files."
(interactive "sEnter name of zip file: ")
;; create the zip file
(let ((zip-file (if (string-match ".zip$" zip-file) zip-file (concat zip-file ".zip"))))
(shell-command
(concat "zip "
zip-file
" "
(concat-string-list
(mapcar
'(lambda (filename)
(file-name-nondirectory filename))
(dired-get-marked-files))))))
(revert-buffer)
;; remove the mark on all the files "*" to " "
;; (dired-change-marks 42 ?\040)
;; mark zip file
;; (dired-mark-files-regexp (filename-to-regexp zip-file))
)
(defun concat-string-list (list)
"Return a string which is a concatenation of all elements of the list separated by spaces"
(mapconcat '(lambda (obj) (format "%s" obj)) list " "))
Nguồn
2009-09-16 10:11:09
không 'Z' làm nó ra -hộp? (hoặc đánh dấu nó bằng 'm' và sau đó nhấn 'Z'). Tôi nhớ lại nó đã làm việc cho tôi một thời gian trở lại. Tôi thấy nó ở đây: http://xahlee.org/emacs/file_management.html – hatmatrix
'Z' sẽ nén các tệp, mỗi tệp riêng lẻ. Nó không thêm chúng vào một kho lưu trữ/zip. –
Dường như concat-string-list không tồn tại: concat: Định nghĩa hàm của biểu tượng bị vô hiệu: concat-string-list –