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: [PATCH 2/2] Make font-lock honor parents mode of current major-mode Date: Wed, 09 Feb 2011 16:47:42 -0500 Message-ID: References: <1297190593-4585-1-git-send-email-julien@danjou.info> <1297190593-4585-2-git-send-email-julien@danjou.info> <87ei7hw2mk.fsf@keller.adm.naquadah.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1297288076 25567 80.91.229.12 (9 Feb 2011 21:47:56 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 9 Feb 2011 21:47:56 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Feb 09 22:47:53 2011 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.69) (envelope-from ) id 1PnHt9-00027I-S5 for ged-emacs-devel@m.gmane.org; Wed, 09 Feb 2011 22:47:52 +0100 Original-Received: from localhost ([127.0.0.1]:53484 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PnHtA-0002SI-JW for ged-emacs-devel@m.gmane.org; Wed, 09 Feb 2011 16:47:52 -0500 Original-Received: from [140.186.70.92] (port=41022 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PnHt3-0002Rg-E0 for emacs-devel@gnu.org; Wed, 09 Feb 2011 16:47:46 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PnHt1-0002B5-8t for emacs-devel@gnu.org; Wed, 09 Feb 2011 16:47:44 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:56846 helo=ironport2-out.pppoe.ca) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PnHt1-0002Au-55 for emacs-devel@gnu.org; Wed, 09 Feb 2011 16:47:43 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap4GAKqaUk1FxIyy/2dsb2JhbACXPY4cdLtnhVwEhH+PKQ X-IronPort-AV: E=Sophos;i="4.60,447,1291611600"; d="scan'208";a="91072360" Original-Received: from 69-196-140-178.dsl.teksavvy.com (HELO ceviche.home) ([69.196.140.178]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 09 Feb 2011 16:47:42 -0500 Original-Received: by ceviche.home (Postfix, from userid 20848) id 5E105660C9; Wed, 9 Feb 2011 16:47:42 -0500 (EST) In-Reply-To: <87ei7hw2mk.fsf@keller.adm.naquadah.org> (Julien Danjou's message of "Wed, 09 Feb 2011 18:15:31 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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:135820 Archived-At: >>> This allows to add font-lock keyword to prog-mode directly, so every other >>> children mode will use them. >> >> Making inheritance work with font-lock keywords is a good idea, but this >> is the wrong way to do it. The right way is to take advantage of the >> way inheritance works. E.g. use a variable which modes would >> *modify* rather than just set. E.g. somehow convince all modes to use >> the equivalent of font-lock-add-keywords. > I may not have enough knowledge of modes and font-lock to understand the > way you describe. Would you mind ellaboring a bit so I can maybe work on > that? :) If modes *add* keywords to `font-lock-new-keywords', then children of prog-mode will automatically inherit the prog-mode's keyword since variables set by the parent are carried to the child. So, I think we should change font-lock.el so that major modes setup font-lock keywords by adding them to a variable. For backward compatibility, the keywords listed in font-lock-defaults would be added, of course. Stefan