From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Matthew Carter Newsgroups: gmane.emacs.devel Subject: Re: cc-mode: Make all parameters introduced in Emacs 26 optional Date: Sat, 03 Feb 2018 00:59:38 -0500 Organization: Ahungry (http://ahungry.com) Message-ID: <87k1vuwr3p.fsf@ahungry.com> References: <1516608561.1943450.1243462056.1A47A60F@webmail.messagingengine.com> <20180122203254.GA4888@ACM> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1517637183 17161 195.159.176.226 (3 Feb 2018 05:53:03 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 3 Feb 2018 05:53:03 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) Cc: jostein@kjonigsen.net, emacs-devel@gnu.org To: Alan Mackenzie Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Feb 03 06:52:58 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ehqkt-0003jJ-JZ for ged-emacs-devel@m.gmane.org; Sat, 03 Feb 2018 06:52:51 +0100 Original-Received: from localhost ([::1]:52830 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehqmu-0007zE-FF for ged-emacs-devel@m.gmane.org; Sat, 03 Feb 2018 00:54:56 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:39014) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehqmF-0007z4-P0 for emacs-devel@gnu.org; Sat, 03 Feb 2018 00:54:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ehqmC-00070V-L9 for emacs-devel@gnu.org; Sat, 03 Feb 2018 00:54:15 -0500 Original-Received: from li130-200.members.linode.com ([69.164.215.200]:36082 helo=mail.ahungry.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ehqmC-00070K-Gq for emacs-devel@gnu.org; Sat, 03 Feb 2018 00:54:12 -0500 Original-Received: from localhost (ahungry.com [127.0.0.1]) by mail.ahungry.com (Postfix) with ESMTP id 1C9534171; Sat, 3 Feb 2018 00:54:11 -0500 (EST) X-Virus-Scanned: amavisd-new at ahungry.com Original-Received: from mail.ahungry.com ([127.0.0.1]) by localhost (mail.ahungry.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id aS0-daGGlmLK; Sat, 3 Feb 2018 00:54:07 -0500 (EST) Original-Received: from archPad (99-40-9-245.lightspeed.livnmi.sbcglobal.net [99.40.9.245]) by mail.ahungry.com (Postfix) with ESMTPSA id 3577540FA; Sat, 3 Feb 2018 00:54:07 -0500 (EST) In-Reply-To: <20180122203254.GA4888@ACM> (Alan Mackenzie's message of "Mon, 22 Jan 2018 20:32:54 +0000") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 69.164.215.200 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:222458 Archived-At: Alan Mackenzie writes: > Hello, Jostein. > > On Mon, Jan 22, 2018 at 09:09:21 +0100, Jostein Kj=C3=B8nigsen wrote: >> Hey everyone. > >> While cc-mode seems to be a foundation for lots of the major-modes >> shipped with Emacs, it's also used by third-party packages. >> For major-modes shipped with Emacs, changes to the core cc-mode >> functions is not that big of a problem, since they can be changed in >> tandem with the changes to cc-mode itself. > >> For third party modules (like csharp-mode, which I maintain), changes to >> cc-mode core-functions are more problematic due to Emacs lacking >> reliable introspection capabilities. > > There's a convention in CC Mode that functions, macros, and variables > with a doc string are regarded as part of an "API" to derived modes, but > objects with merely a "doc comment" are regarded as internal to CC Mode, > and _much_ less secure against random changes. > >> As an example in the Emacs 26 branch c-font-lock-declarators is now >> declared like this: >> (defun c-font-lock-declarators (limit list types not-top &optional templ= ate- >> class) ...) >> While in Emacs 25.3 and earlier it's declared like this: > >> (defun c-font-lock-declarators (limit list types) >> ...) > >> Basically the number of mandatory parameters has been bumped from 3 to >> 4, with another optional parameter added. > > c-font-lock-declarators is one of these functions intended to be > "internal". If a derived mode like csharp-mode is using it directly, > one of the following is true: > (i) There's a need for functionality which is currently lacking in CC > Mode. > (ii) The maintainer of the derived mode is unaware of existing CC Mode > functionality which would satisfy his need. > (iii) ??? > >> These kinds of changes makes it harder for third party modules to >> maintain compatibility across Emacs-versions. > > Why is csharp-mode using c-font-lock-declarators at all? Could it be > you're wanting to do something which currently can't be done with the > "API" functions/macros/variables? If so, it might well be better to > amend CC Mode to provide this functionality. > >> Wouldn't it be better to make *all *the new parameters optional and thus >> maintain compatibility? Are there any good reasons not to do so? > > Well, to work properly, the caller of c-font-lock-declarators will need > to determine the `not-top' argument rather than just relying on a > randomish default. The meaning of the function has changed. `not-top' > doesn't seem suitable for being &optional. > > Again, why is csharp-mode using this function? Are there any other > "internal" functions/macros/variables it is using? > >> -- >> Regards >> Jostein Kj=C3=B8nigsen > >> jostein@kjonigsen.net =F0=9F=8D=B5 jostein@gmail.com >> https://jostein.kjonigsen.net Somewhat on this subject - recent versions of Emacs have seemed to have changed single quotes with text between the quotes with a length greater than 1 to use a warn font face on the quotes, instead of the font string face (likely because in C the single quote denotes a char, but in many of the derived modes that cc-mode mentions in it's own comment set (php-mode, dart-mode etc.), a single quoted string and double quoted string are used interchangeably). Does cc-mode have a setting to correct this and restore the old behavior? --=20 Matthew Carter (m@ahungry.com) http://ahungry.com