From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Colin Baxter Newsgroups: gmane.emacs.help Subject: Re: multi-line highlighting Date: Sun, 28 Feb 2021 17:57:08 +0000 Message-ID: <87mtvoaxe3.fsf@yandex.com> References: <87lfb8bje9.fsf@yandex.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24653"; 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: Stefan Monnier Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Sun Feb 28 18:58:05 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 1lGQKS-0006JD-Px for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 28 Feb 2021 18:58:04 +0100 Original-Received: from localhost ([::1]:49604 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lGQKR-00080a-Qw for geh-help-gnu-emacs@m.gmane-mx.org; Sun, 28 Feb 2021 12:58:03 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41366) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lGQJs-0007xh-Fa for help-gnu-emacs@gnu.org; Sun, 28 Feb 2021 12:57:28 -0500 Original-Received: from forward105o.mail.yandex.net ([2a02:6b8:0:1a2d::608]:40423) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lGQJj-00068e-6E for help-gnu-emacs@gnu.org; Sun, 28 Feb 2021 12:57:27 -0500 Original-Received: from iva3-237e1ce43853.qloud-c.yandex.net (iva3-237e1ce43853.qloud-c.yandex.net [IPv6:2a02:6b8:c0c:4996:0:640:237e:1ce4]) by forward105o.mail.yandex.net (Yandex) with ESMTP id 7DA344200789; Sun, 28 Feb 2021 20:57:11 +0300 (MSK) Original-Received: from iva1-bc1861525829.qloud-c.yandex.net (iva1-bc1861525829.qloud-c.yandex.net [2a02:6b8:c0c:a0e:0:640:bc18:6152]) by iva3-237e1ce43853.qloud-c.yandex.net (mxback/Yandex) with ESMTP id Nt7xSwH5AV-vBICmc8S; Sun, 28 Feb 2021 20:57:11 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yandex.com; s=mail; t=1614535031; bh=r6ceV0J6PWvma8RUE9+Eei9aY7sYAJKrQpcEcOTUk2M=; h=In-Reply-To:Subject:To:From:Message-ID:Cc:Cc:Date:References; b=jVeg3pvq6hM9V4jwdARyjpgUudaccgOcSCflKohtuB48jY6Ydc5cO9NflLIyqHlKA Q1A8ycWrWuFnI2Ur/WBw4gjhBZ0kpLLEz+NKVojFtOcF4BC90zt/0cQ9CvUlMe5DmS i+UD+RBvhRdahGTnhukNuywTXyloCNUQ42G5rNTg= Authentication-Results: iva3-237e1ce43853.qloud-c.yandex.net; dkim=pass header.i=@yandex.com Original-Received: by iva1-bc1861525829.qloud-c.yandex.net (smtp/Yandex) with ESMTPSA id 0yTteAx4z1-vAJansqD; Sun, 28 Feb 2021 20:57:10 +0300 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client certificate not present) X-Face: BHjiJOg/Qmj'BQgsAKL@])L)e62P)C"Y=6T In-Reply-To: (Stefan Monnier's message of "Sun, 28 Feb 2021 11:00:41 -0500") Face: iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeBAMAAAAodabAAAAAB3RJTUUH1wQdAAY04/L8hgAA AAlwSFlzAAAewQAAHsEBw2lUUwAAAARnQU1BAACxjwv8YQUAAAASUExURc7OzpwAAAAAAP////8A AGNj/2aqqTQAAAA8SURBVHjaYzA2NnEBAmdj01D8wNgYpM7F2JiBgYFREAgEGJiU8AMGBpA6QaCG UVtGbRm1ZdSWUVsGjS0Aq20lJnMawnkAAAAASUVORK5CYII= Received-SPF: pass client-ip=2a02:6b8:0:1a2d::608; envelope-from=m43cap@yandex.com; helo=forward105o.mail.yandex.net X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, 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:128316 Archived-At: >>>>> Stefan Monnier writes: >> I have in an org-mode file a need to color the face of the string >> between 'Alpha:' and a period. To achieve this I have >>=20 >> #+begin_src elisp (add-hook 'org-mode-hook (lambda () >> (font-lock-add-keywords nil >> '(("\\(Alpha:\\)\\([^\n\r\t]+\\)\\(.\\)" > ^^^ This is not the > regexp for a "period". Yes, I discovered that fact. I now have what I want working with this: #+begin_src elisp (add-hook 'org-mode-hook (lambda () (font-lock-add-keywords nil '(("Alpha:\\|=EF=BC=8E" . font-lock-warning-face) ("Alpha:\\([^<]+?\\)=EF=BC=8E" . (1 font-lock-constant-fac= e)) ("Beta:\\|=EF=BC=8E" . font-lock-doc-face) ("Beta:\\([^<]+?\\)=EF=BC=8E" . (1 font-lock-comment-face= )))))) #+end_src My end marker is the FULLWIDTH FULL STOP character. It may not be the most rigorous solution but it works. > Have you looked at the ELisp reference manual that comes with your > Emacs? It has a section called "Font Lock Multiline". Yes, I did. Thanks. Best wishes