From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: toggle-read-only should not give compilation warnings Date: Fri, 13 Jul 2012 13:22:45 +0800 Message-ID: <87txxcgrq2.fsf@gnu.org> References: <877gubszqq.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1342156978 2805 80.91.229.3 (13 Jul 2012 05:22:58 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 13 Jul 2012 05:22:58 +0000 (UTC) Cc: emacs-devel@gnu.org To: Glenn Morris Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 13 07:22:58 2012 Return-path: Envelope-to: ged-emacs-devel@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 1SpYL9-0004K9-Rg for ged-emacs-devel@m.gmane.org; Fri, 13 Jul 2012 07:22:55 +0200 Original-Received: from localhost ([::1]:38045 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SpYL8-0003QL-VD for ged-emacs-devel@m.gmane.org; Fri, 13 Jul 2012 01:22:54 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:36389) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SpYL6-0003Q4-PL for emacs-devel@gnu.org; Fri, 13 Jul 2012 01:22:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SpYL5-00005N-Og for emacs-devel@gnu.org; Fri, 13 Jul 2012 01:22:52 -0400 Original-Received: from fencepost.gnu.org ([208.118.235.10]:52171) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SpYL5-00005I-Ld for emacs-devel@gnu.org; Fri, 13 Jul 2012 01:22:51 -0400 Original-Received: from [155.69.18.139] (port=40060 helo=ulysses) by fencepost.gnu.org with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1SpYL4-0008Qh-Ft; Fri, 13 Jul 2012 01:22:51 -0400 In-Reply-To: (Glenn Morris's message of "Wed, 11 Jul 2012 14:22:40 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.1.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 208.118.235.10 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:151584 Archived-At: Glenn Morris writes: > IMO, it would be better to factor out the view mode enabling piece to > a separate function to be explicitly called when necessary after > setting buffer-read-only. This would then remove the ambiguity. > > Some issues caused by inappropriate use of toggle-read-only are: 7292, > 10006. toggle-read-only does two View mode related things: (i) if the buffer is in View mode, making it writable disables View mode; and (ii) if `view-read-only' is non-nil, making the buffer read-only enables View mode. As far as I can tell, (i) is generally desirable, even in Lisp calls; otherwise the buffer ends up in an unsatisfactory state where most self-inserting keys do the usual thing but SPC scrolls. Bug#7292 is a case where the Lisp caller is not set up to handle (ii) properly, and in that case setting `buffer-read-only' is the right thing to do. But there are many other cases where Lisp callers really want to do the same as C-x C-q, including obeying `view-read-only'. As for Bug#10006, that is a plain misunderstanding about the `buffer-read-only' variable; the reporter could have filed the same bug with respect to an interactive invocation of `C-x C-q'. So it doesn't seem relevant. > Maybe on average it's right to use it as often as it is wrong. A > warning at least might make people thunk about whether they do want to > use it. A prevalance of spurious warnings tend to mask real ones, by teaching people to ignore warnings. So I'd like to get rid of these one way or another---but preferably without sprinking with-no-warnings all over the place.