From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.cc-mode.general,gmane.emacs.devel Subject: Re: cc-mode 5.31 doesn't like eval-after-load c-set-style Date: Wed, 7 Dec 2005 17:08:12 +0000 (GMT) Message-ID: References: <17302.64294.256799.692482@chlr5836.ch.intel.com> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: sea.gmane.org 1133975514 3284 80.91.229.2 (7 Dec 2005 17:11:54 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 7 Dec 2005 17:11:54 +0000 (UTC) Cc: bug-cc-mode@gnu.org, emacs-devel@gnu.org Original-X-From: cc-mode-help-admin@lists.sourceforge.net Wed Dec 07 18:11:50 2005 Return-path: Original-Received: from lists-outbound.sourceforge.net ([66.35.250.225]) by ciao.gmane.org with esmtp (Exim 4.43) id 1Ek2lv-0002pt-Rv for sf-cc-mode-help@m.gmane.org; Wed, 07 Dec 2005 18:08:04 +0100 Original-Received: from sc8-sf-list1-b.sourceforge.net (sc8-sf-list1-b.sourceforge.net [10.3.1.7]) by sc8-sf-spam2.sourceforge.net (Postfix) with ESMTP id 1139C161A3; Wed, 7 Dec 2005 09:08:03 -0800 (PST) Original-Received: from sc8-sf-mx1-b.sourceforge.net ([10.3.1.91] helo=mail.sourceforge.net) by sc8-sf-list1.sourceforge.net with esmtp (Exim 4.30) id 1Ek2lc-0003mp-Ll for cc-mode-help@lists.sourceforge.net; Wed, 07 Dec 2005 09:07:44 -0800 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by mail.sourceforge.net with esmtps (TLSv1:DES-CBC3-SHA:168) (Exim 4.44) id 1Ek2lZ-0002TL-Da for cc-mode-help@lists.sourceforge.net; Wed, 07 Dec 2005 09:07:44 -0800 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by fencepost.gnu.org with esmtp (Exim 4.34) id 1Ek2ky-0007IX-7V for bug-cc-mode@gnu.org; Wed, 07 Dec 2005 12:07:04 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.34) id 1Ek2mb-0007ve-SV for bug-cc-mode@gnu.org; Wed, 07 Dec 2005 12:08:46 -0500 Original-Received: from [193.149.49.134] (helo=acm.acm) by monty-python.gnu.org with esmtp (Exim 4.34) id 1Ek2ma-0007uD-LS; Wed, 07 Dec 2005 12:08:45 -0500 Original-Received: from localhost (root@localhost) by acm.acm (8.8.8/8.8.8) with SMTP id RAA00820; Wed, 7 Dec 2005 17:08:13 GMT X-Sender: root@acm.acm Original-To: "Andrew M. Scott" In-Reply-To: <17302.64294.256799.692482@chlr5836.ch.intel.com> X-Spam-Checker-Version: SpamAssassin 2.63 (2004-01-11) on monty-python X-Spam-Level: X-Spam-Status: No, hits=0.0 required=5.0 tests=none autolearn=no version=2.63 X-Spam-Score: 1.0 (+) X-Spam-Report: Spam Filtering performed by sourceforge.net. See http://spamassassin.org/tag/ for more details. Report problems to http://sf.net/tracker/?func=add&group_id=1&atid=200001 1.0 FORGED_RCVD_HELO Received: contains a forged HELO Original-Sender: cc-mode-help-admin@lists.sourceforge.net Errors-To: cc-mode-help-admin@lists.sourceforge.net X-BeenThere: cc-mode-help@lists.sourceforge.net X-Mailman-Version: 2.0.9-sf.net Precedence: bulk List-Unsubscribe: , List-Id: Bug reports, feature requests, and general talk about CC Mode. List-Post: List-Help: List-Subscribe: , List-Archive: X-Original-Date: Wed, 7 Dec 2005 17:08:12 +0000 (GMT) Xref: news.gmane.org gmane.emacs.cc-mode.general:2761 gmane.emacs.devel:47113 Archived-At: Hi, Andrew! On Wed, 7 Dec 2005, Andrew M. Scott wrote: >FYI, I had also posted this on Dec 5th on the emacs-pretest-bug list >(no response yet): >http://lists.gnu.org/archive/html/emacs-pretest-bug/2005-12/msg00075.html Sorry! bug-cc-mode (even as a cc:) is always a better place, because important emails there don't get swamped by other important emails. >I've had the following code snippet in my .emacs file for ages, but >only recently (since cc-mode 5.31?) has it produced errors like this >one. I see the issue with both a Dec 5, 2005 and Nov 2004 CVS Emacs >build I had available. I also tried cc-mode 5.31.1 that I saw on >sourceforge, but get the same error. >% emacs -q >Eval the following code snippet: >(eval-after-load "cc-mode" > '(progn > (c-set-style "gnu") > )) OK, that code's wrong! `c-set-style' applies to an individual buffer, and if you do it in the eval-after-load form, the current buffer is somewhat ill-defined. For example, if you did (load-library 'cc-mode), Bad Things might happen. An extra check was added fairly recently to c-set-style because Bad Things were happening when people called it for non-CC Mode buffers. Are you sure you don't really want (setq c-default-style "gnu"), [or even, (setq c-default-style '((java-mode . "java") (awk-mode . "awk")))?] You can even do this with customize-group c . Or is it that you've got the default style set to "linux" and you want the first buffer to be loaded, junk.c, to get "gnu"? >C-x C-f junk.c What happens is this: this command loads junk.c, sees it needs c-mode, so it loads cc-mode.elc. It then tries to set the style "gnu" on junk.c before it's had a chance to initialise c-mode on it. The error message in this case "Buffer junk.c is not a CC Mode buffer" is perhaps suboptimal. Do you think "Buffer junk.c is not a CC Mode buffer, or hasn't been initialized yet" might be better? What exactly do you see as the bug? Is it the obscure error message, or do you really, really, absolutely unavoidably HAVE to set junk.c's style in this eval-after-load? [ .... ] >Thanks, >Andy Scott -- Alan Mackenzie (Munich, Germany) ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click