From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.bugs 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 Message-ID: <3AEE032F741740CCA5D9EF9664BB5DDE@us.oracle.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1356307602 13094 80.91.229.3 (24 Dec 2012 00:06:42 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 24 Dec 2012 00:06:42 +0000 (UTC) To: 13261@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Dec 24 01:06:56 2012 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TmvZG-0007YP-F2 for geb-bug-gnu-emacs@m.gmane.org; Mon, 24 Dec 2012 01:06:54 +0100 Original-Received: from localhost ([::1]:59425 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TmvZ2-0002lx-Cs for geb-bug-gnu-emacs@m.gmane.org; Sun, 23 Dec 2012 19:06:40 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:35256) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TmvYz-0002ls-0t for bug-gnu-emacs@gnu.org; Sun, 23 Dec 2012 19:06:38 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TmvYx-0003zo-VL for bug-gnu-emacs@gnu.org; Sun, 23 Dec 2012 19:06:36 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:46914) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TmvYx-0003zj-Qi for bug-gnu-emacs@gnu.org; Sun, 23 Dec 2012 19:06:35 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TmvZO-0005mg-Im for bug-gnu-emacs@gnu.org; Sun, 23 Dec 2012 19:07:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: "Drew Adams" Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 24 Dec 2012 00:07:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 13261 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: X-Debbugs-Original-To: Original-Received: via spool by submit@debbugs.gnu.org id=B.135630760522210 (code B ref -1); Mon, 24 Dec 2012 00:07:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 24 Dec 2012 00:06:45 +0000 Original-Received: from localhost ([127.0.0.1]:57165 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TmvZ7-0005mB-B4 for submit@debbugs.gnu.org; Sun, 23 Dec 2012 19:06:45 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:52092) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TmvZ5-0005m4-8d for submit@debbugs.gnu.org; Sun, 23 Dec 2012 19:06:43 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TmvYc-0003yh-Lu for submit@debbugs.gnu.org; Sun, 23 Dec 2012 19:06:15 -0500 Original-Received: from lists.gnu.org ([208.118.235.17]:40767) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TmvYc-0003yc-IU for submit@debbugs.gnu.org; Sun, 23 Dec 2012 19:06:14 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:35216) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TmvYa-0002ko-IV for bug-gnu-emacs@gnu.org; Sun, 23 Dec 2012 19:06:14 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TmvYZ-0003xP-5z for bug-gnu-emacs@gnu.org; Sun, 23 Dec 2012 19:06:12 -0500 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:48993) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TmvYY-0003xD-Vz for bug-gnu-emacs@gnu.org; Sun, 23 Dec 2012 19:06:11 -0500 Original-Received: from ucsinet22.oracle.com (ucsinet22.oracle.com [156.151.31.94]) by aserp1040.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id qBO069a1010936 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 24 Dec 2012 00:06:10 GMT Original-Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by ucsinet22.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id qBO068mJ014441 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 24 Dec 2012 00:06:09 GMT Original-Received: from abhmt116.oracle.com (abhmt116.oracle.com [141.146.116.68]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id qBO068cm011887 for ; Sun, 23 Dec 2012 18:06:08 -0600 Original-Received: from dradamslap1 (/71.202.147.44) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 23 Dec 2012 16:06:07 -0800 X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Thread-Index: Ac3hanKNOPJ26jHbRAq+/EscOP0Y/w== X-Source-IP: ucsinet22.oracle.com [156.151.31.94] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:68965 Archived-At: 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'