unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#11010: tar-subfile-save-buffer: Buffer is read-only: #<buffer foo.tar>
@ 2012-03-13 17:05 Aaron S. Hawley
  2012-03-16  7:22 ` Glenn Morris
  0 siblings, 1 reply; 2+ messages in thread
From: Aaron S. Hawley @ 2012-03-13 17:05 UTC (permalink / raw)
  To: 11010

[-- Attachment #1: Type: text/plain, Size: 1256 bytes --]

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 #2: tar-mode.el.diff --]
[-- Type: application/octet-stream, Size: 732 bytes --]

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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#11010: tar-subfile-save-buffer: Buffer is read-only: #<buffer foo.tar>
  2012-03-13 17:05 bug#11010: tar-subfile-save-buffer: Buffer is read-only: #<buffer foo.tar> Aaron S. Hawley
@ 2012-03-16  7:22 ` Glenn Morris
  0 siblings, 0 replies; 2+ messages in thread
From: Glenn Morris @ 2012-03-16  7:22 UTC (permalink / raw)
  To: 11010-done

Version: 24.0.95

Thanks; applied.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-03-16  7:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-13 17:05 bug#11010: tar-subfile-save-buffer: Buffer is read-only: #<buffer foo.tar> Aaron S. Hawley
2012-03-16  7:22 ` Glenn Morris

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).