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

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

bug#11010: tar-subfile-save-buffer: Buffer is read-only: #<buffer foo.ta


From: Aaron S. Hawley
Subject: bug#11010: tar-subfile-save-buffer: Buffer is read-only: #<buffer foo.tar>
Date: Tue, 13 Mar 2012 13:05:12 -0400

Opening a tar file and then a sub file, used to be able to save.
Doesn't seem to be the case in the latest Emacs pretest.  In fact,
everything's opening as read-only.

Test case:

M-! touch foo; tar cf foo.tar foo RET
C-x C-f foo.tar RET f C-x q
<EDIT>
C-x s !

The above should save the files including the sub file, but instead
complains about the tar file being.

The following patch removes the C-x q and saving actually works.
Seems this bug was a result of tar-mode inheriting from special-mode.

Thanks for Emacs,
/a

2012-03-13  Aaron S. Hawley  <Aaron.S.Hawley@gmail.com>

        * tar-mode.el (tar-mode): Fix saving by conditionally undoing
        `special-mode' setting of `buffer-read-only'.

--- tar-mode.el 2012-02-13 11:13:25.000000000 -0500
+++ tar-mode.el 2012-03-13 12:54:00.376389400 -0400
@@ -634,6 +634,9 @@

 See also: variables `tar-update-datestamp' and `tar-anal-blocksize'.
 \\{tar-mode-map}"
+  (when (and buffer-file-name
+             (file-writable-p buffer-file-name))
+    (setq buffer-read-only nil)) ;; Undo what `special-mode' did.
   (make-local-variable 'tar-parse-info)
   (set (make-local-variable 'require-final-newline) nil) ; binary data, dude...
   (set (make-local-variable 'local-enable-local-variables) nil)

Attachment: tar-mode.el.diff
Description: Binary data


reply via email to

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