From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: bug#347: C mode asks twice about local variables Date: Wed, 11 Jun 2008 10:41:38 -0400 Message-ID: References: <20080601172143.GA5899@muc.de> <20080609143651.GA6098@muc.de> <20080609190750.GC6098@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1213195323 18373 80.91.229.12 (11 Jun 2008 14:42:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 11 Jun 2008 14:42:03 +0000 (UTC) Cc: emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jun 11 16:42:46 2008 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.50) id 1K6RXB-00007U-6c for ged-emacs-devel@m.gmane.org; Wed, 11 Jun 2008 16:42:45 +0200 Original-Received: from localhost ([127.0.0.1]:50457 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K6RWN-0002li-QS for ged-emacs-devel@m.gmane.org; Wed, 11 Jun 2008 10:41:55 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1K6RWK-0002lM-BG for emacs-devel@gnu.org; Wed, 11 Jun 2008 10:41:52 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1K6RWI-0002lA-PU for emacs-devel@gnu.org; Wed, 11 Jun 2008 10:41:51 -0400 Original-Received: from [199.232.76.173] (port=40041 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1K6RWI-0002l7-Ks for emacs-devel@gnu.org; Wed, 11 Jun 2008 10:41:50 -0400 Original-Received: from mercure.iro.umontreal.ca ([132.204.24.67]:55922) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1K6RWI-0003I6-96 for emacs-devel@gnu.org; Wed, 11 Jun 2008 10:41:50 -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 B15CE2CFDD1; Wed, 11 Jun 2008 10:41:49 -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 A1D983FE0; Wed, 11 Jun 2008 10:41:38 -0400 (EDT) Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 84B2C41BEC; Wed, 11 Jun 2008 10:41:38 -0400 (EDT) In-Reply-To: <20080609190750.GC6098@muc.de> (Alan Mackenzie's message of "Mon, 9 Jun 2008 19:07:50 +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-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:98956 Archived-At: [ Moving this over to emacs-devel. ] >> >> 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? > YUCK!!! ;-) > I don't know off-hand what the significance of buffer locality is in CC > Mode styles. Could you ask the CC mode maintainer, maybe? > But trying to get a "don't override" parameter to work > would be horrendous. hack-local-variables is actually called after the > language hook, isn't it? By that time, the CC Mode style will already > have been set, and the pertinent variables will already be buffer local. > At least I think so. I see, yes, it might be messy or even impossible. >> 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. > What I had in mind was using an (if (boundp 'before-hack-local-variables) > ...) to separate out new strategy from old. I'm sure we can come up with a good test to decide whether :safe will do the right thing. > Oh, and the hook would need documenting in the Elisp manual, but I can > manage that. > Hey, this is so easy and obviously the right thing. Let's do it! It's going in the right direction but I'm still not completely satisfied. How 'bout something like the following: Some variables can be flagged as being special, in that when they apper in the file-local list of settings, they "get set" by calling a function. E.g. `mode' is globally special and "setting it" will actually call the corresponding mode. Then `c-mode' can define `c-file-style' and `c-file-offsets' as being special so that setting them actually calls a function of yours (probably a function that could also be used for the :set in defcustom, BTW). Of course, the interesting bit is that hack-local-variables will be careful to reorder the file-local settings such that special variables are set first. Stefan