From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#70383: Conf-mode[toml] badly set face property Date: Wed, 17 Apr 2024 14:17:43 -0400 Message-ID: References: <45347c16-6e54-4598-8ac9-33f56f65e106@gmail.com> <868r1fnb8k.fsf@gnu.org> <867cgylmoq.fsf@gnu.org> Reply-To: Stefan Monnier Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17178"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Alastair Irving , 70383@debbugs.gnu.org, casouri@gmail.com, jostein@kjonigsen.net To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Apr 17 20:21:16 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@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 1rx9uG-0004Eh-0x for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 17 Apr 2024 20:21:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rx9tv-00066s-Ha; Wed, 17 Apr 2024 14:20:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rx9tt-000654-UR for bug-gnu-emacs@gnu.org; Wed, 17 Apr 2024 14:20:53 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rx9tt-0001bi-Jv for bug-gnu-emacs@gnu.org; Wed, 17 Apr 2024 14:20:53 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rx9u6-00032Z-Eg for bug-gnu-emacs@gnu.org; Wed, 17 Apr 2024 14:21:06 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 17 Apr 2024 18:21:06 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 70383 X-GNU-PR-Package: emacs Original-Received: via spool by 70383-submit@debbugs.gnu.org id=B70383.171337805511564 (code B ref 70383); Wed, 17 Apr 2024 18:21:06 +0000 Original-Received: (at 70383) by debbugs.gnu.org; 17 Apr 2024 18:20:55 +0000 Original-Received: from localhost ([127.0.0.1]:47354 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rx9tt-00030G-1q for submit@debbugs.gnu.org; Wed, 17 Apr 2024 14:20:54 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:43706) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rx9tp-0002yq-FW for 70383@debbugs.gnu.org; Wed, 17 Apr 2024 14:20:50 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 701A610007D; Wed, 17 Apr 2024 14:20:30 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1713378029; bh=TLwy0XZRrjHMJKEaFHYJOJ5Jim8NTMIVVJmje8OQ19w=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=B2KapMESM+x+ZknM6Q188islEGPpD1BHRtycI4FV6jytFr6d8TcxzT9/APsJUCS4l beNH2fn9at0j3WAI3jBN2gFoNgEo1q9QGqj5PlM7Bkv+qzMOPC1DJ2xNGCGkg5DqMa aNtbAJO80c9dXPYNzSX0ywEe2qQbUfHHWn5tlRxK1pzTDkGCICBaRCx+h5PBfU6KBy iEeHFnkLB2NQwOk9cgTVOwip15RALQEXdBhDCzcMVSNljiibS01zjRbU0nvgTLSem+ OmKO9ug9foU5M0jFJ9RvJfeHyL6LwAkzDHOe9ST+yYh9DLjdvHRkhdhp6aizASsoyO ZlIbMeyR/XZBw== Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 766C0100048; Wed, 17 Apr 2024 14:20:29 -0400 (EDT) Original-Received: from lechazo (lechon.iro.umontreal.ca [132.204.27.242]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 5A05A12059E; Wed, 17 Apr 2024 14:20:29 -0400 (EDT) In-Reply-To: <867cgylmoq.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 15 Apr 2024 17:34:13 +0300") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:283514 Archived-At: > diff --git a/lisp/textmodes/conf-mode.el b/lisp/textmodes/conf-mode.el > index 5e16360..8a201bd 100644 > --- a/lisp/textmodes/conf-mode.el > +++ b/lisp/textmodes/conf-mode.el > @@ -180,7 +180,7 @@ conf-font-lock-keywords > (1 'font-lock-variable-name-face) > (2 'font-lock-constant-face nil t)) > ;; section { ... } (do this last because some assign ...{...) > - ("^[ \t]*\\([^#=:\n]+?\\)[ \t\n]*{[^{}]*?$" 1 'font-lock-type-face prepend)) > + ("^[ \t]*\\([^[#=:\n]+?\\)[ \t\n]*{[^{}]*?$" 1 'font-lock-type-face prepend)) > "Keywords to highlight in Conf mode.") AFAICT this rule is not even activated in for TOML files. The patch below seems to DTRT for me. [ I'd even argue that it should (goto-char end). ] [ I found the culprit after noticing that the number of `font-lock-type-face` elements in the list in the `face` property was the same as the number of characters between the two "sections". ] Stefan diff --git a/lisp/textmodes/conf-mode.el b/lisp/textmodes/conf-mode.el index 5e1636033f6..e74409128df 100644 --- a/lisp/textmodes/conf-mode.el +++ b/lisp/textmodes/conf-mode.el @@ -613,7 +613,6 @@ "Font-lock helper function for `conf-toml-mode'. Handles recognizing TOML section names, like [section], \[[section]], or [something.\"else\".section]." - (save-excursion ;; Skip any number of "[" to handle things like [[section]]. (when (re-search-forward "^\\s-*\\[+" limit t) (let ((start (point))) @@ -633,7 +632,7 @@ (goto-char start) (unless (search-forward "," end t) (set-match-data (list start end)) - t))))))) + t)))))) ;;;###autoload (define-derived-mode conf-toml-mode conf-mode "Conf[TOML]"