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.help Subject: Re: Font lock question Date: Wed, 17 Mar 2021 12:46:57 -0400 Message-ID: References: <87a6r29hkl.fsf@fastmail.fm> <87r1kdx1ge.fsf@fastmail.fm> <87o8fhwyai.fsf@fastmail.fm> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="21301"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: help-gnu-emacs@gnu.org To: Joost Kremers Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Wed Mar 17 18:10:34 2021 Return-path: Envelope-to: geh-help-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 1lMZgn-0005QH-BC for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 17 Mar 2021 18:10:33 +0100 Original-Received: from localhost ([::1]:44012 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lMZgl-0006Gv-R4 for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 17 Mar 2021 13:10:32 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:39424) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMZKB-0005Yd-04 for help-gnu-emacs@gnu.org; Wed, 17 Mar 2021 12:47:11 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:48776) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lMZK8-00026c-LK for help-gnu-emacs@gnu.org; Wed, 17 Mar 2021 12:47:10 -0400 Original-Received: from pmg3.iro.umontreal.ca (localhost [127.0.0.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 2397E440F31; Wed, 17 Mar 2021 12:47:07 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg3.iro.umontreal.ca (Proxmox) with ESMTP id 792194410B9; Wed, 17 Mar 2021 12:46:59 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1615999619; bh=MNzmhseMKTXFmjycW0enjm0QmHf4m/gShCTAsc5aM8A=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=O7oX9JUuHaU5hu8ISdOGrekUG7x/sP8YhjejjqDv40pQn1MaTZpPC2gdiz6O2T9Sk izLwIyubx6YWNnKXAtgrD2ZtD6sc5rd1e54gYks1hepv+FHKQgBkIIQs/3jZuSsWZG C/QRtZRv8HzSU8am6/LYnYxdRlQJqG+hFbVRX8XiSnD1zw9EW/C3XuNB+KvMTi8wbw J/ZVpbBvjzeZgVI8mTOv/VODEAnl6yrHCrKzXKbB9n+MmK1W11DTX8Vm23RWfZ8sP9 YUxU8bzqvWrxz1o0onAmIYHny6vrj/PRNZ42Jkk9sxfdS3t8TdLwSrkRj1GLF18jGz 4FKC3Z15QvbLA== Original-Received: from alfajor (unknown [216.154.43.249]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 2DEED120348; Wed, 17 Mar 2021 12:46:59 -0400 (EDT) In-Reply-To: <87o8fhwyai.fsf@fastmail.fm> (Joost Kremers's message of "Wed, 17 Mar 2021 17:09:41 +0100") 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: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:128434 Archived-At: >> But be aware that these approaches still won't work well if the [...] >> thing can span multiple lines. > Hmm, I'm afraid that is indeed possible. Perhaps I'll keep it simple and only > font-lock the `B` part, since it can't contain any spaces and is fairly easy to > do. Can there be [...] without any `aBc`s in them and which need to be font-lock differently? If not (and if it shouldn't span too many lines), then I think a MATCH-ANCHORED that just matches on the opening "[" and then uses the PRE-MATCH-FORM to return the position of the matching "]" should work acceptably, as long as you use `font-lock-multiline`. Stefan