From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Nix Newsgroups: gmane.emacs.devel Subject: Re: [RFC PATCH] setting indentation styles via `c-file-style' fails to actually change indentation Date: Fri, 05 Aug 2011 15:14:36 +0100 Message-ID: <87pqkkndwz.fsf@spindle.srvr.nix> References: <87pqngewwp.fsf@spindle.srvr.nix> <87wrh5tyh7.fsf@spindle.srvr.nix> <20110602122412.GA2448@acm.acm> <87fwnstc2z.fsf@spindle.srvr.nix> <20110602211529.GA4904@acm.acm> <87fwnrsydx.fsf@spindle.srvr.nix> <20110605150624.GA3740@acm.acm> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1312553702 28580 80.91.229.12 (5 Aug 2011 14:15:02 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 5 Aug 2011 14:15:02 +0000 (UTC) Cc: Stefan Monnier , emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Aug 05 16:14:54 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QpLAp-00050v-G0 for ged-emacs-devel@m.gmane.org; Fri, 05 Aug 2011 16:14:51 +0200 Original-Received: from localhost ([::1]:40768 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QpLAp-0003Or-04 for ged-emacs-devel@m.gmane.org; Fri, 05 Aug 2011 10:14:51 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:53968) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QpLAm-0003OZ-0H for emacs-devel@gnu.org; Fri, 05 Aug 2011 10:14:49 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QpLAk-0007Bh-Pt for emacs-devel@gnu.org; Fri, 05 Aug 2011 10:14:47 -0400 Original-Received: from icebox.esperi.org.uk ([81.187.191.129]:58416 helo=mail.esperi.org.uk) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QpLAk-0007B2-DH for emacs-devel@gnu.org; Fri, 05 Aug 2011 10:14:46 -0400 Original-Received: from esperi.org.uk (nix@spindle.srvr.nix [192.168.14.15]) by mail.esperi.org.uk (8.14.4/8.14.3) with ESMTP id p75EEc55009330; Fri, 5 Aug 2011 15:14:38 +0100 Original-Received: (from nix@localhost) by esperi.org.uk (8.14.4/8.12.11/Submit) id p75EEaDI019358; Fri, 5 Aug 2011 15:14:36 +0100 Emacs: a Lisp interpreter masquerading as ... a Lisp interpreter! In-Reply-To: <20110605150624.GA3740@acm.acm> (Alan Mackenzie's message of "Sun, 5 Jun 2011 15:06:24 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-DCC-URT-Metrics: spindle 1060; Body=3 Fuz1=3 Fuz2=3 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 81.187.191.129 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:142901 Archived-At: On 5 Jun 2011, Alan Mackenzie said: > Hi, Nix. > > On Thu, Jun 02, 2011 at 10:43:06PM +0100, Nix wrote: >> On 2 Jun 2011, Alan Mackenzie stated: > >> > On Thu, Jun 02, 2011 at 05:47:16PM +0100, Nix wrote: >> >> On 2 Jun 2011, Alan Mackenzie told this: > >> >> and have a patch, which works for me, at least... but it's rather ugly, >> >> so if there is a better way which would still allow setting of styles on >> >> file-by-file and directory-(class)-by-directory-(class) basis, then I'm >> >> glad to try that instead! > > OK. Would you please try this patch and let me know how it works. It's > a bit less ugly than your one (-: Sorry for the insane delay, a big system update meant that restarting Emacs was inadvisable for a few weeks until I'd crushed some (non-Emacs) bugs. Thankfully there were no power cuts in this period :) Your fix (in the form you committed it, since I delayed so long) seems to work, though despite a lot of looking at it I'm not quite sure how! God knows it's less grotesque than the 'pile things in then filter them out again' approach I was employing. >> Then it gets called again in `c-before-hack-hook' with dont-override >> set to 't' iff the only c-file-style was in the directory local >> variable. (The rationale for this remains opaque to me, but since the >> underlying bug in my case was in the first part I didn't investigate >> that bit too closely. The style doesn't end up set to the directory- >> local style: it ends up set to the default!) > > It was an attempt to prevent .dir-local variables from overriding more > specifically set variables (e.g. set in a hook function). It didn't work > very well. :-( Yeah. There are arguments on both sides for whether hook functions should override dir-local (and for that matter file-local) variables. I'm not sure which way the priorities should run, but I'm fairly sure it should be consistent for all of Emacs, not just cc-mode, which implies that we need some sort of helper that everyone can call to disambiguate these cases. > 2. Be VERY wary about sending "streams of consciousness"; they can > sometimes be difficult to make sense of. Reading them the morning after > can be helpful. Yeah, sorry about that. It wasn't actually a stream of consciousness: it was a victim of repeated over-editing for 'clarity' (for which read incomprehensibility). > 3. Don't assume the grizzled senile maintainer can simply follow a patch; > explain it! Often the bug submitter, having just spent several hours on > it, knows the piece of code better than the maintainer. OK. I've been castigated for over-explaining patches on other lists, and even for commenting code: nice to know this list is a 'please explain yourself' list, I much prefer that. > 4. In Emacs, the standard diff format is contextual (-c), but unified > (-u) is OK too. I still don't understand how anyone can read context diffs. :) but then other poeple find unified diffs impossible to read as well. Obviously we should use the UK government standard format and send things around as PDF files with the old text blacked out by inserting a black box above it. ;} > So, let me know if the patch works, then we can close this bug. It works! -- NULL && (void)