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: question about "Making change-major-mode-hook buffer-local while locally let-bound!" Date: Sun, 20 Jun 2010 09:51:33 -0700 Message-ID: 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 1277052799 30448 80.91.229.12 (20 Jun 2010 16:53:19 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sun, 20 Jun 2010 16:53:19 +0000 (UTC) To: Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jun 20 18:53:18 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 1OQNll-000645-GT for ged-emacs-devel@m.gmane.org; Sun, 20 Jun 2010 18:53:18 +0200 Original-Received: from localhost ([127.0.0.1]:59586 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OQNlf-0003qm-8T for ged-emacs-devel@m.gmane.org; Sun, 20 Jun 2010 12:53:11 -0400 Original-Received: from [140.186.70.92] (port=46427 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OQNlY-0003qC-KL for emacs-devel@gnu.org; Sun, 20 Jun 2010 12:53:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OQNlQ-0004Ur-3y for emacs-devel@gnu.org; Sun, 20 Jun 2010 12:53:04 -0400 Original-Received: from rcsinet10.oracle.com ([148.87.113.121]:34077) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OQNlP-0004UT-TD for emacs-devel@gnu.org; Sun, 20 Jun 2010 12:52:56 -0400 Original-Received: from rcsinet15.oracle.com (rcsinet15.oracle.com [148.87.113.117]) by rcsinet10.oracle.com (Switch-3.4.2/Switch-3.4.2) with ESMTP id o5KGqqGd006404 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Sun, 20 Jun 2010 16:52:53 GMT Original-Received: from acsmt353.oracle.com (acsmt353.oracle.com [141.146.40.153]) by rcsinet15.oracle.com (Switch-3.4.2/Switch-3.4.1) with ESMTP id o5KF4p4U018938 for ; Sun, 20 Jun 2010 16:52:52 GMT Original-Received: from abhmt009.oracle.com by acsmt355.oracle.com with ESMTP id 358072211277052678; Sun, 20 Jun 2010 09:51:18 -0700 Original-Received: from dradamslap1 (/10.175.249.190) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Sun, 20 Jun 2010 09:51:18 -0700 X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.5931 Thread-Index: AcsQmNcAskJ2FhS1S+yLnIc7vfQTYg== X-Auth-Type: Internal IP X-Source-IP: rcsinet15.oracle.com [148.87.113.117] X-CT-RefId: str=0001.0A090209.4C1E4765.01F2: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:126269 Archived-At: I use a modified definition of `pp-display-expression' that binds these two hooks to nil around the call (emacs-lisp-mode), to prevent the hooks from running: (let ((emacs-lisp-mode-hook nil) (change-major-mode-hook nil)) (emacs-lisp-mode)) That is the only change - otherwise, emacs -Q. (No, I do not remember just why I added the c-m-m-h binding (years ago), but I probably did so because of some problem or annoyance the hook sometimes caused.) The c-m-m-h binding now results in this message being displayed: "Making change-major-mode-hook buffer-local while locally let-bound!" Question: What is the right way to prevent these hooks from running here? Do I need to use remove-hook followed by add-hook: saving, emptying and repopulating the hook? What's the right approach? --- Also, out of curiosity, where is `change-major-mode-hook' being made buffer-local? Grepping the lisp sources shows only these hits that seem to involve making it local: gnus/gnus-msg.el:449: (gnus-make-local-hook 'change-major-mode-hook) arc-mode.el:771: (set (make-local-variable 'change-major-mode-hook) 'archive-desummarize) But arc* and gnus* are not present in `features'. A wild guess suggests maybe something in font-lock is the culprit (emacs -Q shows `(font-lock-change-mode t)' as the local value), but I haven't found anything. I didn't find anything by skimming the C code either. GNU Emacs 24.0.50.1 (i386-mingw-nt5.1.2600) of 2010-06-14 on 3249CTO