From unknown Tue Jun 24 05:13:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19274: tar-mode.el: allow for adding new archive members Resent-From: Ivan Shmakov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 04 Dec 2014 21:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 19274 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 19274@debbugs.gnu.org X-Debbugs-Original-To: submit@debbugs.gnu.org Received: via spool by submit@debbugs.gnu.org id=B.141772789010028 (code B ref -1); Thu, 04 Dec 2014 21:19:02 +0000 Received: (at submit) by debbugs.gnu.org; 4 Dec 2014 21:18:10 +0000 Received: from localhost ([127.0.0.1]:54031 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xwdmr-0002bd-HH for submit@debbugs.gnu.org; Thu, 04 Dec 2014 16:18:10 -0500 Received: from fely.am-1.org ([78.47.74.50]:43489) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xwdmo-0002bT-1r for submit@debbugs.gnu.org; Thu, 04 Dec 2014 16:18:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Type:MIME-Version:Message-ID:Date:Sender:Subject:To:From; bh=MBxMoEJG5CJAPnTfe5NwOYdpkl+tzpV9CxqignFsb9I=; b=UtPcaIB5Hdo3VJnneABI3DWnVsSpcP3PHPGEjdUtqMFW58ktfSVHRA41uDTZ80YiiYNRD+lWrEl2muTd+PEom+cNglx1X0q/STQCkKqhVcyx7JwEKaNMdxWp9RYEoakHMj1OL/EkhQcVEjT3tNZTXL/rHZXqEoE69WJ9TdtJGfk=; Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1Xwdml-0008VZ-1B for submit@debbugs.gnu.org; Thu, 04 Dec 2014 21:18:03 +0000 Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1Xwdmd-0005m5-IB for submit@debbugs.gnu.org; Fri, 05 Dec 2014 04:17:55 +0700 From: Ivan Shmakov Date: Thu, 04 Dec 2014 21:17:54 +0000 Message-ID: <877fy7nmgt.fsf@violet.siamics.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Package: emacs Severity: wishlist Please consider the patch MIMEd. * tar-mode.el: Allow for adding new archive members. (tar--pad-to, tar--put-at, tar-header-serialize): New functions. (tar-current-position): Split from tar-current-descriptor. (tar-current-descriptor): Use it. (tar-new-entry): New command. (tar-mode-map): Bind it. --=20 FSF associate member #7257 http://boycottsystemd.org/ =E2=80=A6 3013 B6A0= 230E 334A --=-=-= Content-Type: text/diff Content-Disposition: inline --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el @@ -369,6 +369,58 @@ string) (tar-parse-octal-integer string)) +(defun tar--pad-to (pos) + (make-string (+ pos (- (point)) (point-min)) 0)) + +(defun tar--put-at (pos val) + (when val + (insert (tar--pad-to pos) val))) + +(defun tar-header-serialize (header &optional update-checksum) + (with-temp-buffer + (set-buffer-multibyte nil) + (let ((encoded-name + (encode-coding-string (tar-header-name header) + tar-file-name-coding-system))) + (unless (< (length encoded-name) 99) + ;; FIXME: implement it + (error "Long file name support is not implemented")) + (insert encoded-name)) + (insert (tar--pad-to tar-mode-offset) + (format "%6o\0 " (logand #o777777 (tar-header-mode header))) + (format "%6o\0 " (logand #o777777 (tar-header-uid header))) + (format "%6o\0 " (logand #o777777 (tar-header-gid header)))) + (insert (tar--pad-to tar-size-offset) + (format "%11o " (tar-header-size header))) + (insert (tar--pad-to tar-time-offset) + (tar-octal-time (tar-header-date header)) + " ") + ;; omit tar-header-checksum (tar-chk-offset) for now + (tar--put-at tar-linkp-offset (tar-header-link-type header)) + (tar--put-at tar-link-offset (tar-header-link-name header)) + (when (tar-header-magic header) + (tar--put-at tar-magic-offset (tar-header-magic header)) + (tar--put-at tar-uname-offset (tar-header-uname header)) + (tar--put-at tar-gname-offset (tar-header-gname header)) + (let ((dmaj (tar-header-dmaj header)) + (dmin (tar-header-dmin header))) + (tar--put-at tar-dmaj-offset + (and dmaj (format "%7o\0" (logand #o7777777 dmaj)))) + (tar--put-at tar-dmin-offset + (and dmin (format "%7o\0" (logand #o7777777 dmin)))))) + (tar--put-at 512 "") + (let ((ck (tar-header-block-checksum (buffer-string)))) + (goto-char (+ (point-min) tar-chk-offset)) + (delete-char 8) + (insert (format "%6o\0 " ck)) + (when update-checksum + (setf (tar-header-checksum header) ck)) + (tar-header-block-check-checksum (buffer-string) + (tar-header-checksum header) + (tar-header-name header))) + ;; . + (buffer-string))) + (defun tar-header-block-checksum (string) "Compute and return a tar-acceptable checksum for this block." @@ -547,6 +599,7 @@ defvar tar-mode-map (define-key map "p" 'tar-previous-line) (define-key map "\^P" 'tar-previous-line) (define-key map [up] 'tar-previous-line) + (define-key map "I" 'tar-new-entry) (define-key map "R" 'tar-rename-entry) (define-key map "u" 'tar-unflag) (define-key map "v" 'tar-view) @@ -731,10 +784,14 @@ (interactive "p") (tar-next-line (- arg))) +(defun tar-current-position () + "Return the `tar-parse-info' index for the current line." + (count-lines (point-min) (line-beginning-position))) + (defun tar-current-descriptor (&optional noerror) "Return the tar-descriptor of the current line, or signals an error." ;; I wish lines had plists, like in ZMACS... - (or (nth (count-lines (point-min) (line-beginning-position)) + (or (nth (tar-current-position) tar-parse-info) (if noerror nil @@ -948,6 +1005,45 @@ (write-region start end to-file nil nil nil t))) (message "Copied tar entry %s to %s" name to-file))) +(defun tar-new-entry (filename &optional index) + "Insert a new empty regular file before point." + (interactive "*sNew file name: ") + (let* ((buffer (current-buffer)) + (index (or index (tar-current-position))) + (d-list (and (not (zerop index)) + (nthcdr (+ -1 index) tar-parse-info))) + (pos (if d-list + (tar-header-data-end (car d-list)) + (point-min))) + (new-descriptor + (make-tar-header + nil + filename + #o644 0 0 0 + (current-time) + nil ; checksum + nil nil + nil nil nil nil nil))) + ;; update the data buffer; fill the missing descriptor fields + (with-current-buffer tar-data-buffer + (goto-char pos) + (insert (tar-header-serialize new-descriptor t)) + (setf (tar-header-data-start new-descriptor) + (copy-marker (point) nil))) + ;; update tar-parse-info + (if d-list + (setcdr d-list (cons new-descriptor (cdr d-list))) + (setq tar-parse-info (cons new-descriptor + tar-parse-info))) + ;; update the listing buffer + (save-excursion + (goto-char (point-min)) + (forward-line index) + (let ((inhibit-read-only t)) + (insert (tar-header-block-summarize new-descriptor) ?\n))) + ;; . + index)) + (defun tar-flag-deleted (p &optional unflag) "In Tar mode, mark this sub-file to be deleted from the tar file. With a prefix argument, mark that many files." --=-=-=-- From unknown Tue Jun 24 05:13:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19274: tar-mode.el: allow for adding new archive members Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 05 Dec 2014 02:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19274 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Ivan Shmakov Cc: 19274@debbugs.gnu.org Received: via spool by 19274-submit@debbugs.gnu.org id=B19274.14177454225027 (code B ref 19274); Fri, 05 Dec 2014 02:11:02 +0000 Received: (at 19274) by debbugs.gnu.org; 5 Dec 2014 02:10:22 +0000 Received: from localhost ([127.0.0.1]:54192 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XwiLe-0001J1-0c for submit@debbugs.gnu.org; Thu, 04 Dec 2014 21:10:22 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:10262) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XwiLb-0001Is-7N for 19274@debbugs.gnu.org; Thu, 04 Dec 2014 21:10:20 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjsPAOwQflRMCqTq/2dsb2JhbABbgweDYIVaxR0EAgKBJBcBAQEBAQF8hAMBAQRWIxALNBIUGA0kLYgm1lkBAQEBBgEBAQEekG8HhEgFiwGSMYM4jDuCCoF4hBkhgncBAQE X-IPAS-Result: AjsPAOwQflRMCqTq/2dsb2JhbABbgweDYIVaxR0EAgKBJBcBAQEBAQF8hAMBAQRWIxALNBIUGA0kLYgm1lkBAQEBBgEBAQEekG8HhEgFiwGSMYM4jDuCCoF4hBkhgncBAQE X-IronPort-AV: E=Sophos;i="5.07,502,1413259200"; d="scan'208";a="99600345" Received: from 76-10-164-234.dsl.teksavvy.com (HELO pastel.home) ([76.10.164.234]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 04 Dec 2014 21:10:18 -0500 Received: by pastel.home (Postfix, from userid 20848) id 3D73B8848; Thu, 4 Dec 2014 21:10:18 -0500 (EST) From: Stefan Monnier Message-ID: References: <877fy7nmgt.fsf@violet.siamics.net> Date: Thu, 04 Dec 2014 21:10:18 -0500 In-Reply-To: <877fy7nmgt.fsf@violet.siamics.net> (Ivan Shmakov's message of "Thu, 04 Dec 2014 21:17:54 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > * tar-mode.el: Allow for adding new archive members. > (tar--pad-to, tar--put-at, tar-header-serialize): New functions. > (tar-current-position): Split from tar-current-descriptor. > (tar-current-descriptor): Use it. > (tar-new-entry): New command. > (tar-mode-map): Bind it. Thanks, looks good, please install (with appropriate etc/NEWS entry). See nitpicks below, Stefan > + ;; omit tar-header-checksum (tar-chk-offset) for now Please capitalize and punctuate your comments. From unknown Tue Jun 24 05:13:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19274: tar-mode.el: allow for adding new archive members Resent-From: Ivan Shmakov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 05 Dec 2014 20:21:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19274 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 19274@debbugs.gnu.org Received: via spool by 19274-submit@debbugs.gnu.org id=B19274.141781084126284 (code B ref 19274); Fri, 05 Dec 2014 20:21:01 +0000 Received: (at 19274) by debbugs.gnu.org; 5 Dec 2014 20:20:41 +0000 Received: from localhost ([127.0.0.1]:54991 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XwzMm-0006ps-CB for submit@debbugs.gnu.org; Fri, 05 Dec 2014 15:20:40 -0500 Received: from fely.am-1.org ([78.47.74.50]:43606) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XwzMh-0006pf-K5 for 19274@debbugs.gnu.org; Fri, 05 Dec 2014 15:20:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:Sender:References:Subject:To:From; bh=D33T58n2qeWLAZxYJfUs9aw3B1+6WUsdbpV6VnnqoKA=; b=q44ZNN2Ab6zIFdrNTx7mC6x77iSJHxjnHttLp8Fn3tDhyQrXGSaw7rz+oD7SDsUVTne8tTw9OkrugpBWsn9bEmyLewKEzjIvmVnsbetWyBOxouqxLZKTZBX3UWIkFbi52ywhEUUsKdNmlAmV8fH6Ddsf39n+J46+0piFzn0LhJY=; Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1XwzMe-0002zW-MC for 19274@debbugs.gnu.org; Fri, 05 Dec 2014 20:20:33 +0000 Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1XwzMX-0000RL-Go for 19274@debbugs.gnu.org; Sat, 06 Dec 2014 03:20:25 +0700 From: Ivan Shmakov References: <877fy7nmgt.fsf@violet.siamics.net> Mail-Followup-To: 19274@debbugs.gnu.org Date: Fri, 05 Dec 2014 20:20:24 +0000 In-Reply-To: (Stefan Monnier's message of "Thu, 04 Dec 2014 21:10:18 -0500") Message-ID: <87fvctn913.fsf@violet.siamics.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) >>>>> Stefan Monnier writes: [=E2=80=A6] >> + ;; omit tar-header-checksum (tar-chk-offset) for now > Please capitalize and punctuate your comments. Even the one-line ones? Given that I have some time to improve this patch, could someone please suggest a good place to add a menu entry for tar-new-entry in tar-mode-map? (I never use Emacs=E2=80=99 menus myself, so I=E2=80=99m rather clueless on this.) BTW, I wonder if it makes sense to split the make-tar-header form (with all the nil=E2=80=99s there) off tar-new-entry into a new (tar-new-regular-file-header filename &optional size time) function? I guess that=E2=80=99d ease the creation of Tar archives from Emacs Lisp code; (and I already imagine some uses to that.) I=E2=80=99ll also write a proper docstring for tar-header-serialize, so to make it clear this function is part of the module=E2=80=99s external interface. PS. you know you may be a mathematician if your sentences start with a lower-case letter and end with a semicolon; --=20 FSF associate member #7257 http://boycottsystemd.org/ =E2=80=A6 3013 B6A0= 230E 334A. From unknown Tue Jun 24 05:13:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19274: tar-mode.el: allow for adding new archive members Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Dec 2014 05:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19274 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 19274@debbugs.gnu.org Received: via spool by 19274-submit@debbugs.gnu.org id=B19274.141784260011388 (code B ref 19274); Sat, 06 Dec 2014 05:10:01 +0000 Received: (at 19274) by debbugs.gnu.org; 6 Dec 2014 05:10:00 +0000 Received: from localhost ([127.0.0.1]:55141 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xx7d1-0002xc-Jp for submit@debbugs.gnu.org; Sat, 06 Dec 2014 00:09:59 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:16776) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xx7cz-0002xU-Ip for 19274@debbugs.gnu.org; Sat, 06 Dec 2014 00:09:57 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AmkPAOwQflRMCqTq/2dsb2JhbABbgweDYFCFCsUdBAICgSQXAQEBAQEBfIQDAQEDASMzKAsLGgIYDgICFBgNiG4JwAaWUwELIIErj0sWgl+BUwWLAZIxgziMO4IKgXiEGSGCdwEBAQ X-IPAS-Result: AmkPAOwQflRMCqTq/2dsb2JhbABbgweDYFCFCsUdBAICgSQXAQEBAQEBfIQDAQEDASMzKAsLGgIYDgICFBgNiG4JwAaWUwELIIErj0sWgl+BUwWLAZIxgziMO4IKgXiEGSGCdwEBAQ X-IronPort-AV: E=Sophos;i="5.07,502,1413259200"; d="scan'208";a="99692974" Received: from 76-10-164-234.dsl.teksavvy.com (HELO ceviche.home) ([76.10.164.234]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 06 Dec 2014 00:09:57 -0500 Received: by ceviche.home (Postfix, from userid 20848) id E298C66159; Sat, 6 Dec 2014 00:09:56 -0500 (EST) From: Stefan Monnier Message-ID: References: <877fy7nmgt.fsf@violet.siamics.net> <87fvctn913.fsf@violet.siamics.net> Date: Sat, 06 Dec 2014 00:09:56 -0500 In-Reply-To: <87fvctn913.fsf@violet.siamics.net> (Ivan Shmakov's message of "Fri, 05 Dec 2014 20:20:24 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) >>> + ;; omit tar-header-checksum (tar-chk-offset) for now >> Please capitalize and punctuate your comments. > Even the one-line ones? Yes, we do that for all comments, since this poor little sentence would feel disrespected otherwise. > BTW, I wonder if it makes sense to split the make-tar-header > form (with all the nil=E2=80=99s there) off tar-new-entry into a new > (tar-new-regular-file-header filename &optional size time) > function? I guess that=E2=80=99d ease the creation of Tar archives from > Emacs Lisp code; (and I already imagine some uses to that.) BTW, if you're interested in hacking on tar-mode, I keep dreaming of plugging it into file-name-handler-alist so you can just visit /foo/bar.tar.gz/somefile, use dired on it, ... Stefan From unknown Tue Jun 24 05:13:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19274: tar-mode.el: allow for adding new archive members Resent-From: Ivan Shmakov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Dec 2014 19:18:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19274 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 19274@debbugs.gnu.org Received: via spool by 19274-submit@debbugs.gnu.org id=B19274.14178934515006 (code B ref 19274); Sat, 06 Dec 2014 19:18:02 +0000 Received: (at 19274) by debbugs.gnu.org; 6 Dec 2014 19:17:31 +0000 Received: from localhost ([127.0.0.1]:55619 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XxKrB-0001If-SJ for submit@debbugs.gnu.org; Sat, 06 Dec 2014 14:17:30 -0500 Received: from fely.am-1.org ([78.47.74.50]:43703) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XxKr8-0001IV-LN for 19274@debbugs.gnu.org; Sat, 06 Dec 2014 14:17:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:Sender:References:Subject:To:From; bh=iYBj9SU+Q5lIUd1xGgcsYnmVd8A5grlb7QelUWyC/PI=; b=eNIbXWq9Mu84ye1LLAJDSakM1A5rIQnO1HuKJNJ0lAtJTGzb76UFYvqQgck+P69ACYBUvpMOUDhqp+NcAD8ux/DYvsJ09fD0GSbGTwfrknpSRcAhsIi/wKXV9yG72QMMvRhaqQDLuO4FiXGzm6gOBuBR2u1enCsRzVnfDGohnPI=; Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1XxKr6-0005QL-PP for 19274@debbugs.gnu.org; Sat, 06 Dec 2014 19:17:25 +0000 Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1XxKqz-0002m6-8T for 19274@debbugs.gnu.org; Sun, 07 Dec 2014 02:17:17 +0700 From: Ivan Shmakov References: <877fy7nmgt.fsf@violet.siamics.net> <87fvctn913.fsf@violet.siamics.net> Mail-Followup-To: 19274@debbugs.gnu.org Date: Sat, 06 Dec 2014 19:17:16 +0000 In-Reply-To: (Stefan Monnier's message of "Sat, 06 Dec 2014 00:09:56 -0500") Message-ID: <87zjb0lhab.fsf@violet.siamics.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >>>>> Stefan Monnier writes: Please consider the revised patch MIMEd. * tar-mode.el: Allow for adding new archive members. (tar-new-regular-file-header, tar--pad-to, tar--put-at) (tar-header-serialize): New functions. (tar-current-position): Split from tar-current-descriptor. (tar-current-descriptor): Use it. (tar-new-entry): New command. (tar-mode-map): Bind it. [=E2=80=A6] >> BTW, I wonder if it makes sense to split the make-tar-header form >> (with all the nil=E2=80=99s there) off tar-new-entry into a new >> (tar-new-regular-file-header filename &optional size time) function? (Done.) >> I guess that=E2=80=99d ease the creation of Tar archives from Emacs Lisp >> code; (and I already imagine some uses to that.) > BTW, if you're interested in hacking on tar-mode, I keep dreaming of > plugging it into file-name-handler-alist so you can just visit > /foo/bar.tar.gz/somefile, use dired on it, ... I=E2=80=99m not all that familiar with file-name-handler-alist, but I guess I could check it out. (Although at this point I=E2=80=99m simply interested in creating Tar archives from the contents of Emacs buffers, =E2=80=93 without having them saved into files, that is.) Curiously, what would be the sensible behavior for Emacs when the copy of the Tar archive kept in the *tar-data* buffer happens to differ to the on-disk state of the respective file? --=20 FSF associate member #7257 np. =D0=92=D1=81=D0=B5=D0=BB=D0=B5=D0=BD=D1=81= =D0=BA=D0=B0=D1=8F =D0=B1=D0=BE=D0=BB=D1=8C=D1=88=D0=B0=D1=8F =D0=BB=D1=8E= =D0=B1=D0=BE=D0=B2=D1=8C =E2=80=94 =D0=93=D1=80=D0=B0=D0=B6=D0=B4=D0=B0=D0= =BD=D1=81=D0=BA=D0=B0=D1=8F =D0=9E=D0=B1=D0=BE=D1=80=D0=BE=D0=BD=D0=B0 --=-=-= Content-Type: text/diff Content-Disposition: inline --- a/etc/NEWS 2014-11-27 11:36:08 +0000 +++ b/etc/NEWS 2014-12-06 19:03:35 +0000 @@ -340,6 +340,9 @@ `tildify-ignored-environments-alist' variables (as well as a few helper functions) obsolete. +** tar-mode: new `tar-new-entry' command, allowing for new members to +be added to the archive. + ** Obsolete packages --- --- a/lisp/tar-mode.el 2014-08-28 19:18:24 +0000 +++ b/lisp/tar-mode.el 2014-12-06 19:04:02 +0000 @@ -50,9 +50,6 @@ ;; ;; o chmod should understand "a+x,og-w". ;; -;; o It's not possible to add a NEW file to a tar archive; not that -;; important, but still... -;; ;; o The code is less efficient that it could be - in a lot of places, I ;; pull a 512-character string out of the buffer and parse it, when I could ;; be parsing it in place, not garbaging a string. Should redo that. @@ -369,6 +366,83 @@ write-date, checksum, link-type, and link-name." string) (tar-parse-octal-integer string)) +(defun tar-new-regular-file-header (filename &optional size time) + "Return a Tar header for a regular file. +The header will lack a proper checksum; use `tar-header-block-checksum' +to compute one, or request `tar-header-serialize' to do that. + +Other tar-mode facilities may also require the data-start header +field to be set to a valid value. + +If SIZE is not given or nil, it defaults to 0. +If TIME is not given or nil, assume now." + (make-tar-header + nil + filename + #o644 0 0 (or size 0) + (or time (current-time)) + nil ; checksum + nil nil + nil nil nil nil nil)) + +(defun tar--pad-to (pos) + (make-string (+ pos (- (point)) (point-min)) 0)) + +(defun tar--put-at (pos val) + (when val + (insert (tar--pad-to pos) val))) + +(defun tar-header-serialize (header &optional update-checksum) + "Return the serialization of a Tar HEADER as a string. +This function calls `tar-header-block-check-checksum' to ensure the +checksum is correct. + +When UPDATE-CHECKSUM is non-nil, update HEADER with the newly-computed +checksum before doing the check." + (with-temp-buffer + (set-buffer-multibyte nil) + (let ((encoded-name + (encode-coding-string (tar-header-name header) + tar-file-name-coding-system))) + (unless (< (length encoded-name) 99) + ;; FIXME: implement it + (error "Long file name support is not implemented")) + (insert encoded-name)) + (insert (tar--pad-to tar-mode-offset) + (format "%6o\0 " (logand #o777777 (tar-header-mode header))) + (format "%6o\0 " (logand #o777777 (tar-header-uid header))) + (format "%6o\0 " (logand #o777777 (tar-header-gid header)))) + (insert (tar--pad-to tar-size-offset) + (format "%11o " (tar-header-size header))) + (insert (tar--pad-to tar-time-offset) + (tar-octal-time (tar-header-date header)) + " ") + ;; omit tar-header-checksum (tar-chk-offset) for now + (tar--put-at tar-linkp-offset (tar-header-link-type header)) + (tar--put-at tar-link-offset (tar-header-link-name header)) + (when (tar-header-magic header) + (tar--put-at tar-magic-offset (tar-header-magic header)) + (tar--put-at tar-uname-offset (tar-header-uname header)) + (tar--put-at tar-gname-offset (tar-header-gname header)) + (let ((dmaj (tar-header-dmaj header)) + (dmin (tar-header-dmin header))) + (tar--put-at tar-dmaj-offset + (and dmaj (format "%7o\0" (logand #o7777777 dmaj)))) + (tar--put-at tar-dmin-offset + (and dmin (format "%7o\0" (logand #o7777777 dmin)))))) + (tar--put-at 512 "") + (let ((ck (tar-header-block-checksum (buffer-string)))) + (goto-char (+ (point-min) tar-chk-offset)) + (delete-char 8) + (insert (format "%6o\0 " ck)) + (when update-checksum + (setf (tar-header-checksum header) ck)) + (tar-header-block-check-checksum (buffer-string) + (tar-header-checksum header) + (tar-header-name header))) + ;; . + (buffer-string))) + (defun tar-header-block-checksum (string) "Compute and return a tar-acceptable checksum for this block." @@ -547,6 +621,7 @@ MODE should be an integer which is a file mode value." (define-key map "p" 'tar-previous-line) (define-key map "\^P" 'tar-previous-line) (define-key map [up] 'tar-previous-line) + (define-key map "I" 'tar-new-entry) (define-key map "R" 'tar-rename-entry) (define-key map "u" 'tar-unflag) (define-key map "v" 'tar-view) @@ -731,10 +806,14 @@ tar-file's buffer." (interactive "p") (tar-next-line (- arg))) +(defun tar-current-position () + "Return the `tar-parse-info' index for the current line." + (count-lines (point-min) (line-beginning-position))) + (defun tar-current-descriptor (&optional noerror) "Return the tar-descriptor of the current line, or signals an error." ;; I wish lines had plists, like in ZMACS... - (or (nth (count-lines (point-min) (line-beginning-position)) + (or (nth (tar-current-position) tar-parse-info) (if noerror nil @@ -948,6 +1027,37 @@ the current tar-entry." (write-region start end to-file nil nil nil t))) (message "Copied tar entry %s to %s" name to-file))) +(defun tar-new-entry (filename &optional index) + "Insert a new empty regular file before point." + (interactive "*sFile name: ") + (let* ((buffer (current-buffer)) + (index (or index (tar-current-position))) + (d-list (and (not (zerop index)) + (nthcdr (+ -1 index) tar-parse-info))) + (pos (if d-list + (tar-header-data-end (car d-list)) + (point-min))) + (new-descriptor + (tar-new-regular-file-header filename))) + ;; Update the data buffer; fill the missing descriptor fields. + (with-current-buffer tar-data-buffer + (goto-char pos) + (insert (tar-header-serialize new-descriptor t)) + (setf (tar-header-data-start new-descriptor) + (copy-marker (point) nil))) + ;; Update tar-parse-info. + (if d-list + (setcdr d-list (cons new-descriptor (cdr d-list))) + (setq tar-parse-info (cons new-descriptor tar-parse-info))) + ;; Update the listing buffer. + (save-excursion + (goto-char (point-min)) + (forward-line index) + (let ((inhibit-read-only t)) + (insert (tar-header-block-summarize new-descriptor) ?\n))) + ;; . + index)) + (defun tar-flag-deleted (p &optional unflag) "In Tar mode, mark this sub-file to be deleted from the tar file. With a prefix argument, mark that many files." --=-=-=-- From unknown Tue Jun 24 05:13:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19274: tar-mode.el: allow for adding new archive members Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Dec 2014 19:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19274 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Ivan Shmakov Cc: 19274@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 19274-submit@debbugs.gnu.org id=B19274.14178944246578 (code B ref 19274); Sat, 06 Dec 2014 19:34:02 +0000 Received: (at 19274) by debbugs.gnu.org; 6 Dec 2014 19:33:44 +0000 Received: from localhost ([127.0.0.1]:55653 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XxL6u-0001i2-0N for submit@debbugs.gnu.org; Sat, 06 Dec 2014 14:33:44 -0500 Received: from mtaout25.012.net.il ([80.179.55.181]:53597) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XxL6q-0001hm-T1 for 19274@debbugs.gnu.org; Sat, 06 Dec 2014 14:33:42 -0500 Received: from conversion-daemon.mtaout25.012.net.il by mtaout25.012.net.il (HyperSendmail v2007.08) id <0NG600400DXM5B00@mtaout25.012.net.il> for 19274@debbugs.gnu.org; Sat, 06 Dec 2014 21:29:21 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by mtaout25.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NG600IYNE4X8Y90@mtaout25.012.net.il>; Sat, 06 Dec 2014 21:29:21 +0200 (IST) Date: Sat, 06 Dec 2014 21:33:29 +0200 From: Eli Zaretskii In-reply-to: <87zjb0lhab.fsf@violet.siamics.net> X-012-Sender: halo1@inter.net.il Message-id: <83r3wczi7q.fsf@gnu.org> References: <877fy7nmgt.fsf@violet.siamics.net> <87fvctn913.fsf@violet.siamics.net> <87zjb0lhab.fsf@violet.siamics.net> X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > From: Ivan Shmakov > Date: Sat, 06 Dec 2014 19:17:16 +0000 > > --- a/etc/NEWS 2014-11-27 11:36:08 +0000 > +++ b/etc/NEWS 2014-12-06 19:03:35 +0000 > @@ -340,6 +340,9 @@ > `tildify-ignored-environments-alist' variables (as well as a few > helper functions) obsolete. > > +** tar-mode: new `tar-new-entry' command, allowing for new members to > +be added to the archive. How about adding the necessary bits to the Emacs manual? > +(defun tar-header-serialize (header &optional update-checksum) > + "Return the serialization of a Tar HEADER as a string. > +This function calls `tar-header-block-check-checksum' to ensure the > +checksum is correct. > + > +When UPDATE-CHECKSUM is non-nil, update HEADER with the newly-computed Not "when", "if". "When" has an implicit timing reference, which is not what you mean here. Thanks. From unknown Tue Jun 24 05:13:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19274: tar-mode.el: allow for adding new archive members Resent-From: Ivan Shmakov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Dec 2014 19:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19274 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 19274@debbugs.gnu.org Received: via spool by 19274-submit@debbugs.gnu.org id=B19274.14178951427855 (code B ref 19274); Sat, 06 Dec 2014 19:46:02 +0000 Received: (at 19274) by debbugs.gnu.org; 6 Dec 2014 19:45:42 +0000 Received: from localhost ([127.0.0.1]:55674 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XxLIT-00022d-NH for submit@debbugs.gnu.org; Sat, 06 Dec 2014 14:45:41 -0500 Received: from fely.am-1.org ([78.47.74.50]:43706) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XxLIN-00022R-Ja for 19274@debbugs.gnu.org; Sat, 06 Dec 2014 14:45:36 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:Sender:References:Subject:To:From; bh=REOFTKLW4kwBx8lf8ETGtHDBduhOK9aVKTtz0lhoOz4=; b=pi6UBZLID5JRKypiBNRgUJCYRIM1mcPRKsw6VNpJcePQZSRP6hReiuqo12XPEercBOqCIlUIJ9tqYlVZbw97+wei9ox4MqFYDzGVSI1OVVy/YQx7x+2gTBcG6GYAG9O3cQtZ6So/OjejD6EM5PSvoVDoxaOv6lByEQwEE9Rx2iw=; Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1XxLIM-0005ck-BE for 19274@debbugs.gnu.org; Sat, 06 Dec 2014 19:45:34 +0000 Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1XxLIF-0002p1-3M for 19274@debbugs.gnu.org; Sun, 07 Dec 2014 02:45:27 +0700 From: Ivan Shmakov References: <877fy7nmgt.fsf@violet.siamics.net> <87fvctn913.fsf@violet.siamics.net> <87zjb0lhab.fsf@violet.siamics.net> <83r3wczi7q.fsf@gnu.org> Mail-Followup-To: 19274@debbugs.gnu.org Date: Sat, 06 Dec 2014 19:45:26 +0000 In-Reply-To: <83r3wczi7q.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 06 Dec 2014 21:33:29 +0200") Message-ID: <87vblolfzd.fsf@violet.siamics.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) >>>>> Eli Zaretskii writes: >>>>> From: Ivan Shmakov Date: Sat, 06 Dec 2014 19:17:16 +0000 [=E2=80=A6] >> ** tar-mode: new `tar-new-entry' command, allowing for new members >> to be added to the archive. > How about adding the necessary bits to the Emacs manual? Sure; what=E2=80=99s the respective .texi file? (Somehow, I failed to find one.) [=E2=80=A6] >> When UPDATE-CHECKSUM is non-nil, update HEADER with the >> newly-computed > Not "when", "if". "When" has an implicit timing reference, which is > not what you mean here. ACK. --=20 FSF associate member #7257 http://boycottsystemd.org/ =E2=80=A6 3013 B6A0= 230E 334A From unknown Tue Jun 24 05:13:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19274: tar-mode.el: allow for adding new archive members Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Dec 2014 19:57:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19274 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Ivan Shmakov Cc: 19274@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 19274-submit@debbugs.gnu.org id=B19274.14178957928843 (code B ref 19274); Sat, 06 Dec 2014 19:57:01 +0000 Received: (at 19274) by debbugs.gnu.org; 6 Dec 2014 19:56:32 +0000 Received: from localhost ([127.0.0.1]:55681 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XxLSx-0002IY-PG for submit@debbugs.gnu.org; Sat, 06 Dec 2014 14:56:32 -0500 Received: from mtaout21.012.net.il ([80.179.55.169]:60353) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XxLSu-0002IO-Rm for 19274@debbugs.gnu.org; Sat, 06 Dec 2014 14:56:29 -0500 Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0NG600M00EP3L800@a-mtaout21.012.net.il> for 19274@debbugs.gnu.org; Sat, 06 Dec 2014 21:56:27 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NG600MMDFE2BH80@a-mtaout21.012.net.il>; Sat, 06 Dec 2014 21:56:27 +0200 (IST) Date: Sat, 06 Dec 2014 21:56:18 +0200 From: Eli Zaretskii In-reply-to: <87vblolfzd.fsf@violet.siamics.net> X-012-Sender: halo1@inter.net.il Message-id: <83mw70zh5p.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 8BIT References: <877fy7nmgt.fsf@violet.siamics.net> <87fvctn913.fsf@violet.siamics.net> <87zjb0lhab.fsf@violet.siamics.net> <83r3wczi7q.fsf@gnu.org> <87vblolfzd.fsf@violet.siamics.net> X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > From: Ivan Shmakov > Date: Sat, 06 Dec 2014 19:45:26 +0000 > > >>>>> Eli Zaretskii writes: > >>>>> From: Ivan Shmakov Date: Sat, 06 Dec 2014 19:17:16 +0000 > > […] > > >> ** tar-mode: new `tar-new-entry' command, allowing for new members > >> to be added to the archive. > > > How about adding the necessary bits to the Emacs manual? > > Sure; what’s the respective .texi file? (Somehow, I failed to > find one.) "fgrep tar-mode doc/emacs/*.texi blames misc.texi. Thanks. From unknown Tue Jun 24 05:13:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19274: tar-mode.el: allow for adding new archive members Resent-From: Ivan Shmakov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Dec 2014 20:05:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19274 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 19274@debbugs.gnu.org Received: via spool by 19274-submit@debbugs.gnu.org id=B19274.14178962989680 (code B ref 19274); Sat, 06 Dec 2014 20:05:01 +0000 Received: (at 19274) by debbugs.gnu.org; 6 Dec 2014 20:04:58 +0000 Received: from localhost ([127.0.0.1]:55685 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XxLb7-0002W3-Ua for submit@debbugs.gnu.org; Sat, 06 Dec 2014 15:04:58 -0500 Received: from fely.am-1.org ([78.47.74.50]:43712) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XxLb5-0002Vv-RX for 19274@debbugs.gnu.org; Sat, 06 Dec 2014 15:04:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:Sender:References:Subject:To:From; bh=uZNKMJiUYM3DsU/WIHfM6OMJ/5shMth0ES4TbIencEM=; b=Ng9oWrPJEu+trnNF01boxlvurRBp2vCoxix/P4Ni1OtyQdXJeSbCdD+67ykXPFzLjweQGd8HRBmApHAsh+L/CoutAWyd36J9B+STP5+tJlVcrHLbrvXZd612RE33tGclztT1NwpGC/E2c3S6gnQ2uOB5OClrvTNy16wPXaFBV+w=; Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1XxLb4-0005lK-Mu for 19274@debbugs.gnu.org; Sat, 06 Dec 2014 20:04:55 +0000 Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1XxLax-0002rg-HM for 19274@debbugs.gnu.org; Sun, 07 Dec 2014 03:04:47 +0700 From: Ivan Shmakov References: <877fy7nmgt.fsf@violet.siamics.net> <87fvctn913.fsf@violet.siamics.net> <87zjb0lhab.fsf@violet.siamics.net> <83r3wczi7q.fsf@gnu.org> <87vblolfzd.fsf@violet.siamics.net> <83mw70zh5p.fsf@gnu.org> Mail-Followup-To: 19274@debbugs.gnu.org Date: Sat, 06 Dec 2014 20:04:46 +0000 In-Reply-To: <83mw70zh5p.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 06 Dec 2014 21:56:18 +0200") Message-ID: <87r3wclf35.fsf@violet.siamics.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) >>>>> Eli Zaretskii writes: >>>>> From: Ivan Shmakov Date: Sat, 06 Dec 2014 19:45:26 +0000 >>>>> Eli Zaretskii writes: [=E2=80=A6] >>> How about adding the necessary bits to the Emacs manual? >> Sure; what=E2=80=99s the respective .texi file? (Somehow, I failed to = find >> one.) > "fgrep tar-mode doc/emacs/*.texi blames misc.texi. For me, it only finds =E2=80=98tar-mode=E2=80=99 in =E2=80=98wordstar-mode= =E2=80=99: $ grep -F -- tar-mode doc/emacs/*.texi=20 doc/emacs/ack.texi:@file{tar-mode.el}, which provides simple viewing and ed= iting commands doc/emacs/misc.texi:@findex wordstar-mode doc/emacs/misc.texi:@kbd{M-x wordstar-mode} provides a major mode with Word= Star-like $=20 (And the same for -r --include=3D\*.texi over doc/ as a whole.) --=20 FSF associate member #7257 http://boycottsystemd.org/ =E2=80=A6 3013 B6A0= 230E 334A From unknown Tue Jun 24 05:13:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19274: tar-mode.el: allow for adding new archive members Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Dec 2014 20:16:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19274 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Ivan Shmakov Cc: 19274@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 19274-submit@debbugs.gnu.org id=B19274.141789693410663 (code B ref 19274); Sat, 06 Dec 2014 20:16:01 +0000 Received: (at 19274) by debbugs.gnu.org; 6 Dec 2014 20:15:34 +0000 Received: from localhost ([127.0.0.1]:55689 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XxLlN-0002ls-1L for submit@debbugs.gnu.org; Sat, 06 Dec 2014 15:15:34 -0500 Received: from mtaout20.012.net.il ([80.179.55.166]:46236) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XxLlK-0002lk-Ja for 19274@debbugs.gnu.org; Sat, 06 Dec 2014 15:15:31 -0500 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0NG600100FWIYF00@a-mtaout20.012.net.il> for 19274@debbugs.gnu.org; Sat, 06 Dec 2014 22:15:29 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NG6001M5G9SV130@a-mtaout20.012.net.il>; Sat, 06 Dec 2014 22:15:29 +0200 (IST) Date: Sat, 06 Dec 2014 22:15:19 +0200 From: Eli Zaretskii In-reply-to: <87r3wclf35.fsf@violet.siamics.net> X-012-Sender: halo1@inter.net.il Message-id: <83lhmkzga0.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 8BIT References: <877fy7nmgt.fsf@violet.siamics.net> <87fvctn913.fsf@violet.siamics.net> <87zjb0lhab.fsf@violet.siamics.net> <83r3wczi7q.fsf@gnu.org> <87vblolfzd.fsf@violet.siamics.net> <83mw70zh5p.fsf@gnu.org> <87r3wclf35.fsf@violet.siamics.net> X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > From: Ivan Shmakov > Date: Sat, 06 Dec 2014 20:04:46 +0000 > > >>>>> Eli Zaretskii writes: > >>>>> From: Ivan Shmakov Date: Sat, 06 Dec 2014 19:45:26 +0000 > >>>>> Eli Zaretskii writes: > > […] > > >>> How about adding the necessary bits to the Emacs manual? > > >> Sure; what’s the respective .texi file? (Somehow, I failed to find > >> one.) > > > "fgrep tar-mode doc/emacs/*.texi blames misc.texi. > > For me, it only finds ‘tar-mode’ in ‘wordstar-mode’: You are right, sorry. Try this instead: fgrep -w Tar doc/emacs/*.texi From unknown Tue Jun 24 05:13:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19274: tar-mode.el: allow for adding new archive members Resent-From: Ivan Shmakov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Dec 2014 20:51:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19274 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 19274@debbugs.gnu.org Received: via spool by 19274-submit@debbugs.gnu.org id=B19274.141789904814566 (code B ref 19274); Sat, 06 Dec 2014 20:51:01 +0000 Received: (at 19274) by debbugs.gnu.org; 6 Dec 2014 20:50:48 +0000 Received: from localhost ([127.0.0.1]:55709 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XxMJT-0003mq-9h for submit@debbugs.gnu.org; Sat, 06 Dec 2014 15:50:47 -0500 Received: from fely.am-1.org ([78.47.74.50]:43718) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XxMJR-0003mf-35 for 19274@debbugs.gnu.org; Sat, 06 Dec 2014 15:50:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:Sender:References:Subject:To:From; bh=jbnlz2xZzTlk8m4TcMRDvNNiedyxW9sJqZI142uGxIA=; b=cYZElm/62Xwsav14E23Nq70e73KyAh+ASPMvVPKBBU+e/U/CyKzN5HMwEMOHmZ8aApo8L9gBjhCDVLPXjIM4oWViyOeO/DDiVX7eLcYqdueKMe+ltWHZFlCVi64+29sHEL0GWfA1OrmaGd3/5HTJNSonMPy2sFWW4RKAiX9V9yA=; Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1XxMJP-000667-Ql for 19274@debbugs.gnu.org; Sat, 06 Dec 2014 20:50:44 +0000 Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1XxMJI-00030G-NW for 19274@debbugs.gnu.org; Sun, 07 Dec 2014 03:50:36 +0700 From: Ivan Shmakov References: <877fy7nmgt.fsf@violet.siamics.net> <87fvctn913.fsf@violet.siamics.net> <87zjb0lhab.fsf@violet.siamics.net> <83r3wczi7q.fsf@gnu.org> <87vblolfzd.fsf@violet.siamics.net> <83mw70zh5p.fsf@gnu.org> <87r3wclf35.fsf@violet.siamics.net> <83lhmkzga0.fsf@gnu.org> Mail-Followup-To: 19274@debbugs.gnu.org Date: Sat, 06 Dec 2014 20:50:36 +0000 In-Reply-To: <83lhmkzga0.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 06 Dec 2014 22:15:19 +0200") Message-ID: <87mw70lcyr.fsf@violet.siamics.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >>>>> Eli Zaretskii writes: >>>>> From: Ivan Shmakov Date: Sat, 06 Dec 2014 20:04:46 +0000 >>>>> Eli Zaretskii writes: [=E2=80=A6] >>> "fgrep tar-mode doc/emacs/*.texi blames misc.texi. >> For me, it only finds =E2=80=98tar-mode=E2=80=99 in =E2=80=98wordstar-m= ode=E2=80=99: > You are right, sorry. Try this instead: > fgrep -w Tar doc/emacs/*.texi=20 Now, it makes me wonder if there should be an @findex tar-mode along with the @cindices? (And @findex archive-mode, too.) Otherwise, does the patch MIMEd look sane? TIA. --=20 FSF associate member #7257 http://boycottsystemd.org/ =E2=80=A6 3013 B6A0= 230E 334A --=-=-= Content-Type: text/diff Content-Disposition: inline --- a/doc/emacs/files.texi 2014-06-08 07:41:27 +0000 +++ b/doc/emacs/files.texi 2014-12-06 20:44:44 +0000 @@ -1689,6 +1689,14 @@ likewise. @kbd{v} extracts a file into a buffer in View mode another window, so you could edit the file and operate on the archive simultaneously. + The @kbd{I} key adds a new (regular) file to the archive. The file +is initially empty, but can readily be edited using the commands +above. The command inserts the new file on the line above the current +one, so that using it on the topmost line of the Tar buffer makes the +new file the first one in the archive, and using it on the last line +(the one after the line describing the last file) makes it the last +one. + @kbd{d} marks a file for deletion when you later use @kbd{x}, and @kbd{u} unmarks a file, as in Dired. @kbd{C} copies a file from the archive to disk and @kbd{R} renames a file within the archive. --=-=-=-- From unknown Tue Jun 24 05:13:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19274: tar-mode.el: allow for adding new archive members Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 06 Dec 2014 23:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19274 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 19274@debbugs.gnu.org Received: via spool by 19274-submit@debbugs.gnu.org id=B19274.14179076354707 (code B ref 19274); Sat, 06 Dec 2014 23:14:02 +0000 Received: (at 19274) by debbugs.gnu.org; 6 Dec 2014 23:13:55 +0000 Received: from localhost ([127.0.0.1]:55750 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XxOXz-0001Dr-A7 for submit@debbugs.gnu.org; Sat, 06 Dec 2014 18:13:55 -0500 Received: from ironport2-out.teksavvy.com ([206.248.154.181]:48160) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XxOXx-0001Dg-De for 19274@debbugs.gnu.org; Sat, 06 Dec 2014 18:13:53 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AjsPAOwQflRMCqTq/2dsb2JhbABbgweDYIVaxR0EAgKBJBcBAQEBAQF8hAMBAQMBVigLCzQSFBgNiG4J1lkBAQgCAR+QdhaEMgWLAZIxgziORYF4hBkhgncBAQE X-IPAS-Result: AjsPAOwQflRMCqTq/2dsb2JhbABbgweDYIVaxR0EAgKBJBcBAQEBAQF8hAMBAQMBVigLCzQSFBgNiG4J1lkBAQgCAR+QdhaEMgWLAZIxgziORYF4hBkhgncBAQE X-IronPort-AV: E=Sophos;i="5.07,502,1413259200"; d="scan'208";a="99731200" Received: from 76-10-164-234.dsl.teksavvy.com (HELO pastel.home) ([76.10.164.234]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 06 Dec 2014 18:13:52 -0500 Received: by pastel.home (Postfix, from userid 20848) id 4B52E986F; Sat, 6 Dec 2014 18:13:52 -0500 (EST) From: Stefan Monnier Message-ID: References: <877fy7nmgt.fsf@violet.siamics.net> <87fvctn913.fsf@violet.siamics.net> <87zjb0lhab.fsf@violet.siamics.net> Date: Sat, 06 Dec 2014 18:13:52 -0500 In-Reply-To: <87zjb0lhab.fsf@violet.siamics.net> (Ivan Shmakov's message of "Sat, 06 Dec 2014 19:17:16 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Score: 0.3 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.3 (/) > Please consider the revised patch MIMEd. Looks good, thanks, Stefan From unknown Tue Jun 24 05:13:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19274: tar-mode.el: allow for adding new archive members Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Dec 2014 16:22:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19274 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Ivan Shmakov Cc: 19274@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 19274-submit@debbugs.gnu.org id=B19274.14179693086775 (code B ref 19274); Sun, 07 Dec 2014 16:22:01 +0000 Received: (at 19274) by debbugs.gnu.org; 7 Dec 2014 16:21:48 +0000 Received: from localhost ([127.0.0.1]:56437 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xxeah-0001l8-Nj for submit@debbugs.gnu.org; Sun, 07 Dec 2014 11:21:48 -0500 Received: from mtaout21.012.net.il ([80.179.55.169]:49784) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xxead-0001kp-Bq for 19274@debbugs.gnu.org; Sun, 07 Dec 2014 11:21:45 -0500 Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0NG700500ZT7QU00@a-mtaout21.012.net.il> for 19274@debbugs.gnu.org; Sun, 07 Dec 2014 18:20:18 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NG8005BE01UM250@a-mtaout21.012.net.il>; Sun, 07 Dec 2014 18:20:18 +0200 (IST) Date: Sun, 07 Dec 2014 18:20:06 +0200 From: Eli Zaretskii In-reply-to: <87mw70lcyr.fsf@violet.siamics.net> X-012-Sender: halo1@inter.net.il Message-id: <83d27vzb2h.fsf@gnu.org> References: <877fy7nmgt.fsf@violet.siamics.net> <87fvctn913.fsf@violet.siamics.net> <87zjb0lhab.fsf@violet.siamics.net> <83r3wczi7q.fsf@gnu.org> <87vblolfzd.fsf@violet.siamics.net> <83mw70zh5p.fsf@gnu.org> <87r3wclf35.fsf@violet.siamics.net> <83lhmkzga0.fsf@gnu.org> <87mw70lcyr.fsf@violet.siamics.net> X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > From: Ivan Shmakov > Date: Sat, 06 Dec 2014 20:50:36 +0000 > > > fgrep -w Tar doc/emacs/*.texi > > Now, it makes me wonder if there should be an @findex tar-mode > along with the @cindices? (And @findex archive-mode, too.) What, just to help us search for it? These functions are never mentioned in that node. But I don't mind adding the index entries. (In general, the best way of doing this search is to take note of the node you are reading in Info, and then search for the corresponding @node line.) > Otherwise, does the patch MIMEd look sane? Yes, with one comment; see below. > + The @kbd{I} key adds a new (regular) file to the archive. The file > +is initially empty, but can readily be edited using the commands > +above. The command inserts the new file on the line above the current > +one, so that using it on the topmost line of the Tar buffer makes the > +new file the first one in the archive, and using it on the last line > +(the one after the line describing the last file) makes it the last > +one. Instead of the complicated description of "the last line, which is one line after the last file's line", I'd simply say "at the end of the buffer". This is simpler and much more clear, especially to non-native speakers who might have problems with long and complex sentences. Otherwise, it's fine. Thanks. (Don't forget to mark the NEWS entry with "+++" together with installing this change.) From unknown Tue Jun 24 05:13:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19274: tar-mode.el: allow for adding new archive members Resent-From: Ivan Shmakov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Dec 2014 17:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19274 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 19274@debbugs.gnu.org Received: via spool by 19274-submit@debbugs.gnu.org id=B19274.141797446420117 (code B ref 19274); Sun, 07 Dec 2014 17:48:02 +0000 Received: (at 19274) by debbugs.gnu.org; 7 Dec 2014 17:47:44 +0000 Received: from localhost ([127.0.0.1]:56468 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xxfvr-0005EO-PG for submit@debbugs.gnu.org; Sun, 07 Dec 2014 12:47:44 -0500 Received: from fely.am-1.org ([78.47.74.50]:43810) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xxfvo-0005ED-T3 for 19274@debbugs.gnu.org; Sun, 07 Dec 2014 12:47:42 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Type:MIME-Version:Message-ID:Date:Sender:References:In-Reply-To:Subject:To:From; bh=PfBwE++UffikDyyUo7+TuRZ41Z3GZLHzMksrsDlMfT4=; b=R1aj0GWj5hwl6MUcRE38ht0OpEAAUyNLnCQ7rPLywYUvAfJfDGt0pPj6KZ8v7M+cQgX+1tDica1vQ9K7vNVFy/k4PHoklY8N9GiG0hFr+m7qHWPtPEB9COqcUcYFPa/qRBAVFHxly2Ry4B7DjSdSOV+9V5tUl8eDlwC6vRUgAAo=; Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1Xxfvm-0007oq-T7 for 19274@debbugs.gnu.org; Sun, 07 Dec 2014 17:47:39 +0000 Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1Xxfvf-0005YE-E2 for 19274@debbugs.gnu.org; Mon, 08 Dec 2014 00:47:31 +0700 From: Ivan Shmakov In-Reply-To: <83d27vzb2h.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 07 Dec 2014 18:20:06 +0200") References: <877fy7nmgt.fsf@violet.siamics.net> <87fvctn913.fsf@violet.siamics.net> <87zjb0lhab.fsf@violet.siamics.net> <83r3wczi7q.fsf@gnu.org> <87vblolfzd.fsf@violet.siamics.net> <83mw70zh5p.fsf@gnu.org> <87r3wclf35.fsf@violet.siamics.net> <83lhmkzga0.fsf@gnu.org> <87mw70lcyr.fsf@violet.siamics.net> <83d27vzb2h.fsf@gnu.org> Mail-Followup-To: 19274@debbugs.gnu.org Date: Sun, 07 Dec 2014 17:47:30 +0000 Message-ID: <871tobl5cd.fsf@violet.siamics.net> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >>>>> Eli Zaretskii writes: >>>>> From: Ivan Shmakov Date: Sat, 06 Dec 2014 20:50:36 +0000 >>> fgrep -w Tar doc/emacs/*.texi >> Now, it makes me wonder if there should be an @findex tar-mode along >> with the @cindices? (And @findex archive-mode, too.) > What, just to help us search for it? These functions are never > mentioned in that node. > But I don't mind adding the index entries. I guess my idea of a better Emacs manual includes documenting all the command names alongside their respective default bindings. Looks like it warrants a separate bug report, though. > (In general, the best way of doing this search is to take note of the > node you are reading in Info, and then search for the corresponding > @node line.) In this particular case, I should have tried the command below. $ grep -irE --include=3D\*.texi -- '\' doc/=20 [=E2=80=A6] >> The command inserts the new file on the line above the current one, >> so that using it on the topmost line of the Tar buffer makes the new >> file the first one in the archive, and using it on the last line >> (the one after the line describing the last file) makes it the last >> one. > Instead of the complicated description of "the last line, which is > one line after the last file's line", I'd simply say "at the end of > the buffer". This is simpler and much more clear, especially to > non-native speakers who might have problems with long and complex > sentences. Indeed, that=E2=80=99s much better. Does it make sense to also simplify the head of the sentence as follows? (I believe that =E2=80=9Clines=E2=80= =9D are rather just an implementation detail here.) - The command inserts the new file on the line above the current one, + The command inserts the new file before the current one, > Otherwise, it's fine. Thanks. (Don't forget to mark the NEWS entry > with "+++" together with installing this change.) Meanwhile, I=E2=80=99ve also simplified tar-header-serialize a bit (at the cost of adding a couple of lines to tar--put-at) =E2=80=93 and hopefully made it more readable at the same time. The (once again) revised patch is MIMEd. --=20 FSF associate member #7257 http://boycottsystemd.org/ =E2=80=A6 3013 B6A0= 230E 334A --=-=-= Content-Type: text/diff Content-Disposition: inline --- a/etc/NEWS 2014-11-27 11:36:08 +0000 +++ b/etc/NEWS 2014-12-07 17:31:11 +0000 @@ -340,6 +340,10 @@ `tildify-ignored-environments-alist' variables (as well as a few helper functions) obsolete. ++++ +** tar-mode: new `tar-new-entry' command, allowing for new members to +be added to the archive. + ** Obsolete packages --- --- a/doc/emacs/files.texi 2014-06-08 07:41:27 +0000 +++ b/doc/emacs/files.texi 2014-12-07 17:35:34 +0000 @@ -1689,6 +1689,13 @@ @node File Archives another window, so you could edit the file and operate on the archive simultaneously. + The @kbd{I} key adds a new (regular) file to the archive. The file +is initially empty, but can readily be edited using the commands +above. The command inserts the new file on the line above the current +one, so that using it on the topmost line of the Tar buffer makes the +new file the first one in the archive, and using it at the end of the +buffer makes it the last one. + @kbd{d} marks a file for deletion when you later use @kbd{x}, and @kbd{u} unmarks a file, as in Dired. @kbd{C} copies a file from the archive to disk and @kbd{R} renames a file within the archive. --- a/lisp/tar-mode.el 2014-08-28 19:18:24 +0000 +++ b/lisp/tar-mode.el 2014-12-07 17:44:40 +0000 @@ -50,9 +50,6 @@ ;; ;; o chmod should understand "a+x,og-w". ;; -;; o It's not possible to add a NEW file to a tar archive; not that -;; important, but still... -;; ;; o The code is less efficient that it could be - in a lot of places, I ;; pull a 512-character string out of the buffer and parse it, when I could ;; be parsing it in place, not garbaging a string. Should redo that. @@ -369,6 +366,80 @@ string) (tar-parse-octal-integer string)) +(defun tar-new-regular-file-header (filename &optional size time) + "Return a Tar header for a regular file. +The header will lack a proper checksum; use `tar-header-block-checksum' +to compute one, or request `tar-header-serialize' to do that. + +Other tar-mode facilities may also require the data-start header +field to be set to a valid value. + +If SIZE is not given or nil, it defaults to 0. +If TIME is not given or nil, assume now." + (make-tar-header + nil + filename + #o644 0 0 (or size 0) + (or time (current-time)) + nil ; checksum + nil nil + nil nil nil nil nil)) + +(defun tar--pad-to (pos) + (make-string (+ pos (- (point)) (point-min)) 0)) + +(defun tar--put-at (pos val &optional fmt mask) + (when val + (insert (tar--pad-to pos) + (if fmt + (format fmt (if mask (logand mask val) val)) + val)))) + +(defun tar-header-serialize (header &optional update-checksum) + "Return the serialization of a Tar HEADER as a string. +This function calls `tar-header-block-check-checksum' to ensure the +checksum is correct. + +If UPDATE-CHECKSUM is non-nil, update HEADER with the newly-computed +checksum before doing the check." + (with-temp-buffer + (set-buffer-multibyte nil) + (let ((encoded-name + (encode-coding-string (tar-header-name header) + tar-file-name-coding-system))) + (unless (< (length encoded-name) 99) + ;; FIXME: Implement it. + (error "Long file name support is not implemented")) + (insert encoded-name)) + (tar--put-at tar-mode-offset (tar-header-mode header) "%6o\0 " #o777777) + (tar--put-at tar-uid-offset (tar-header-uid header) "%6o\0 " #o777777) + (tar--put-at tar-gid-offset (tar-header-gid header) "%6o\0 " #o777777) + (tar--put-at tar-size-offset (tar-header-size header) "%11o ") + (insert (tar--pad-to tar-time-offset) + (tar-octal-time (tar-header-date header)) + " ") + ;; Omit tar-header-checksum (tar-chk-offset) for now. + (tar--put-at tar-linkp-offset (tar-header-link-type header)) + (tar--put-at tar-link-offset (tar-header-link-name header)) + (when (tar-header-magic header) + (tar--put-at tar-magic-offset (tar-header-magic header)) + (tar--put-at tar-uname-offset (tar-header-uname header)) + (tar--put-at tar-gname-offset (tar-header-gname header)) + (tar--put-at tar-dmaj-offset (tar-header-dmaj header) "%7o\0" #o7777777) + (tar--put-at tar-dmin-offset (tar-header-dmin header) "%7o\0" #o7777777)) + (tar--put-at 512 "") + (let ((ck (tar-header-block-checksum (buffer-string)))) + (goto-char (+ (point-min) tar-chk-offset)) + (delete-char 8) + (insert (format "%6o\0 " ck)) + (when update-checksum + (setf (tar-header-checksum header) ck)) + (tar-header-block-check-checksum (buffer-string) + (tar-header-checksum header) + (tar-header-name header))) + ;; . + (buffer-string))) + (defun tar-header-block-checksum (string) "Compute and return a tar-acceptable checksum for this block." @@ -547,6 +618,7 @@ defvar tar-mode-map (define-key map "p" 'tar-previous-line) (define-key map "\^P" 'tar-previous-line) (define-key map [up] 'tar-previous-line) + (define-key map "I" 'tar-new-entry) (define-key map "R" 'tar-rename-entry) (define-key map "u" 'tar-unflag) (define-key map "v" 'tar-view) @@ -731,10 +803,14 @@ (interactive "p") (tar-next-line (- arg))) +(defun tar-current-position () + "Return the `tar-parse-info' index for the current line." + (count-lines (point-min) (line-beginning-position))) + (defun tar-current-descriptor (&optional noerror) "Return the tar-descriptor of the current line, or signals an error." ;; I wish lines had plists, like in ZMACS... - (or (nth (count-lines (point-min) (line-beginning-position)) + (or (nth (tar-current-position) tar-parse-info) (if noerror nil @@ -948,6 +1024,37 @@ (write-region start end to-file nil nil nil t))) (message "Copied tar entry %s to %s" name to-file))) +(defun tar-new-entry (filename &optional index) + "Insert a new empty regular file before point." + (interactive "*sFile name: ") + (let* ((buffer (current-buffer)) + (index (or index (tar-current-position))) + (d-list (and (not (zerop index)) + (nthcdr (+ -1 index) tar-parse-info))) + (pos (if d-list + (tar-header-data-end (car d-list)) + (point-min))) + (new-descriptor + (tar-new-regular-file-header filename))) + ;; Update the data buffer; fill the missing descriptor fields. + (with-current-buffer tar-data-buffer + (goto-char pos) + (insert (tar-header-serialize new-descriptor t)) + (setf (tar-header-data-start new-descriptor) + (copy-marker (point) nil))) + ;; Update tar-parse-info. + (if d-list + (setcdr d-list (cons new-descriptor (cdr d-list))) + (setq tar-parse-info (cons new-descriptor tar-parse-info))) + ;; Update the listing buffer. + (save-excursion + (goto-char (point-min)) + (forward-line index) + (let ((inhibit-read-only t)) + (insert (tar-header-block-summarize new-descriptor) ?\n))) + ;; . + index)) + (defun tar-flag-deleted (p &optional unflag) "In Tar mode, mark this sub-file to be deleted from the tar file. With a prefix argument, mark that many files." --=-=-=-- From unknown Tue Jun 24 05:13:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19274: tar-mode.el: allow for adding new archive members Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Dec 2014 18:00:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19274 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: Ivan Shmakov Cc: 19274@debbugs.gnu.org Reply-To: Eli Zaretskii Received: via spool by 19274-submit@debbugs.gnu.org id=B19274.141797519321207 (code B ref 19274); Sun, 07 Dec 2014 18:00:03 +0000 Received: (at 19274) by debbugs.gnu.org; 7 Dec 2014 17:59:53 +0000 Received: from localhost ([127.0.0.1]:56476 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xxg7c-0005Vz-Ur for submit@debbugs.gnu.org; Sun, 07 Dec 2014 12:59:53 -0500 Received: from mtaout22.012.net.il ([80.179.55.172]:41574) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xxg7a-0005Vp-Hk for 19274@debbugs.gnu.org; Sun, 07 Dec 2014 12:59:51 -0500 Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0NG800E004FZL800@a-mtaout22.012.net.il> for 19274@debbugs.gnu.org; Sun, 07 Dec 2014 19:58:13 +0200 (IST) Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0NG800ECT4L0EX40@a-mtaout22.012.net.il>; Sun, 07 Dec 2014 19:58:13 +0200 (IST) Date: Sun, 07 Dec 2014 19:58:01 +0200 From: Eli Zaretskii In-reply-to: <871tobl5cd.fsf@violet.siamics.net> X-012-Sender: halo1@inter.net.il Message-id: <83a92zz6ja.fsf@gnu.org> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-transfer-encoding: 8BIT References: <877fy7nmgt.fsf@violet.siamics.net> <87fvctn913.fsf@violet.siamics.net> <87zjb0lhab.fsf@violet.siamics.net> <83r3wczi7q.fsf@gnu.org> <87vblolfzd.fsf@violet.siamics.net> <83mw70zh5p.fsf@gnu.org> <87r3wclf35.fsf@violet.siamics.net> <83lhmkzga0.fsf@gnu.org> <87mw70lcyr.fsf@violet.siamics.net> <83d27vzb2h.fsf@gnu.org> <871tobl5cd.fsf@violet.siamics.net> X-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) > From: Ivan Shmakov > Date: Sun, 07 Dec 2014 17:47:30 +0000 > > > (In general, the best way of doing this search is to take note of the > > node you are reading in Info, and then search for the corresponding > > @node line.) > > In this particular case, I should have tried the command below. > > $ grep -irE --include=\*.texi -- '\' doc/ What I meant is this: fgrep "@node File Archives" doc/emacs/*.texi > > Instead of the complicated description of "the last line, which is > > one line after the last file's line", I'd simply say "at the end of > > the buffer". This is simpler and much more clear, especially to > > non-native speakers who might have problems with long and complex > > sentences. > > Indeed, that’s much better. Does it make sense to also simplify > the head of the sentence as follows? (I believe that “lines” > are rather just an implementation detail here.) > > - The command inserts the new file on the line above the current one, > + The command inserts the new file before the current one, Yes, that's better. Thanks. From unknown Tue Jun 24 05:13:15 2025 X-Loop: help-debbugs@gnu.org Subject: bug#19274: tar-mode.el: allow for adding new archive members Resent-From: Ivan Shmakov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 07 Dec 2014 18:08:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 19274 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 19274@debbugs.gnu.org Received: via spool by 19274-submit@debbugs.gnu.org id=B19274.141797566621996 (code B ref 19274); Sun, 07 Dec 2014 18:08:02 +0000 Received: (at 19274) by debbugs.gnu.org; 7 Dec 2014 18:07:46 +0000 Received: from localhost ([127.0.0.1]:56481 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XxgFF-0005ii-Qq for submit@debbugs.gnu.org; Sun, 07 Dec 2014 13:07:46 -0500 Received: from fely.am-1.org ([78.47.74.50]:43815) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1XxgFD-0005ia-R8 for 19274@debbugs.gnu.org; Sun, 07 Dec 2014 13:07:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:Sender:References:Subject:To:From; bh=7u8Yif7/rwhXBtWf1XiofnX5ClLfBLnHKfVw6Lu55Pk=; b=ALs53yM/h/3bR2OOSomJP5aeJuA+wxv6/5hvXwQk+G5jhHcAkuwSD9AIN3P9EVd4s+eT4w/V8JUrlT1Btw3nndVqo4ug00/+q1y673AA7HjOdxdGcWCbKJ55Li3rDkupjD7XGd2DlEl5oRJZb8ly3zxuSUOVeIRB23iuKLB66kc=; Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1XxgFB-00082g-S9 for 19274@debbugs.gnu.org; Sun, 07 Dec 2014 18:07:42 +0000 Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1XxgF4-0005aK-MG for 19274@debbugs.gnu.org; Mon, 08 Dec 2014 01:07:34 +0700 From: Ivan Shmakov References: <877fy7nmgt.fsf@violet.siamics.net> <87fvctn913.fsf@violet.siamics.net> <87zjb0lhab.fsf@violet.siamics.net> <83r3wczi7q.fsf@gnu.org> <87vblolfzd.fsf@violet.siamics.net> <83mw70zh5p.fsf@gnu.org> <87r3wclf35.fsf@violet.siamics.net> <83lhmkzga0.fsf@gnu.org> <87mw70lcyr.fsf@violet.siamics.net> <83d27vzb2h.fsf@gnu.org> <871tobl5cd.fsf@violet.siamics.net> <83a92zz6ja.fsf@gnu.org> Mail-Followup-To: 19274@debbugs.gnu.org Date: Sun, 07 Dec 2014 18:07:34 +0000 In-Reply-To: <83a92zz6ja.fsf@gnu.org> (Eli Zaretskii's message of "Sun, 07 Dec 2014 19:58:01 +0200") Message-ID: <87wq63jpuh.fsf@violet.siamics.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.7 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable >>>>> Eli Zaretskii writes: >>>>> From: Ivan Shmakov Date: Sun, 07 Dec 2014 17:47:30 +0000 [=E2=80=A6] >> Does it make sense to also simplify the head of the sentence as >> follows? (I believe that =E2=80=9Clines=E2=80=9D are rather just an im= plementation >> detail here.) >> - The command inserts the new file on the line above the current >> one, >> + The command inserts the new file before the current one, > Yes, that's better. The revised patch for doc/emacs/files.texi is MIMEd. (The rest remains the same [1].) [1] news:871tobl5cd.fsf@violet.siamics.net http://permalink.gmane.org/gmane.emacs.bugs/96948 --=20 FSF associate member #7257 http://boycottsystemd.org/ =E2=80=A6 3013 B6A0= 230E 334A --=-=-= Content-Type: text/diff Content-Disposition: inline --- a/doc/emacs/files.texi 2014-06-08 07:41:27 +0000 +++ b/doc/emacs/files.texi 2014-12-07 18:05:31 +0000 @@ -1689,6 +1689,13 @@ @node File Archives another window, so you could edit the file and operate on the archive simultaneously. + The @kbd{I} key adds a new (regular) file to the archive. The file +is initially empty, but can readily be edited using the commands +above. The command inserts the new file before the current one, so +that using it on the topmost line of the Tar buffer makes the new file +the first one in the archive, and using it at the end of the buffer +makes it the last one. + @kbd{d} marks a file for deletion when you later use @kbd{x}, and @kbd{u} unmarks a file, as in Dired. @kbd{C} copies a file from the archive to disk and @kbd{R} renames a file within the archive. --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Mon Dec 29 04:01:04 2014 Received: (at control) by debbugs.gnu.org; 29 Dec 2014 09:01:04 +0000 Received: from localhost ([127.0.0.1]:60183 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y5WCG-00050s-FI for submit@debbugs.gnu.org; Mon, 29 Dec 2014 04:01:04 -0500 Received: from fely.am-1.org ([78.47.74.50]:46761) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Y5WCD-00050J-N4 for control@debbugs.gnu.org; Mon, 29 Dec 2014 04:01:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Message-ID:Date:Sender:Subject:To:From; bh=1siiA8qGfEwATDrcsznszeE9vWtzeRu014lFZeJpj0g=; b=GmLdqCa0w0aOvakXKbvs4MxSN0dDhn7hxIlqeS6ccdqmj+pOMa2DyVv52l8oD1hKIjF9iKJ9Y+yJIzRsjkushh3MZiTeOUs2y9XC9rWB1AwRX6jPo99KYsnAqq2lIuadXaTLItpr7F+muFU4INZUzlT8+kjb4nbgcXbsyFfjEIE=; Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1Y5WCC-0005wY-9p for control@debbugs.gnu.org; Mon, 29 Dec 2014 09:01:00 +0000 Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1Y5WC4-0001Tq-8x for control@debbugs.gnu.org; Mon, 29 Dec 2014 16:00:52 +0700 From: Ivan Shmakov To: control@debbugs.gnu.org Subject: tweaking bugs Mail-Followup-To: emacs-devel@gnu.org Date: Mon, 29 Dec 2014 09:00:51 +0000 Message-ID: <87a926bzjw.fsf@violet.siamics.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) tags 19462 + patch tags 19274 + patch tags 19140 + patch tags 16002 + patch fixed 19435 24.5 thanks The code suggested in #16002 already works; it=E2=80=99s only the matter of where to put it in. (Or not.) --=20 FSF associate member #7257 http://boycottsystemd.org/ =E2=80=A6 3013 B6A0= 230E 334A From unknown Tue Jun 24 05:13:15 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.503 (Entity 5.503) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Ivan Shmakov Subject: bug#19274: closed (Re: bug#19274: tar-mode.el: allow for adding new archive members ) Message-ID: References: <878ugnnan1.fsf@violet.siamics.net> <877fy7nmgt.fsf@violet.siamics.net> X-Gnu-PR-Message: they-closed 19274 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 19274@debbugs.gnu.org Date: Tue, 27 Jan 2015 22:05:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1422396302-14293-1" This is a multi-part message in MIME format... ------------=_1422396302-14293-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #19274: tar-mode.el: allow for adding new archive members=20 which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 19274@debbugs.gnu.org. --=20 19274: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D19274 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1422396302-14293-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 19274-done) by debbugs.gnu.org; 27 Jan 2015 22:04:36 +0000 Received: from localhost ([127.0.0.1]:58357 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YGEFP-0003he-7J for submit@debbugs.gnu.org; Tue, 27 Jan 2015 17:04:35 -0500 Received: from fely.am-1.org ([78.47.74.50]:51178) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1YGEFN-0003hW-DW for 19274-done@debbugs.gnu.org; Tue, 27 Jan 2015 17:04:34 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Type:MIME-Version:Message-ID:In-Reply-To:Date:Sender:References:Subject:To:From; bh=/T45/wLu7gi7kEg8VMuvA2Nx+LYVVOOUYqgNhGuYOzs=; b=QBHTFaPPfcMQj1nf1LaEV1oUPLc/pyqrE23PzSEPo+064Zhq+Yko4+Oh2Ydb6l95YyVx/P2OjbubSgTXFX5q88P2tIFw+QZ2xoJC33ijTPc5RXwoSrZYgCUTtc9wMMGiKibcrjsMpbEYeSgBfrfAcRdDtcVcE9fb2/rwism9U5Y=; Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1YGEFM-0004gH-84 for 19274-done@debbugs.gnu.org; Tue, 27 Jan 2015 22:04:32 +0000 Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1YGEF9-0007Iz-63 for 19274-done@debbugs.gnu.org; Wed, 28 Jan 2015 05:04:19 +0700 From: Ivan Shmakov To: 19274-done@debbugs.gnu.org Subject: Re: bug#19274: tar-mode.el: allow for adding new archive members References: <877fy7nmgt.fsf@violet.siamics.net> <87fvctn913.fsf@violet.siamics.net> <87zjb0lhab.fsf@violet.siamics.net> <83r3wczi7q.fsf@gnu.org> <87vblolfzd.fsf@violet.siamics.net> <83mw70zh5p.fsf@gnu.org> <87r3wclf35.fsf@violet.siamics.net> <83lhmkzga0.fsf@gnu.org> <87mw70lcyr.fsf@violet.siamics.net> <83d27vzb2h.fsf@gnu.org> <871tobl5cd.fsf@violet.siamics.net> <83a92zz6ja.fsf@gnu.org> <87wq63jpuh.fsf@violet.siamics.net> Mail-Followup-To: 19274@debbugs.gnu.org Date: Tue, 27 Jan 2015 22:04:18 +0000 In-Reply-To: <87wq63jpuh.fsf@violet.siamics.net> (Ivan Shmakov's message of "Sun, 07 Dec 2014 18:07:34 +0000") Message-ID: <878ugnnan1.fsf@violet.siamics.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: 19274-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Version: 25.1 >>>>> Ivan Shmakov writes: [=E2=80=A6] > The revised patch for doc/emacs/files.texi is MIMEd. (The rest > remains the same [1].) > [1] news:871tobl5cd.fsf@violet.siamics.net > http://permalink.gmane.org/gmane.emacs.bugs/96948 Pushed; closing. --=20 FSF associate member #7257 http://boycottsystemd.org/ =E2=80=A6 3013 B6A0= 230E 334A --=-=-= Content-Type: text/plain Content-Disposition: inline commit a56eab8259568ea1389e972623e46359e73c0233 Allow for adding new members to Tar archives. * lisp/tar-mode.el: Allow for adding new archive members. (tar-new-regular-file-header, tar--pad-to, tar--put-at) (tar-header-serialize): New functions. (tar-current-position): Split from tar-current-descriptor. (tar-current-descriptor): Use it. (tar-new-entry): New command. (tar-mode-map): Bind it. * doc/emacs/files.texi (File Archives): Document "I" for tar-new-entry. * etc/NEWS: Mention the new tar-new-entry command. Fixes: debbugs:19274 --=-=-=-- ------------=_1422396302-14293-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 4 Dec 2014 21:18:10 +0000 Received: from localhost ([127.0.0.1]:54031 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xwdmr-0002bd-HH for submit@debbugs.gnu.org; Thu, 04 Dec 2014 16:18:10 -0500 Received: from fely.am-1.org ([78.47.74.50]:43489) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1Xwdmo-0002bT-1r for submit@debbugs.gnu.org; Thu, 04 Dec 2014 16:18:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=siamics.net; s=a2013295; h=Content-Type:MIME-Version:Message-ID:Date:Sender:Subject:To:From; bh=MBxMoEJG5CJAPnTfe5NwOYdpkl+tzpV9CxqignFsb9I=; b=UtPcaIB5Hdo3VJnneABI3DWnVsSpcP3PHPGEjdUtqMFW58ktfSVHRA41uDTZ80YiiYNRD+lWrEl2muTd+PEom+cNglx1X0q/STQCkKqhVcyx7JwEKaNMdxWp9RYEoakHMj1OL/EkhQcVEjT3tNZTXL/rHZXqEoE69WJ9TdtJGfk=; Received: from [2a02:2560:6d4:26ca::1:1d] (helo=violet.siamics.net) by fely.am-1.org with esmtps (TLS1.2:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1Xwdml-0008VZ-1B for submit@debbugs.gnu.org; Thu, 04 Dec 2014 21:18:03 +0000 Received: from localhost ([::1] helo=violet.siamics.net) by violet.siamics.net with esmtps (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1Xwdmd-0005m5-IB for submit@debbugs.gnu.org; Fri, 05 Dec 2014 04:17:55 +0700 From: Ivan Shmakov To: submit@debbugs.gnu.org Subject: tar-mode.el: allow for adding new archive members Date: Thu, 04 Dec 2014 21:17:54 +0000 Message-ID: <877fy7nmgt.fsf@violet.siamics.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.7 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 0.7 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Package: emacs Severity: wishlist Please consider the patch MIMEd. * tar-mode.el: Allow for adding new archive members. (tar--pad-to, tar--put-at, tar-header-serialize): New functions. (tar-current-position): Split from tar-current-descriptor. (tar-current-descriptor): Use it. (tar-new-entry): New command. (tar-mode-map): Bind it. --=20 FSF associate member #7257 http://boycottsystemd.org/ =E2=80=A6 3013 B6A0= 230E 334A --=-=-= Content-Type: text/diff Content-Disposition: inline --- a/lisp/tar-mode.el +++ b/lisp/tar-mode.el @@ -369,6 +369,58 @@ string) (tar-parse-octal-integer string)) +(defun tar--pad-to (pos) + (make-string (+ pos (- (point)) (point-min)) 0)) + +(defun tar--put-at (pos val) + (when val + (insert (tar--pad-to pos) val))) + +(defun tar-header-serialize (header &optional update-checksum) + (with-temp-buffer + (set-buffer-multibyte nil) + (let ((encoded-name + (encode-coding-string (tar-header-name header) + tar-file-name-coding-system))) + (unless (< (length encoded-name) 99) + ;; FIXME: implement it + (error "Long file name support is not implemented")) + (insert encoded-name)) + (insert (tar--pad-to tar-mode-offset) + (format "%6o\0 " (logand #o777777 (tar-header-mode header))) + (format "%6o\0 " (logand #o777777 (tar-header-uid header))) + (format "%6o\0 " (logand #o777777 (tar-header-gid header)))) + (insert (tar--pad-to tar-size-offset) + (format "%11o " (tar-header-size header))) + (insert (tar--pad-to tar-time-offset) + (tar-octal-time (tar-header-date header)) + " ") + ;; omit tar-header-checksum (tar-chk-offset) for now + (tar--put-at tar-linkp-offset (tar-header-link-type header)) + (tar--put-at tar-link-offset (tar-header-link-name header)) + (when (tar-header-magic header) + (tar--put-at tar-magic-offset (tar-header-magic header)) + (tar--put-at tar-uname-offset (tar-header-uname header)) + (tar--put-at tar-gname-offset (tar-header-gname header)) + (let ((dmaj (tar-header-dmaj header)) + (dmin (tar-header-dmin header))) + (tar--put-at tar-dmaj-offset + (and dmaj (format "%7o\0" (logand #o7777777 dmaj)))) + (tar--put-at tar-dmin-offset + (and dmin (format "%7o\0" (logand #o7777777 dmin)))))) + (tar--put-at 512 "") + (let ((ck (tar-header-block-checksum (buffer-string)))) + (goto-char (+ (point-min) tar-chk-offset)) + (delete-char 8) + (insert (format "%6o\0 " ck)) + (when update-checksum + (setf (tar-header-checksum header) ck)) + (tar-header-block-check-checksum (buffer-string) + (tar-header-checksum header) + (tar-header-name header))) + ;; . + (buffer-string))) + (defun tar-header-block-checksum (string) "Compute and return a tar-acceptable checksum for this block." @@ -547,6 +599,7 @@ defvar tar-mode-map (define-key map "p" 'tar-previous-line) (define-key map "\^P" 'tar-previous-line) (define-key map [up] 'tar-previous-line) + (define-key map "I" 'tar-new-entry) (define-key map "R" 'tar-rename-entry) (define-key map "u" 'tar-unflag) (define-key map "v" 'tar-view) @@ -731,10 +784,14 @@ (interactive "p") (tar-next-line (- arg))) +(defun tar-current-position () + "Return the `tar-parse-info' index for the current line." + (count-lines (point-min) (line-beginning-position))) + (defun tar-current-descriptor (&optional noerror) "Return the tar-descriptor of the current line, or signals an error." ;; I wish lines had plists, like in ZMACS... - (or (nth (count-lines (point-min) (line-beginning-position)) + (or (nth (tar-current-position) tar-parse-info) (if noerror nil @@ -948,6 +1005,45 @@ (write-region start end to-file nil nil nil t))) (message "Copied tar entry %s to %s" name to-file))) +(defun tar-new-entry (filename &optional index) + "Insert a new empty regular file before point." + (interactive "*sNew file name: ") + (let* ((buffer (current-buffer)) + (index (or index (tar-current-position))) + (d-list (and (not (zerop index)) + (nthcdr (+ -1 index) tar-parse-info))) + (pos (if d-list + (tar-header-data-end (car d-list)) + (point-min))) + (new-descriptor + (make-tar-header + nil + filename + #o644 0 0 0 + (current-time) + nil ; checksum + nil nil + nil nil nil nil nil))) + ;; update the data buffer; fill the missing descriptor fields + (with-current-buffer tar-data-buffer + (goto-char pos) + (insert (tar-header-serialize new-descriptor t)) + (setf (tar-header-data-start new-descriptor) + (copy-marker (point) nil))) + ;; update tar-parse-info + (if d-list + (setcdr d-list (cons new-descriptor (cdr d-list))) + (setq tar-parse-info (cons new-descriptor + tar-parse-info))) + ;; update the listing buffer + (save-excursion + (goto-char (point-min)) + (forward-line index) + (let ((inhibit-read-only t)) + (insert (tar-header-block-summarize new-descriptor) ?\n))) + ;; . + index)) + (defun tar-flag-deleted (p &optional unflag) "In Tar mode, mark this sub-file to be deleted from the tar file. With a prefix argument, mark that many files." --=-=-=-- ------------=_1422396302-14293-1--