From: "Aaron S. Hawley" <aaron.s.hawley@gmail.com>
To: 11010@debbugs.gnu.org
Subject: bug#11010: tar-subfile-save-buffer: Buffer is read-only: #<buffer foo.tar>
Date: Tue, 13 Mar 2012 13:05:12 -0400 [thread overview]
Message-ID: <CAFw1JJ6a3_zwPGdbQz28TP6fZEHZ7KTvAWg1hxJibhpd6rovBg@mail.gmail.com> (raw)
[-- 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)
next reply other threads:[~2012-03-13 17:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-03-13 17:05 Aaron S. Hawley [this message]
2012-03-16 7:22 ` bug#11010: tar-subfile-save-buffer: Buffer is read-only: #<buffer foo.tar> Glenn Morris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAFw1JJ6a3_zwPGdbQz28TP6fZEHZ7KTvAWg1hxJibhpd6rovBg@mail.gmail.com \
--to=aaron.s.hawley@gmail.com \
--cc=11010@debbugs.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.