From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: question about "Making change-major-mode-hook buffer-local while locally let-bound!" Date: Mon, 21 Jun 2010 21:10:50 -0700 Message-ID: <80A8EA57888645DB9610A635D8BC0706@us.oracle.com> References: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1277180294 22207 80.91.229.12 (22 Jun 2010 04:18:14 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 22 Jun 2010 04:18:14 +0000 (UTC) Cc: emacs-devel@gnu.org To: "'Stefan Monnier'" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 22 06:18:13 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OQuw1-0000Y9-Aj for ged-emacs-devel@m.gmane.org; Tue, 22 Jun 2010 06:18:12 +0200 Original-Received: from localhost ([127.0.0.1]:57495 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OQuvx-0001GB-Nl for ged-emacs-devel@m.gmane.org; Tue, 22 Jun 2010 00:18:01 -0400 Original-Received: from [140.186.70.92] (port=59286 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OQuvk-0001D9-3D for emacs-devel@gnu.org; Tue, 22 Jun 2010 00:17:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OQupd-0001nB-AV for emacs-devel@gnu.org; Tue, 22 Jun 2010 00:11:30 -0400 Original-Received: from rcsinet10.oracle.com ([148.87.113.121]:62671) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OQupd-0001mn-5a for emacs-devel@gnu.org; Tue, 22 Jun 2010 00:11:29 -0400 Original-Received: from rcsinet13.oracle.com (rcsinet13.oracle.com [148.87.113.125]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o5M4BOWi028708 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 22 Jun 2010 04:11:25 GMT Original-Received: from acsmt354.oracle.com (acsmt354.oracle.com [141.146.40.154]) by rcsinet13.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o5M4BJPp032546; Tue, 22 Jun 2010 04:11:20 GMT Original-Received: from abhmt015.oracle.com by acsmt354.oracle.com with ESMTP id 345551171277179851; Mon, 21 Jun 2010 21:10:51 -0700 Original-Received: from dradamslap1 (/141.144.168.198) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 21 Jun 2010 21:10:51 -0700 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: AcsRoegB/pUC0gPPSqCYzU4XLRNUQgAHdphg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 X-Auth-Type: Internal IP X-Source-IP: rcsinet13.oracle.com [148.87.113.125] X-CT-RefId: str=0001.0A090209.4C2037EE.0051:SCFMA4539811,ss=1,fgs=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:126321 Archived-At: > (make-local-variable 'emacs-lisp-mode-hook) > (make-local-variable 'change-major-mode-hook) > (let ((emacs-lisp-mode-hook nil) > (change-major-mode-hook nil)) > (emacs-lisp-mode)) > > Those hooks are not permanent-local, so they'll be emptied and > repopulated as needed by the call to emacs-lisp-mode. > So you could probably just do: > > (set (make-local-variable 'emacs-lisp-mode-hook) nil) > (set (make-local-variable 'change-major-mode-hook) nil) > (emacs-lisp-mode) Very clear; thank you. > > What is gained by having such a runtime message? > > This messages is linked to a problematic circumstance where > Emacs tries to do its best, but where the code should ideally > be changed to avoid such a circumstance. So it's important > to detect and warn about those cases, and sadly, I don't know > how to do it at a better time. This, however, is not so clear. ;-) What I take away from it is that there is some unspecified problem somewhere that has no easy solution, so to encourage programmers not to write code that might manifest the problem you think it best to issue a runtime message about the problematic code. That doesn't sound like a good approach, to me, but you know the details, not I. I suppose it is a serious problem, in order to make it warrant such a strange remedy. Anyway, thanks very much for the explanation above.