From: Juri Linkov Date: Mon, 4 Jul 2011 22:11:40 +0000 (+0300) Subject: Add 7z operations to delete and save changed members. X-Git-Tag: emacs-pretest-24.0.90~104^2~152^2~184 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=ac89b32c15b8962fd388b1f568f0945885a017c7;p=emacs.git Add 7z operations to delete and save changed members. * lisp/arc-mode.el (archive-7z-expunge, archive-7z-update): New defcustoms. (archive-7z-write-file-member): New function. (archive-7z-summarize): Fix the number of dashes in the listing output. Fixes: debbugs:8968 --- diff --git a/etc/NEWS b/etc/NEWS index 01b767b62f7..d123073bd79 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -485,7 +485,7 @@ Just set shell-dir-cookie-re to an appropriate regexp. ** FIXME: xdg-open for browse-url and reportbug, 2010/08. -** Archive Mode has basic support to browse 7z archives. +** Archive Mode has basic support to browse and update 7z archives. ** browse-url has gotten a new variable that is used for mailto: URLs, `browse-url-mailto-function', which defaults to `browse-url-mail'. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 278ead6a9b8..d7def506d98 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2011-07-04 Juri Linkov + + Add 7z operations to delete and save changed members (bug#8968). + * arc-mode.el (archive-7z-expunge, archive-7z-update): + New defcustoms. + (archive-7z-write-file-member): New function. + (archive-7z-summarize): Fix the number of dashes in the + listing output. + 2011-07-04 Stefan Monnier * pcmpl-linux.el (pcomplete-pare-list): Re-add, from pcomplete.el diff --git a/lisp/arc-mode.el b/lisp/arc-mode.el index 0d129856f1d..e0a587c7607 100644 --- a/lisp/arc-mode.el +++ b/lisp/arc-mode.el @@ -55,9 +55,9 @@ ;; -------------------------------------------- ;; View listing Intern Intern Intern Intern Y Y ;; Extract member Y Y Y Y Y Y -;; Save changed member Y Y Y Y N N +;; Save changed member Y Y Y Y N Y ;; Add new member N N N N N N -;; Delete member Y Y Y Y N N +;; Delete member Y Y Y Y N Y ;; Rename member Y Y N N N N ;; Chmod - Y Y - N N ;; Chown - Y - - N N @@ -323,9 +323,30 @@ Archive and member name will be added." Extraction should happen to standard output. Archive and member name will be added." :type '(list (string :tag "Program") - (repeat :tag "Options" - :inline t - (string :format "%v"))) + (repeat :tag "Options" + :inline t + (string :format "%v"))) + :group 'archive-7z) + +(defcustom archive-7z-expunge + '("7z" "d") + "Program and its options to run in order to delete 7z file members. +Archive and member names will be added." + :type '(list (string :tag "Program") + (repeat :tag "Options" + :inline t + (string :format "%v"))) + :group 'archive-7z) + +(defcustom archive-7z-update + '("7z" "u") + "Program and its options to run in order to update a 7z file member. +Options should ensure that specified directory will be put into the 7z +file. Archive and member name will be added." + :type '(list (string :tag "Program") + (repeat :tag "Options" + :inline t + (string :format "%v"))) :group 'archive-7z) ;; ------------------------------------------------------------------------- @@ -2037,7 +2058,9 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." (with-temp-buffer (call-process "7z" nil t nil "l" "-slt" file) (goto-char (point-min)) - (re-search-forward "^-+\n") + ;; Four dashes start the meta info section that should be skipped. + ;; Archive members start with more than four dashes. + (re-search-forward "^-----+\n") (while (re-search-forward "^Path = \\(.*\\)\n" nil t) (goto-char (match-end 0)) (let ((name (match-string 1)) @@ -2084,6 +2107,12 @@ This doesn't recover lost files, it just undoes changes in the buffer itself." (message "%s" (buffer-string))) (delete-file tmpfile))))) +(defun archive-7z-write-file-member (archive descr) + (archive-*-write-file-member + archive + descr + archive-7z-update)) + ;; ------------------------------------------------------------------------- ;;; Section `ar' archives.