From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#74307: 30.0.92; emacs-lisp font-locking word regexp Date: Thu, 05 Dec 2024 09:38:48 +0200 Message-ID: <86o71qy3xz.fsf@gnu.org> References: <87jzdawagd.fsf@gnu.org> <868qtmkzeo.fsf@gnu.org> <87mshak5hz.fsf@mail.linkov.net> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16098"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 74307@debbugs.gnu.org, winkler@gnu.org, monnier@iro.umontreal.ca To: Juri Linkov Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 05 08:39:23 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 1tJ6SI-0003yo-06 for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 05 Dec 2024 08:39:22 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tJ6SB-0007Lw-6U; Thu, 05 Dec 2024 02:39:15 -0500 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 1tJ6Ry-0007H7-Nf for bug-gnu-emacs@gnu.org; Thu, 05 Dec 2024 02:39:04 -0500 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 1tJ6Ry-0003iF-FS for bug-gnu-emacs@gnu.org; Thu, 05 Dec 2024 02:39:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=tn/wWiDjua8OZAD440cyj/t6HBIgr/gzke53olBhjdk=; b=CEereLzux+2W1MdQz4EKU6UodaIA9KqsgcAH450LJHxHWec4n+nmi9D0upoxcQO1j1mAFm2RRu5kqBAu5MjZCSG59EtTDqKboTVxZsQz3NdfX3+zd2efJ8poSVWvYAo0OAVg24tD3wBmnLpE/uSSUMPu4OaEu5Ddhrb0FSniJDqWwLhlS4ytj8JVRRGQ82U6aTe4u4vuxQvpbYMwWXfOZbzq0ggleOqSEJ3GkpBoDcGMNx+9ZjpIJ/vQhwDE0C/DA/YM4UJjA5w418FoaRBsZ0sW5mPXVxniUh0P0RDtlO3aew5h7IKYbWsGQ4EZMvrDw6Fi2wk67EMPUP57kylTSQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tJ6Ry-0005HK-2B for bug-gnu-emacs@gnu.org; Thu, 05 Dec 2024 02:39:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 05 Dec 2024 07:39:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74307 X-GNU-PR-Package: emacs Original-Received: via spool by 74307-submit@debbugs.gnu.org id=B74307.173338434120283 (code B ref 74307); Thu, 05 Dec 2024 07:39:02 +0000 Original-Received: (at 74307) by debbugs.gnu.org; 5 Dec 2024 07:39:01 +0000 Original-Received: from localhost ([127.0.0.1]:37998 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJ6Rw-0005H4-NK for submit@debbugs.gnu.org; Thu, 05 Dec 2024 02:39:01 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:36060) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tJ6Rv-0005Gr-7I for 74307@debbugs.gnu.org; Thu, 05 Dec 2024 02:38:59 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tJ6Ro-0003hX-ON; Thu, 05 Dec 2024 02:38:52 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=tn/wWiDjua8OZAD440cyj/t6HBIgr/gzke53olBhjdk=; b=C/X9NoBYFK0D v4Gsp9wkAP3K7GYVJto8rZD44GsEBtQBl2RtOW5OMr4Dbu24cs1N9pO//agXG2zQhjIm+cj/f+lqL fUMHg+HgtJGSBusuV/uz64fyLwYNyPoKDEh21NG+6dazeOVpKMr3jUOnJDJVj+l1soQIwgjEGivYE NeIMx4KFwzvw6F0pika8VYXgHGbIcB0rOzHJeOiT2SPl/vLR/m1ed6pvP0DeNY7nmP056T6v0boQm xmPYycj86ZuUz4QKmYqA8eM/eRbrCDGSCiyzxuPyDDH+4U5KWiqHpw5VLmBWtgg+GreDHe28PC+GY kvEiKiO4p5ZiYTIhEr7zZg==; In-Reply-To: <87mshak5hz.fsf@mail.linkov.net> (message from Juri Linkov on Thu, 05 Dec 2024 09:20:16 +0200) 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:296450 Archived-At: > From: Juri Linkov > Cc: Roland Winkler , Stefan Monnier > , 74307@debbugs.gnu.org > Date: Thu, 05 Dec 2024 09:20:16 +0200 > > >> (setq foo "\\") > >> > >> The part "foo\\" of the string "\\" will get > >> font-lock-variable-name-face, which looks odd. > >> > >> I believe, this is due to a clause in lisp-mode.el that says > >> > >> ;; Words inside \\[], \\<>, \\{} or \\`' tend to be for > >> ;; `substitute-command-keys'. > >> > >> But this assumption is not always correct, in particular if ">" is > >> preceded by "\\", which happens when constructing regexps. > > > > I believe you are saying that in > > > > (,(rx "\\\\" (or (seq "<" (group-n 1 lisp-mode-symbol) ">") > > (seq "{" (group-n 1 lisp-mode-symbol) "}"))) > > (1 font-lock-variable-name-face prepend)) > > > > we should use something like the below instead? > > > > (,(rx "\\\\" (or (seq "<" (group-n 1 lisp-mode-symbol) (not "\\\\") ">") > > (seq "{" (group-n 1 lisp-mode-symbol) (not "\\\\") "}")) > > The problem is that this removes highlighting from the last character > because it doesn't get into the group: > > (rx (seq "[" (group-n 1 lisp-mode-symbol) (not "\\") "]")) > => "\\[\\(?1:\\(?:\\w\\|\\s_\\|\\\\.\\)+\\)[^\\]]" > > A possible solution is to move (not "\\") inside the group: > > (rx (seq "[" (group-n 1 (seq lisp-mode-symbol (not "\\"))) "]")) > => "\\[\\(?1:\\(?:\\w\\|\\s_\\|\\\\.\\)+[^\\]\\)]" > > But this removes highlighting completely from the reported case of > (setq foo "\\"). However, I guess it should not have highlighting > anyway because this is an incorrect syntax of `substitute-command-keys' > that should match only \\[], \\<>, \\{} or \\`' without the second \\ Sorry, I don't understand: the change which was supposed to fix this was already installed. If you are saying it caused regressions, could you please show a recipe for reproducing those regressions?