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

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

bug#13261: 24.3.50; unclear behavior & msg: "File is read-only on disk.


From: Drew Adams
Subject: bug#13261: 24.3.50; unclear behavior & msg: "File is read-only on disk. Change buffer mode?"
Date: Sun, 23 Dec 2012 16:05:56 -0800

I have some code that first creates a buffer for visiting a file, using
`create-file-buffer', then visits the buffer using `with-current-buffer'
and `insert-file-contents' with non-nil VISIT.  Later the code might use
`find-file' and `revert-buffer', to put the buffer in the right mode
etc.
 
When the file in question is read-only on disk, the user gets queried
with the question in the Subject line.
 
First, the message is unclear: "buffer mode" in Emacs means the major
mode of the buffer.  Is that really what is meant here?  Or does the
message mean changing between read-only and writable "modes"?
 
In my case, the code reverts the buffer, so the major mode does change.
But looking at the Emacs code that issues the query, it seems that it
has only to do with the read-only status and nothing to do with the
major mode (?).  Not clear to me, at least.
 
Second, why is this message issued in the scenario I described?  I am
not claiming that it is incorrect to do so (I don't know).  But it is a
mystery to me how the read-only/writable status is changed here.
 
If I knew what was going on perhaps I could take appropriate action to
inhibit the message.  Looking at the code, it seems that before
reversion the buffer was writable, but after reversion it is read-only,
because of the file status on disk.  Is that right?
 
If so, what is the right way to inhibit this user query?  I do not want
to inhibit read-only mode if the file is read-only.  Do I need to
somehow test the file's disk status and then bind the buffer's
read-only status correspondingly before I call `revert-buffer'?
If so, how?
 
My code does the right thing, at any rate: the buffer after reversion,
which is the first time the user sees it, is read-only.  It is only the
user query that I would like to find some way to suppress.
 
So I am filing this bug report to obtain information, but also
because I think the "buffer mode" part of the message is confusing,
if not misleading.
 
And also because I wonder if there might be an Emacs code bug here.  I
doubt it - this part of the code is no doubt rock solid.  But it's not
yet clear to me what is happening or why.  Thanks in advance for
enlightening me.
 
In GNU Emacs 24.3.50.1 (i386-mingw-nt5.1.2600)
 of 2012-12-18 on MS-W7-DANI
Bzr revision: 111265 eliz@gnu.org-20121218190556-x9wmq083vwecgu0f
Windowing system distributor `Microsoft Corp.', version 5.1.2600
Configured using:
 `configure --with-gcc (4.7) --no-opt --enable-checking --cflags
 -Ic:/emacs/libs/libXpm-3.5.10/include -Ic:/emacs/libs/libXpm-3.5.10/src
 -Ic:/emacs/libs/libpng-dev_1.4.3-1_win32/include
 -Ic:/emacs/libs/zlib-dev_1.2.5-2_win32/include
 -Ic:/emacs/libs/giflib-4.1.4-1-lib/include
 -Ic:/emacs/libs/jpeg-6b-4-lib/include
 -Ic:/emacs/libs/tiff-3.8.2-1-lib/include
 -Ic:/emacs/libs/libxml2-2.7.8-w32-bin/include/libxml2
 -Ic:/emacs/libs/gnutls-3.0.9-w32-bin/include
 -Ic:/emacs/libs/libiconv-1.9.2-1-lib/include'
 






reply via email to

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