From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Glenn Morris Newsgroups: gmane.emacs.devel Subject: Re: toggle-read-only should not give compilation warnings Date: Wed, 11 Jul 2012 14:22:40 -0400 Message-ID: References: <877gubszqq.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1342030973 19313 80.91.229.3 (11 Jul 2012 18:22:53 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 11 Jul 2012 18:22:53 +0000 (UTC) Cc: emacs-devel@gnu.org To: Chong Yidong Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jul 11 20:22:53 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 1Sp1Yl-0007Fi-0r for ged-emacs-devel@m.gmane.org; Wed, 11 Jul 2012 20:22:47 +0200 Original-Received: from localhost ([::1]:55667 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sp1Yk-0007tZ-6I for ged-emacs-devel@m.gmane.org; Wed, 11 Jul 2012 14:22:46 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:48967) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sp1Yh-0007tU-Ir for emacs-devel@gnu.org; Wed, 11 Jul 2012 14:22:44 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sp1Yg-0003f7-G7 for emacs-devel@gnu.org; Wed, 11 Jul 2012 14:22:43 -0400 Original-Received: from fencepost.gnu.org ([208.118.235.10]:57066) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sp1Yg-0003f1-CP for emacs-devel@gnu.org; Wed, 11 Jul 2012 14:22:42 -0400 Original-Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1Sp1Ye-000240-T5; Wed, 11 Jul 2012 14:22:40 -0400 X-Spook: pink noise mindwar SRI Marxist Exon Shell pipeline X-Ran: F_8WB+?7'N#u[yd5;j\5rif2Lsw5?Qv0[c=88C#l6|JaAmyIxn'H+>A[kdk!ZEl,||#C1: X-Hue: cyan X-Attribution: GM In-Reply-To: <877gubszqq.fsf@gnu.org> (Chong Yidong's message of "Wed, 11 Jul 2012 12:11:57 +0800") User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) 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:151541 Archived-At: Chong Yidong wrote: > There are lots of toggle-read-only warnings in the Emacs Lisp source > tree. I count 10 (excluding obsolete/). Some are probably already suppressed though. Of these: cedet/ede/util.el seems obviously wrong. cedet/semantic/debug.el and vc/ediff.el are unclear to me. gnus/smime.el seems bugged (fails to ensure a pre-existing buffer is read-write). vc/vc-cvs.el seems wrong. vc/vc.el not immediately clear. > As far as I can tell, the overwhelming majority of these are all > legitimate use cases. The typical intention is "do whatever the > `toggle-read-only' command does, then do some other stuff on top of > that," so the caveat about toggle-read-only not being used in Lisp > code is bogus. The obvious intention is to make the buffer read-only. Often it's unclear to me whether the author also wanted the "extra stuff" that toggle-read-only does (which is only view-mode, isn't it?), or just didn't think about it. 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. 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.