From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: master 79d9f3982f: Add derived-mode test for bug#24176 Date: Mon, 24 Jan 2022 09:53:49 -0500 Message-ID: References: <164303371205.13369.5637099354011397679@vcs2.savannah.gnu.org> <20220124141512.66398C0DA30@vcs2.savannah.gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26092"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: Lars Ingebrigtsen To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Mon Jan 24 15:55:07 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nC0kM-0006XD-HK for ged-emacs-devel@m.gmane-mx.org; Mon, 24 Jan 2022 15:55:06 +0100 Original-Received: from localhost ([::1]:51112 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nC0kL-0004Xp-Dx for ged-emacs-devel@m.gmane-mx.org; Mon, 24 Jan 2022 09:55:05 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:50440) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nC0jL-0003cR-5O for emacs-devel@gnu.org; Mon, 24 Jan 2022 09:54:03 -0500 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:14219) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nC0jH-0002R2-Ue for emacs-devel@gnu.org; Mon, 24 Jan 2022 09:54:02 -0500 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 8830010018A; Mon, 24 Jan 2022 09:53:52 -0500 (EST) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 5E91A100134; Mon, 24 Jan 2022 09:53:50 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1643036030; bh=3aQrtXPsRdM4xTq2JV21jtpE7S+1swi7wxafRQK5Sv8=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=cwnUNxbK5jTREFfw3NeZjFqd3gkHzdScpdooTE7+Yb/6Ef+O+V4rJXtdqASkqVmE5 WGiFozeYY/pul7Ld9RVlC7e/mUPntcXJaazchW9IP466wY1Yn/RM754v9KLqBca1je PFf6Q7FxaGpFh2N6A7XvzSsyihQUmhPggPErSw9AjqsdIfpp9Mi6Zj9G7ShCepe5ec UKdo6YIaH0kCbxTtBVC9FiVvsGZ8Bwwf62w+OoQzMo9DkjgXNu7f71PFvAAz/Vy6qN MiraO0hGxaSPH4TrhMkaJormz2sosHwVu/du4a4eiZSZ36zyak83PAKHwuaA2UlRng lPYdBPeQJHXzQ== Original-Received: from pastel (unknown [216.154.30.173]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id EF98E1207DA; Mon, 24 Jan 2022 09:53:49 -0500 (EST) In-Reply-To: <20220124141512.66398C0DA30@vcs2.savannah.gnu.org> (Lars Ingebrigtsen's message of "Mon, 24 Jan 2022 09:15:12 -0500 (EST)") Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:285312 Archived-At: > +(ert-deftest test-add-font-lock () > + (define-derived-mode mode-a fundamental-mode "mode-a" > + (font-lock-add-keywords nil `(("a" 0 'font-lock-keyword-face)))) > + (define-derived-mode mode-b mode-a "mode-b" > + (font-lock-add-keywords nil `(("b" 0 'font-lock-builtin-face)))) > + (define-derived-mode mode-c mode-b "mode-c" > + (font-lock-add-keywords nil `(("c" 0 'font-lock-constant-face)))) > + > + (with-temp-buffer > + (mode-c) > + (should (equal font-lock-keywords > + '(t (("c" 0 'font-lock-constant-face) > + ("b" 0 'font-lock-builtin-face) > + ("a" 0 'font-lock-keyword-face)) > + ("c" (0 'font-lock-constant-face)) > + ("b" (0 'font-lock-builtin-face)) > + ("a" (0 'font-lock-keyword-face))))))) An interesting other case is: (defvar mode-a-flk '(("a" 0 'font-lock-keyword-face))) (define-derived-mode mode-a fundamental-mode "mode-a" (setq-local font-lock-defaults '(mode-a-flk))) (define-derived-mode mode-b mode-a "mode-b" (font-lock-add-keywords nil `(("b" 0 'font-lock-builtin-face)))) (defvar mode-c-flk '(("c" 0 'font-lock-keyword-face))) (define-derived-mode mode-c mode-b "mode-c" (setq-local font-lock-defaults '(mode-c-flk))) -- Stefan