From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.cc-mode.general,gmane.emacs.bugs Subject: Re: bug#347: C mode asks twice about local variables Date: Mon, 09 Jun 2008 11:18:28 -0400 Message-ID: References: <20080601172143.GA5899@muc.de> <20080609143651.GA6098@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1213024755 16320 80.91.229.12 (9 Jun 2008 15:19:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 9 Jun 2008 15:19:15 +0000 (UTC) Cc: bug-cc-mode@gnu.org, Glenn Morris , bug-gnu-emacs@gnu.org, 347@emacsbugs.donarmstrong.com To: Alan Mackenzie Original-X-From: cc-mode-help-bounces@lists.sourceforge.net Mon Jun 09 17:19:56 2008 Return-path: Envelope-to: sf-cc-mode-help@m.gmane.org Original-Received: from lists-outbound.sourceforge.net ([66.35.250.225]) by lo.gmane.org with esmtp (Exim 4.50) id 1K5jA0-0001Vf-FH for sf-cc-mode-help@m.gmane.org; Mon, 09 Jun 2008 17:19:52 +0200 Original-Received: from sc8-sf-list1-new.sourceforge.net (sc8-sf-list1-new-b.sourceforge.net [10.3.1.93]) by sc8-sf-spam2.sourceforge.net (Postfix) with ESMTP id E36BCF59C; Mon, 9 Jun 2008 08:19:02 -0700 (PDT) Original-Received: from sc8-sf-mx2-b.sourceforge.net ([10.3.1.92] helo=mail.sourceforge.net) by sc8-sf-list1-new.sourceforge.net with esmtp (Exim 4.43) id 1K5j98-0001oI-Lk for cc-mode-help@lists.sourceforge.net; Mon, 09 Jun 2008 08:18:59 -0700 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by mail.sourceforge.net with esmtps (TLSv1:AES256-SHA:256) (Exim 4.44) id 1K5j96-0008Go-0c for cc-mode-help@lists.sourceforge.net; Mon, 09 Jun 2008 08:18:58 -0700 Original-Received: from mail.gnu.org ([199.232.76.166]:58076 helo=mx10.gnu.org) by fencepost.gnu.org with esmtp (Exim 4.67) (envelope-from ) id 1K5j74-0006Fa-Je for bug-cc-mode@gnu.org; Mon, 09 Jun 2008 11:16:50 -0400 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1K5j8u-0004mm-U2 for bug-cc-mode@gnu.org; Mon, 09 Jun 2008 11:18:49 -0400 X-Spam-Checker-Version: SpamAssassin 3.1.0 (2005-09-13) on monty-python X-Spam-Level: X-Spam-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.1.0 Original-Received: from mercure.iro.umontreal.ca ([132.204.24.67]:43070) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K5j8u-0004mg-IO; Mon, 09 Jun 2008 11:18:44 -0400 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 1D5C72CF94C; Mon, 9 Jun 2008 11:18:44 -0400 (EDT) Original-Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id 2D41A3FE0; Mon, 9 Jun 2008 11:18:29 -0400 (EDT) Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 0F29341BEC; Mon, 9 Jun 2008 11:18:29 -0400 (EDT) In-Reply-To: <20080609143651.GA6098@muc.de> (Alan Mackenzie's message of "Mon, 9 Jun 2008 14:36:51 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) X-Spam-Score: 0.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 X-BeenThere: cc-mode-help@lists.sourceforge.net X-Mailman-Version: 2.1.8 Precedence: list List-Id: "Bug reports, feature requests, and general talk about CC Mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: cc-mode-help-bounces@lists.sourceforge.net Errors-To: cc-mode-help-bounces@lists.sourceforge.net Xref: news.gmane.org gmane.emacs.cc-mode.general:5195 gmane.emacs.bugs:18303 Archived-At: >> > Yes. This needs fixing, somehow. >> >> > The way this happens is that in a C file's local variables list, there >> > are two "special" variables, e.g. `c-file-style'. >> >> > When >> >> > c-basic-offset: 11 >> > c-file-style: "k&r" >> >> > occurs in the local variable list, this triggers a hook function >> > which calls (c-set-style "k&r"). The hook is >> > hack-local-variables-hook. The problem is that this c-set-style call >> > will overwrite the explicit value for c-basic-offset. The explicit >> > value MUST take precedence here. >> Can you try and call `c-file-style' with some extra "don't override" >> (when called from that hack-local-variables-hook) argument so that any >> variable that already has a buffer-local binding will not be >> overridden? Any comment about this suggestion? >> > My solution was to call hack-local-variables a second time from >> > within the hook function, first having deleted any occurrences of >> > `mode', `c-file-style' etc. from the Local Variables. This kludge >> > worked reasonably well until the handling of >> > safe/dangerous-local-variables was changed for Emacs 22. >> How 'bout wrapping the call inside (let ((enable-local-variables >> :safe))? > I've been thinking this over. It's not the right solution. For a start, > the second call to `hack-local-variables' is in itself a kludge. I'd tend to agree, but "kludge" fixes the problem, it's still better than the current "same kludge + problem". > More importantly, the value ":safe" is non-portable (to earlier Emacsen, > or to the other one), Non-portability might indeed be a problem (tho, it's obviously "your" problem rather than mine), but introducing a new hook in Emacs-23 won't help you there, so it's not relevant to this discussion. > and doesn't feel at all safe. But I don't see why you don't consider it safe: it is really meant to be safe, so if there's any doubt about it, we should very much address it. > (defvar before-hack-local-variables-hook nil [...] > What do you think? I'm not thrilled. You might convince me at some point, but the kludge doesn't look nearly as bad when compared to this hook. Stefan ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php