GNU bug report logs - #24176
Confusing interaction between define-derived-mode and font-lock-add-keywords

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Severity: minor; Reported by: Clément Pit--Claudel <clement.pitclaudel@HIDDEN>; Keywords: confirmed; dated Sun, 7 Aug 2016 06:42:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 24176 <at> debbugs.gnu.org:


Received: (at 24176) by debbugs.gnu.org; 17 Nov 2019 18:55:59 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 17 13:55:59 2019
Received: from localhost ([127.0.0.1]:42637 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iWPiJ-00057d-G5
	for submit <at> debbugs.gnu.org; Sun, 17 Nov 2019 13:55:59 -0500
Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:35485)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <monnier@HIDDEN>) id 1iWPiH-00057P-L9
 for 24176 <at> debbugs.gnu.org; Sun, 17 Nov 2019 13:55:58 -0500
Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id EF0561004B3;
 Sun, 17 Nov 2019 13:55:51 -0500 (EST)
Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1])
 by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id B5A9C1003EC;
 Sun, 17 Nov 2019 13:55:50 -0500 (EST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca;
 s=mail; t=1574016950;
 bh=bjX2T3++xmdiS+mOQM7Psk+4HK41DUyFylr3Zsgxr04=;
 h=From:To:Cc:Subject:References:Date:In-Reply-To:From;
 b=XwfbNHpl9DdTDTuxGuv2d+6pSDULNTid4oXctz7dwI8UXSyrUpWTp2hYIJr+H/dZP
 Q11spPkyNknawbz9kWx45j3SfSSmW6WrcMLC1i7elfBLAfpRJphACEzSA0hT/HHHx7
 accNxehs+pphNDyzhClA4b2vFeRqk2bXfvT3J96tXRynvvFi5w+d9Gt8FS82g+xNUE
 7O8Weo3WmluTU4WuZbTYF2fIl0JIKVBFPr79RBSuCU3N9y03diSqgcof9kVT4r5A3u
 YVhXSO8McR6+XNepRCIECYT472/rbpN0hsnSOjmbELAU/P+SzF73lPrc2kqD18PPH/
 M1r/geq6bzYMg==
Received: from alfajor (unknown [216.154.18.30])
 by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 663AC120B1A;
 Sun, 17 Nov 2019 13:55:50 -0500 (EST)
From: Stefan Monnier <monnier@HIDDEN>
To: Lars Ingebrigtsen <larsi@HIDDEN>
Subject: Re: bug#24176: Confusing interaction between define-derived-mode
 and font-lock-add-keywords
Message-ID: <jwvo8xabaey.fsf-monnier+emacs@HIDDEN>
References: <1b9e5891-9843-a9d7-c29f-7b9544a72a12@HIDDEN>
 <handler.24176.B.14705521086608.ack <at> debbugs.gnu.org>
 <0a87c159-8bd5-3fda-0b03-d1426e6a26d0@HIDDEN>
 <87k2f5u0sk.fsf_-_@HIDDEN> <87eey7dm3a.fsf@HIDDEN>
Date: Sun, 17 Nov 2019 13:55:49 -0500
In-Reply-To: <87eey7dm3a.fsf@HIDDEN> (Lars Ingebrigtsen's message of "Sun,
 17 Nov 2019 07:59:53 +0100")
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain
X-SPAM-INFO: Spam detection results:  0
 ALL_TRUSTED                -1 Passed through trusted hosts only via SMTP
 AWL -0.080 Adjusted score from AWL reputation of From: address
 BAYES_00                 -1.9 Bayes spam probability is 0 to 1%
 DKIM_SIGNED               0.1 Message has a DKIM or DK signature,
 not necessarily valid
 DKIM_VALID -0.1 Message has at least one valid DKIM or DK signature
 DKIM_VALID_AU -0.1 Message has a valid DKIM or DK signature from author's
 domain
X-SPAM-LEVEL: 
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 24176
Cc: =?windows-1252?Q?Cl=E9ment?= Pit--Claudel <clement.pitclaudel@HIDDEN>,
 24176 <at> debbugs.gnu.org, npostavs@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Stefan, is this working as designed?

Not really, no.  The design didn't take this into account at least.

> If so, the behaviour should perhaps be mentioned in the doc for
> font-lock-add-keywords and/or define-derived-mode?

I think it'd be better to fix it ;-)


        Stefan





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#24176; Package emacs. Full text available.

Message received at 24176 <at> debbugs.gnu.org:


Received: (at 24176) by debbugs.gnu.org; 17 Nov 2019 07:00:07 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Nov 17 02:00:07 2019
Received: from localhost ([127.0.0.1]:40065 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1iWEXW-0000UN-CN
	for submit <at> debbugs.gnu.org; Sun, 17 Nov 2019 02:00:06 -0500
Received: from quimby.gnus.org ([95.216.78.240]:43312)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <larsi@HIDDEN>) id 1iWEXT-0000RO-Ds
 for 24176 <at> debbugs.gnu.org; Sun, 17 Nov 2019 02:00:04 -0500
Received: from cm-84.212.202.86.getinternet.no ([84.212.202.86] helo=marnie)
 by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.92) (envelope-from <larsi@HIDDEN>)
 id 1iWEXK-0004Gs-KX; Sun, 17 Nov 2019 07:59:57 +0100
From: Lars Ingebrigtsen <larsi@HIDDEN>
To: npostavs@HIDDEN
Subject: Re: bug#24176: Confusing interaction between define-derived-mode
 and font-lock-add-keywords
References: <1b9e5891-9843-a9d7-c29f-7b9544a72a12@HIDDEN>
 <handler.24176.B.14705521086608.ack <at> debbugs.gnu.org>
 <0a87c159-8bd5-3fda-0b03-d1426e6a26d0@HIDDEN>
 <87k2f5u0sk.fsf_-_@HIDDEN>
Date: Sun, 17 Nov 2019 07:59:53 +0100
In-Reply-To: <87k2f5u0sk.fsf_-_@HIDDEN>
 (npostavs@HIDDEN's message of "Wed, 24 Aug 2016
 20:53:15 -0400")
Message-ID: <87eey7dm3a.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org",
 has NOT identified this incoming email as spam.  The original
 message has been attached to this so you can view it or label
 similar future email.  If you have any questions, see
 @@CONTACT_ADDRESS@@ for details.
 
 Content preview:  npostavs@HIDDEN writes: > Clément Pit--Claudel
    <clement.pitclaudel@HIDDEN> writes: > >> Sorry, the original report had
    a confusing example; here is a fixed copy. >> >> (define-derived-mode ~/a
    fundamental-mode "~/a" >> (f [...] 
 
 Content analysis details:   (-2.9 points, 5.0 required)
 
  pts rule name              description
 ---- ---------------------- --------------------------------------------------
  0.0 URIBL_BLOCKED          ADMINISTRATOR NOTICE: The query to URIBL was
                             blocked.  See
                             http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block
                              for more information.
                             [URIs: live.com]
 -1.0 ALL_TRUSTED            Passed through trusted hosts only via SMTP
 -1.9 BAYES_00               BODY: Bayes spam probability is 0 to 1%
                             [score: 0.0000]
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 24176
Cc: =?utf-8?Q?Cl=C3=A9ment?= Pit--Claudel <clement.pitclaudel@HIDDEN>,
 Stefan Monnier <monnier@HIDDEN>, 24176 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

npostavs@HIDDEN writes:

> Cl=C3=A9ment Pit--Claudel <clement.pitclaudel@HIDDEN> writes:
>
>> Sorry, the original report had a confusing example; here is a fixed copy.
>>
>> (define-derived-mode ~/a fundamental-mode "~/a"
>>   (font-lock-add-keywords nil `(("a" 0 'font-lock-keyword-face))))
>> (define-derived-mode ~/b ~/a "~/b"
>>   (font-lock-add-keywords nil `(("b" 0 'font-lock-builtin-face))))
>> (define-derived-mode ~/c ~/b "~/c"
>>   (font-lock-add-keywords nil `(("c" 0 'font-lock-constant-face))))
>>
>> Explicitly calling (setq font-lock-major-mode major-mode) before
>> calling font-lock-add-keywords yields the expected behaviour.
>
> Yeah, it seems `font-lock-set-defaults' (called from
> `font-lock-add-keywords') deletes the parent mode's added keywords since
> they were not from the "correct" mode.
>
>     (defun font-lock-set-defaults ()
>       "Set fontification defaults appropriately for this mode.
>     Sets various variables using `font-lock-defaults' and
>     `font-lock-maximum-decoration'."
>       ;; Set fontification defaults if not previously set for correct maj=
or mode.
>       (unless (and font-lock-set-defaults
>                (eq font-lock-major-mode major-mode))
>         (setq font-lock-major-mode major-mode)
>         (setq font-lock-set-defaults t)
>         ...

Stefan, is this working as designed?  If so, the behaviour should
perhaps be mentioned in the doc for font-lock-add-keywords and/or
define-derived-mode?

--=20
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#24176; Package emacs. Full text available.
bug Marked as found in versions 25.1. Request was from npostavs@HIDDEN to control <at> debbugs.gnu.org. Full text available.
Added tag(s) confirmed. Request was from npostavs@HIDDEN to control <at> debbugs.gnu.org. Full text available.
Severity set to 'minor' from 'normal' Request was from npostavs@HIDDEN to control <at> debbugs.gnu.org. Full text available.

Message received at 24176 <at> debbugs.gnu.org:


Received: (at 24176) by debbugs.gnu.org; 25 Aug 2016 00:53:10 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 24 20:53:10 2016
Received: from localhost ([127.0.0.1]:39518 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bciur-0004x4-QR
	for submit <at> debbugs.gnu.org; Wed, 24 Aug 2016 20:53:09 -0400
Received: from mail-it0-f42.google.com ([209.85.214.42]:37860)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <npostavs@HIDDEN>)
 id 1bciun-0004wJ-BC; Wed, 24 Aug 2016 20:53:05 -0400
Received: by mail-it0-f42.google.com with SMTP id f6so65045783ith.0;
 Wed, 24 Aug 2016 17:53:05 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113;
 h=sender:from:to:cc:subject:references:date:in-reply-to:message-id
 :user-agent:mime-version:content-transfer-encoding;
 bh=4/QV4PGKj7MIwEJNkL2WzOfuNaLfQsQR2CTkJPfEzsA=;
 b=kTik9ySuE6dygUQqYT8xrsJFyQug28OKunZLOEQlMfUDcKF5lpBkgdie3i8ZSGtMzj
 vVj4Ac53VqeYIYRVitXqjF4PR+j6sP4FFwzklB/JO+jdy0U2nyT7JNTqcmeXPngO5OPF
 bdl7tn6wTyMZRmNJS4s9NTINhfWzl8riZ4Kry+sC/DcV9z6QbdQPupdSalaaCy5JTXfr
 1GdVadL+2vBQPMRsgsbwl0XOAJhMAZVt4w22783jM1FXwxZexXDPEhWZucnj1pSKfyVK
 KeewTO0LJ0rdkjtg4km5NJDfKpcZXCdvKowrmyeH/+ixxQ4fpdqawWNoGlHsQCyPONTz
 MHdQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:sender:from:to:cc:subject:references:date
 :in-reply-to:message-id:user-agent:mime-version
 :content-transfer-encoding;
 bh=4/QV4PGKj7MIwEJNkL2WzOfuNaLfQsQR2CTkJPfEzsA=;
 b=HABxpCpxJ0XZSo24JCt/K8IeFPuAy1Q1kuyb27EpYWncYpvBTV/cG7x/fYgIPESl/3
 wYoJYJBG/v7ocESH4n0sfMAXnhR0xH4aYJ0cxvXvRhBIQJbpSd+LNToDLTn2O7nwv2MV
 k4QyHcC1XSVVc59B+Rj25GZG7yK9EDcA8siWLy2RywBw3IIH+qd0E3Si4jsRLgkQxf2f
 AbgxjH+QsbxgtUMYTrFTrIrRN56z+wclZfoz0Sn/719lWRiZEvtgbsohTAzmw9dkDRNL
 oBcmUek70SkFnrJq9jKQMGNeWJGM4r97FX6QIHvcgyxSCBRVaWauyovLZdrD9MjYRNqx
 HvLw==
X-Gm-Message-State: AEkoouuPWCXchYoO/K2p6t9t3CfM4M2Srhq+m6hOwu8x2H0DmmttvAZEahNdrCrlpYhMFA==
X-Received: by 10.107.165.67 with SMTP id o64mr6999451ioe.151.1472086379729;
 Wed, 24 Aug 2016 17:52:59 -0700 (PDT)
Received: from zony ([45.2.7.130])
 by smtp.googlemail.com with ESMTPSA id j129sm12681920itj.5.2016.08.24.17.52.58
 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256);
 Wed, 24 Aug 2016 17:52:59 -0700 (PDT)
From: npostavs@HIDDEN
To: =?utf-8?Q?Cl=C3=A9ment?= Pit--Claudel <clement.pitclaudel@HIDDEN>
Subject: Re: bug#24176: Confusing interaction between define-derived-mode and
 font-lock-add-keywords
References: <1b9e5891-9843-a9d7-c29f-7b9544a72a12@HIDDEN>
 <handler.24176.B.14705521086608.ack <at> debbugs.gnu.org>
 <0a87c159-8bd5-3fda-0b03-d1426e6a26d0@HIDDEN>
Date: Wed, 24 Aug 2016 20:53:15 -0400
In-Reply-To: <0a87c159-8bd5-3fda-0b03-d1426e6a26d0@HIDDEN>
 (=?utf-8?Q?=22Cl=C3=A9ment?=
 Pit--Claudel"'s message of "Sun, 7 Aug 2016 02:57:19 -0400")
Message-ID: <87k2f5u0sk.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux)
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-Spam-Score: -0.7 (/)
X-Debbugs-Envelope-To: 24176
Cc: 24176 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -0.7 (/)

severity 24176 minor
tags 24176 confirmed
found 24176 25.1
quit

Cl=C3=A9ment Pit--Claudel <clement.pitclaudel@HIDDEN> writes:

> Sorry, the original report had a confusing example; here is a fixed copy.
>
> (define-derived-mode ~/a fundamental-mode "~/a"
>   (font-lock-add-keywords nil `(("a" 0 'font-lock-keyword-face))))
> (define-derived-mode ~/b ~/a "~/b"
>   (font-lock-add-keywords nil `(("b" 0 'font-lock-builtin-face))))
> (define-derived-mode ~/c ~/b "~/c"
>   (font-lock-add-keywords nil `(("c" 0 'font-lock-constant-face))))
>
> Explicitly calling (setq font-lock-major-mode major-mode) before calling =
font-lock-add-keywords yields the expected behaviour.

Yeah, it seems `font-lock-set-defaults' (called from
`font-lock-add-keywords') deletes the parent mode's added keywords since
they were not from the "correct" mode.


    (defun font-lock-set-defaults ()
      "Set fontification defaults appropriately for this mode.
    Sets various variables using `font-lock-defaults' and
    `font-lock-maximum-decoration'."
      ;; Set fontification defaults if not previously set for correct major=
 mode.
      (unless (and font-lock-set-defaults
               (eq font-lock-major-mode major-mode))
        (setq font-lock-major-mode major-mode)
        (setq font-lock-set-defaults t)
        ...




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#24176; Package emacs. Full text available.

Message received at 24176 <at> debbugs.gnu.org:


Received: (at 24176) by debbugs.gnu.org; 7 Aug 2016 06:57:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 07 02:57:36 2016
Received: from localhost ([127.0.0.1]:58324 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bWI1f-00024I-Sd
	for submit <at> debbugs.gnu.org; Sun, 07 Aug 2016 02:57:36 -0400
Received: from mout.kundenserver.de ([212.227.17.13]:53158)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <clement.pitclaudel@HIDDEN>) id 1bWI1e-000244-HL
 for 24176 <at> debbugs.gnu.org; Sun, 07 Aug 2016 02:57:35 -0400
Received: from [18.189.62.146] ([18.189.62.146]) by mrelayeu.kundenserver.de
 (mreue104) with ESMTPSA (Nemesis) id 0MJkO4-1bVC5r3TyW-0017fD for
 <24176 <at> debbugs.gnu.org>; Sun, 07 Aug 2016 08:57:28 +0200
Subject: Re: bug#24176: Acknowledgement (Confusing interaction between
 define-derived-mode and font-lock-add-keywords)
To: 24176 <at> debbugs.gnu.org
References: <1b9e5891-9843-a9d7-c29f-7b9544a72a12@HIDDEN>
 <handler.24176.B.14705521086608.ack <at> debbugs.gnu.org>
From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= <clement.pitclaudel@HIDDEN>
Message-ID: <0a87c159-8bd5-3fda-0b03-d1426e6a26d0@HIDDEN>
Date: Sun, 7 Aug 2016 02:57:19 -0400
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.2.0
MIME-Version: 1.0
In-Reply-To: <handler.24176.B.14705521086608.ack <at> debbugs.gnu.org>
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="93LF6nMOhpXGhhMR2DIUiqSTvHfbapkqN"
X-Provags-ID: V03:K0:gIRzCvd6ovug7oOmjEvQYAIgmC5t/vh8BaEERPm4+Yaf4dhGn64
 0ei3gZWWQHx1JDUUZ4LIJkU7LSUkCxW0UvI+ASDbzfbPj7RjS8AbyKc6vTCS2J9VRyUvS1d
 vp+H7lQa0Pb4dzRpZ3z1tK/CAop0snhusrq8eCpG0Rm8GekLAHXbw9NmW1daCphZ/wD9y8x
 /R6XaAeiBJnCPUOyLNVPA==
X-UI-Out-Filterresults: notjunk:1;V01:K0:gnYBqk8k2p0=:TZE8f1kO8ISS2/AjfTHTHe
 sC+j8fPlt1QkDjmRyLT22rP5LcblaRld0x2oyNPooX2OT2TnmVjOikbbg5iy+uZZIQD5dd7Mi
 oV3QUb62oqciPdSsdn8zB2G5lkSA7/srJ8+pKybK6n54GkmctBEQIR0SuOwYr6zf1pmIuFa6z
 iJ/8amLVqIi2+QptcTjKugGf0qbXLFNuoJI+8zbWz+r8vm4AUJ2fTTkmt/8zWX1Lc6JMfC1kO
 KbirClZP6zP8Ds3Zp5VzeMQ98+ooBOrNLfUx/gTdzYxLJ/SVMSSJupifUclix3kGNQw5CjfvV
 JUx7BZMkNwu1gzxc/3n9u4aMLgdzzGFOCspjIzGqaRRnwtjF+N2OSKZcyFGyrnIaApsHs6oA4
 b6Nx5qNllf6J5YXgON/ByCJBxocRvkN081OkSqK1E+l3kJDLoHHZ/NUw1WkKr8jWtVU60mhIA
 n0gG5kMPSBOiBEcBCVPhmYpCuaAzKb+elcRbV4nnhKE0OgwlUl4Im7y5d0Hz6TpuZvRX3VsdN
 zZL+HRt6yc1cZCKRwPmMYJCX4CkKvAEU9TDXdrjxbQ/OLi0nYjoVfFl/ssIYNAsKonr6N89DP
 /75ceB/VEKbn+tWYD+pFJfrBrPR36yrQ8q8iD9DCggqpwg0Jn0tXGR2csgLFv+ajeXQx4ic2W
 5JL2KZB7rOJv1wdYp/xFDozo6/Ywfp/AZV2uFbwbzqwG99/UBSSG08BEWkLw2JCTmPEw=
X-Spam-Score: 1.0 (+)
X-Debbugs-Envelope-To: 24176
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 1.0 (+)

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--93LF6nMOhpXGhhMR2DIUiqSTvHfbapkqN
Content-Type: multipart/mixed; boundary="k6Uir5x9Wn8kfhf1b8QQofRQwr4R6Rqb1"
From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= <clement.pitclaudel@HIDDEN>
To: 24176 <at> debbugs.gnu.org
Message-ID: <0a87c159-8bd5-3fda-0b03-d1426e6a26d0@HIDDEN>
Subject: Re: bug#24176: Acknowledgement (Confusing interaction between
 define-derived-mode and font-lock-add-keywords)
References: <1b9e5891-9843-a9d7-c29f-7b9544a72a12@HIDDEN>
 <handler.24176.B.14705521086608.ack <at> debbugs.gnu.org>
In-Reply-To: <handler.24176.B.14705521086608.ack <at> debbugs.gnu.org>

--k6Uir5x9Wn8kfhf1b8QQofRQwr4R6Rqb1
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Sorry, the original report had a confusing example; here is a fixed copy.=


(define-derived-mode ~/a fundamental-mode "~/a"
  (font-lock-add-keywords nil `(("a" 0 'font-lock-keyword-face))))
(define-derived-mode ~/b ~/a "~/b"
  (font-lock-add-keywords nil `(("b" 0 'font-lock-builtin-face))))
(define-derived-mode ~/c ~/b "~/c"
  (font-lock-add-keywords nil `(("c" 0 'font-lock-constant-face))))

Explicitly calling (setq font-lock-major-mode major-mode) before calling =
font-lock-add-keywords yields the expected behaviour.

Cl=C3=A9ment.


--k6Uir5x9Wn8kfhf1b8QQofRQwr4R6Rqb1--

--93LF6nMOhpXGhhMR2DIUiqSTvHfbapkqN
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJXptvPAAoJEPqg+cTm90wjrU0QAKaizdkb5V6YfCadbJcjunw2
UZtURgZp8B/+KOBLhixySB9eIG4IAG+AtJvr/QFeGGLr3/sqgI0i7Q2xi8REcddu
EN5Chg5GxU1N7SK2YKhRVZss8tPJqBVQwBMvQa79h6RbwYAqUSRp3Hwbi8nG16jQ
J+sML6PQ7vA4A1ApcjiNDw4V1DFOa/RoIf2enQhR2VVGONGCgtbCDWnAugYR19qR
7tHWwhw4NUxZ03y59M3DlWQ+n5rpd5SCBmtzAxa8VcOku0WWOwfVpAUnBoDhazEs
XvJgym8uDkRrxH5Rxy2AY380c24YmVFVWxA+Y4lVnD8xOgNc3PNWfWMt11I3OC83
CrTBUJ7oWZSjq0kHBByP4m+vXPOcwtHL4DS0s5IpZ8+HOMLb5abTJfl/fEzjhBBf
E0UrJ4LRVHuHU6bA4aY2ccGAWZe6I7Ap/fg/hAvB4YaSRF2bPeHvB936gYLQRVtq
D987wGZ1z1+IJ+s6zYJMVUYV4mhkBr38cfj7982nwZ3A0HRaPLygPQ7BVQ+OCrpX
alZiQHPEH+I/r0UZKGbX9vLlhI/qt/qE6OR5eD/ydiyU5itFmK9hpvkjedsHvV9Y
vVLAjhoqqPsvs966x/dNeQqk6PbmNO2r66MMMHUR/ZL7D0k0IMPueOiRuvzVK7Vl
VrnTvohnLfQcN/HA3K3w
=MdlO
-----END PGP SIGNATURE-----

--93LF6nMOhpXGhhMR2DIUiqSTvHfbapkqN--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#24176; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 7 Aug 2016 06:41:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun Aug 07 02:41:48 2016
Received: from localhost ([127.0.0.1]:58319 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1bWHmO-0001iW-Fm
	for submit <at> debbugs.gnu.org; Sun, 07 Aug 2016 02:41:48 -0400
Received: from eggs.gnu.org ([208.118.235.92]:45380)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <clement.pitclaudel@HIDDEN>) id 1bWHmM-0001iI-PN
 for submit <at> debbugs.gnu.org; Sun, 07 Aug 2016 02:41:47 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <clement.pitclaudel@HIDDEN>) id 1bWHmG-0005lv-FU
 for submit <at> debbugs.gnu.org; Sun, 07 Aug 2016 02:41:41 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50,FREEMAIL_FROM
 autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:41432)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <clement.pitclaudel@HIDDEN>) id 1bWHmG-0005lr-Ca
 for submit <at> debbugs.gnu.org; Sun, 07 Aug 2016 02:41:40 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:36341)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <clement.pitclaudel@HIDDEN>) id 1bWHmE-0000OC-4t
 for bug-gnu-emacs@HIDDEN; Sun, 07 Aug 2016 02:41:39 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <clement.pitclaudel@HIDDEN>) id 1bWHmA-0005js-1x
 for bug-gnu-emacs@HIDDEN; Sun, 07 Aug 2016 02:41:37 -0400
Received: from mout.kundenserver.de ([212.227.126.133]:59156)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <clement.pitclaudel@HIDDEN>) id 1bWHm9-0005ji-MU
 for bug-gnu-emacs@HIDDEN; Sun, 07 Aug 2016 02:41:33 -0400
Received: from [18.189.62.146] ([18.189.62.146]) by mrelayeu.kundenserver.de
 (mreue005) with ESMTPSA (Nemesis) id 0Lg4lz-1auUJr0LMJ-00peAD for
 <bug-gnu-emacs@HIDDEN>; Sun, 07 Aug 2016 08:41:32 +0200
To: bug-gnu-emacs@HIDDEN
From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= <clement.pitclaudel@HIDDEN>
Subject: Confusing interaction between define-derived-mode and
 font-lock-add-keywords
Message-ID: <1b9e5891-9843-a9d7-c29f-7b9544a72a12@HIDDEN>
Date: Sun, 7 Aug 2016 02:41:30 -0400
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101
 Thunderbird/45.2.0
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;
 protocol="application/pgp-signature";
 boundary="k1xLUDNVJKAtHAwPVBw996mcp09fxdtrx"
X-Provags-ID: V03:K0:mEtoTGaQYEMtHachKhijURy4EyX/EXJT29lIsZ84BcKzNhFTHVB
 rO/ECnchRUXaEJohYefEzOaYgEvQ43b7I1yg/r6/LlmB7UO1ueqwWwss35vIZYhAq+NZfDK
 6bAhBS10iPiQSR+eR3VTjSZ8Kbi+ESxnn/2KgF4SdemqynHNCtoiLIfMUF5KOar040BgkSO
 XQcSflIX4bQ+nGqE8++8Q==
X-UI-Out-Filterresults: notjunk:1;V01:K0:Nk0SCXi2HRk=:j4U/l4q9Xz2FeVH4CUuq2x
 eJwptvxHlreYm9RJLDJqUvj2WWt7uGzZ0Ue7QUNCiyGreJn4sIacRfGOKYoyTDtFQL0y8+rPc
 Deo44vVAcFj8a3zzRxlN+MQ8rqT69ZYQsdP8yqVDG84F5Xk0yOWTCBncYjg9xv+ZyFmz+6z8d
 BrrpE/NqUWjcK0HTINnHne9Yj9IJE0ISAaGG+Lw6oEPCDOCXNed08UQuJmrNLAHKkXiSkVePU
 krap0XNdltN+TJ4/P33dR1SbXBmBOOEfoAaZYgedfSfnHevpgtc+7TFwFcwdyAronfMQzIZhf
 +QP+AUqcScPIqCuXNWhAkd+ZAdmilYq9YRFewj1bQSgGTCjve7BVPqB4qeBecsEoIXzvf4EK0
 K1nVGHps4wue+aar7q8tzL55kFQqnAFElovQWhuDhGSqQo5uM6LyF1bBr5aDB7tOTTPtonqVY
 F1WwzqEROsgpSOnslaCfZR/nM3dIuqnDCyoB+0eLg8GukU0A8XnPq1li7DkL5ahlJVqVRi5Wk
 MnGrO8ZOFnesGqskTItS0mQwp5dPJqhMsE4e+2CXYYWB/DYk0DdUbQUuDeIdpNwDglIFek4uD
 yZx5+xM8zRCJeRGIUpRcQA7WQ5Tv2VVqiMIW7rUqnRdoclinwPcrxf+H+nv4Ib4cFQ5ynovR3
 jIFWtQQlaTLX76Q1dJECSqpT6DQ/VtT7/WCyUXW8fSMQCwZqXm36w/9Nxd+lYIvtseE0=
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -4.0 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -4.0 (----)

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--k1xLUDNVJKAtHAwPVBw996mcp09fxdtrx
Content-Type: multipart/mixed; boundary="Xg1PxpNVlX4jajOqG37CK8bp3M9JEwhET"
From: =?UTF-8?Q?Cl=c3=a9ment_Pit--Claudel?= <clement.pitclaudel@HIDDEN>
To: bug-gnu-emacs@HIDDEN
Message-ID: <1b9e5891-9843-a9d7-c29f-7b9544a72a12@HIDDEN>
Subject: Confusing interaction between define-derived-mode and
 font-lock-add-keywords

--Xg1PxpNVlX4jajOqG37CK8bp3M9JEwhET
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable

Hi bug-gnu-emacs,

Given the following mode definitions, I was expecting ~/a to have one key=
word, ~/b to have two, and ~/c to have three:

(define-derived-mode ~/a fundamental-mode
  (font-lock-add-keywords nil `(("a" 0 'font-lock-keyword-face))))
(define-derived-mode ~/b ~/a
  (font-lock-add-keywords nil `(("b" 0 'font-lock-builtin-face))))
(define-derived-mode ~/c ~/b
  (font-lock-add-keywords nil `(("c" 0 'font-lock-constant-face))))

This assumption is wrong, as can be easily verified by opening a new buff=
er, inserting "abc", and switching between ~/a, ~/b, ~/c.

What's going on? Is this a font-lock bug, a doc bug, or a user-got-confus=
ed issue?

Cl=C3=A9ment.


--Xg1PxpNVlX4jajOqG37CK8bp3M9JEwhET--

--k1xLUDNVJKAtHAwPVBw996mcp09fxdtrx
Content-Type: application/pgp-signature; name="signature.asc"
Content-Description: OpenPGP digital signature
Content-Disposition: attachment; filename="signature.asc"

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJXptgaAAoJEPqg+cTm90wjhFYP/RA3CAqdeygk2+p8iUyOqDL1
ei7xaYpk8CVPhEJzKym/lLBso0Q97Jype3DJ2Q80KKXBg8Hrkx2R2Xdjj4D9dXMR
WgLnqgtFu8i1Ze/KqftgO1XN2bFxX+oQQieM+43gbsQvKqczFHjT07LwCSSypOCf
jo+340rG6pXot8swQUdCbnGKWYVpXiqahWoqtWehh/HKPztJ3TojZF8O1gR7/Tmg
FbG2XoOoc5CGErVAJwbLltGQuUdoHkPOrP0RmgXJD0ddkdARHe4XUx5s7n2kRU4u
sqdYdVH0ABtUj8t/1w+XtEdtb10UbCycMFwUU5+IxWAjsWGb9+bSnVfKGqIxo1u/
PJkuprnK43xUcDnDKmVeRDYlHdqF1sdcIjrvs0MZPEHAgrOSugRrgg5FyW24qTvB
oms+0kbqcmQYYcIB7mb5IsPRP5z9O6/qNECRBAg6FH1Z4RHZXXhPd1cv+YOOEr9y
xxPJ/1UUofLovhs/z7/S09r7u6VHam98KJeV2JYVRUgo8QB/XWZmDyRBVF4kx9i/
x4391naDqr3IvvztSc6rPIWtuGOvXRp7Bzy1jK/9sUBvGkivTv9is9iElvXzmd+B
7lGrdgb+5UDuuFg4hTs4OjBdJAY5Qi61ERUl7qn7f8CksqZx6/rpxs2YOM0bQjz9
5m1cDROdV6cVeiCKt+u9
=03YJ
-----END PGP SIGNATURE-----

--k1xLUDNVJKAtHAwPVBw996mcp09fxdtrx--




Acknowledgement sent to Clément Pit--Claudel <clement.pitclaudel@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#24176; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 25 Nov 2019 12:00:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.