From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Re: POC: customizable cc-mode keywords Date: Sun, 18 May 2014 21:33:31 +0000 Message-ID: <20140518213331.GB2577@acm.acm> References: <53632C6F.5070903@dancol.org> <20140511211351.GC2759@acm.acm> <536FEA43.5090402@dancol.org> <20140516175226.GB3267@acm.acm> <537653A0.2070109@dancol.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1400449095 7058 80.91.229.3 (18 May 2014 21:38:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 18 May 2014 21:38:15 +0000 (UTC) Cc: Emacs developers To: Daniel Colascione Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun May 18 23:38:07 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Wm8mT-0006O4-UJ for ged-emacs-devel@m.gmane.org; Sun, 18 May 2014 23:38:06 +0200 Original-Received: from localhost ([::1]:44693 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wm8mT-0002Kf-B9 for ged-emacs-devel@m.gmane.org; Sun, 18 May 2014 17:38:05 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:59531) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wm8mK-0002Js-2O for emacs-devel@gnu.org; Sun, 18 May 2014 17:38:03 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Wm8mC-00038o-IN for emacs-devel@gnu.org; Sun, 18 May 2014 17:37:56 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:31996 helo=mail.muc.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Wm8mC-00038U-8F for emacs-devel@gnu.org; Sun, 18 May 2014 17:37:48 -0400 Original-Received: (qmail 78259 invoked by uid 3782); 18 May 2014 21:37:46 -0000 Original-Received: from acm.muc.de (pD95193C0.dip0.t-ipconnect.de [217.81.147.192]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 18 May 2014 23:37:45 +0200 Original-Received: (qmail 6880 invoked by uid 1000); 18 May 2014 21:33:31 -0000 Content-Disposition: inline In-Reply-To: <537653A0.2070109@dancol.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-detected-operating-system: by eggs.gnu.org: FreeBSD 8.x X-Received-From: 193.149.48.1 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:171928 Archived-At: Hello, Daniel. On Fri, May 16, 2014 at 11:06:24AM -0700, Daniel Colascione wrote: > On 05/16/2014 10:52 AM, Alan Mackenzie wrote: > >>>> Today, we use clever macros to hard-code the values of all cc-mode > >>>> language variables into the mode functions of each cc-mode major mode > >>>> function or into c-init-language-vars-for, but in order to allow users > >>>> to customize cc-mode syntax, we have to be able to recompute language > >>>> constants and variables at runtime. > >>> Do we, now? You can imagine I've one or two reservations about this > >>> idea. > >> What's your alternative? > > Turning the pertinent c-lang-defvars, and only these, into configurable > > variables in cc-vars.el. > Have you looked into what task actually involves? No I hadn't. > You need to modify c-decl-hangon-kwds, and as a result, > c-prefix-spec-kwds, c-postfix-spec-kwds, c-keywords, > c-keywords-regexp, c-keywords-obarray, c-nonlabel-token-key, and > c-regular-keywords-regexp. OK. Then another alternative is to use `or' forms in the appropriate places, of which there are several rather than many, the extra arm of the `or' looking something like "(looking-at c-noise-macro-re)". Did you consider this at all? If so, why do you prefer the solution you now propose? > It's easier and more flexible to simply allow the entire set of > c-lang-defconst values to change. It's the flexibility that worries me. Flexibility means complexity (of which there's already too much in CC Mode), and might open up a larger "attack surface" for future bugs. I've spent a lot of time trying to pin down exactly what your proposed change does and how it does it, but amn't there yet. I only have the before and after versions, not a detailed description of the change. > You also have to recompute the font-lock matchers, which is similarly > involved. Yes. > You claim that there is a great risk of negative side effects resulting > from this change. No. I've said there is a risk, without quantifying it. One question which you haven't addressed yet is does the changed code work properly on modes derived from a CC Mode mode? How easy is it to create a `foo-extra-keywords' for such a mode? Another is does the change work properly under XEmacs? What is the purpose of {java,idl,pike}-extra-keywords, given that these three languages don't have #defines? > I don't agree, and I don't see anyone else proposing, much less > implementing, a solution to this problem, ..... :-) This problem was first highlighted as such, by you, this month, not several years ago. Your patch is complicated, it's disruptive, yet you seem put out that I want to discuss it and understand it, rather than just blindly applying it as it is. It seems your use of "You need to" and "we have to" weren't mere hyperbole as I first thought. Forgive me, but I'm always suspicious when somebody tells me "there's no alternative". There are always alternatives. The question is why is your patch, which is not a straightforward or obvious change, the best solution to the problem. What are the tradeoffs? > .... and cc-mode's being developed outside the tree makes it > frustratingly slow and difficult to get much-needed fixes into core > where users can see them. Would it really be much faster if CC Mode were integrated? Not really. What makes things slow is the small number of people working on CC Mode, i.e. one, with occasional help from people like yourself. > > As I said, I'm not at all happy at making such a massive change to CC > > Mode's architecture. There would surely be unforeseen consequences, some > > of which might well be negative. > It's not a massive change in architecture. As I said, I don't fully understand the change, yet. But moving calculations from compile time to run time _is_ a change of architecture, and it seems to me not to be small. It seems to me that the rigid separation between language (e.g. C) and user configuration is being broken down. How much easier will it be for a user mistakenly to attempt to configure her CC Mode by messing around with the c-lang-consts? > cc-mode can already evaluate these variables at runtime in the case of > a version mismatch. That's a feature intended purely for CC Mode developers. > I propose simply doing so all the time. My timing indicates that it's > not a performance problem in practice. -- Alan Mackenzie (Nuremberg, Germany).