From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: font lock with functions Date: Tue, 31 Mar 2020 09:20:37 -0400 Message-ID: References: <86tv2h2vww.fsf@gmail.com> <20200322123818.GB32470@ACM> <87eetk5swm.fsf@gnu.org> <20200326193128.GC14092@ACM> <86d08y4zsx.fsf@gmail.com> <83sghs7qdz.fsf@gnu.org> <7ee94ed4-7a11-90bd-df69-c0eeacaf191c@gmail.com> <835zeo7c92.fsf@gnu.org> <05de335b-383e-b32d-2e7e-e79192d364de@yandex.ru> <03981ead-3aca-c238-a9d0-88407ffae451@yandex.ru> <83wo745tw6.fsf@gnu.org> <837dz35j30.fsf@gnu.org> <9b013d7f-664a-711d-0b7b-d7bd961b8ef0@yandex.ru> <87a73w4yp6.fsf@randomsample> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="100676"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) Cc: Eli Zaretskii , emacs-devel@gnu.org, cpitclaudel@gmail.com, Dmitry Gutov To: David Engster Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Mar 31 15:23:46 2020 Return-path: Envelope-to: ged-emacs-devel@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 1jJGrq-000Q5k-BS for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Mar 2020 15:23:46 +0200 Original-Received: from localhost ([::1]:37950 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJGrp-0002Bv-90 for ged-emacs-devel@m.gmane-mx.org; Tue, 31 Mar 2020 09:23:45 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41775) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jJGp3-0007nO-UR for emacs-devel@gnu.org; Tue, 31 Mar 2020 09:20:55 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1jJGp2-00050v-2R for emacs-devel@gnu.org; Tue, 31 Mar 2020 09:20:53 -0400 Original-Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]:40863) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1jJGoy-0004xU-LC; Tue, 31 Mar 2020 09:20:48 -0400 Original-Received: from pmg1.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 48E7C10088C; Tue, 31 Mar 2020 09:20:47 -0400 (EDT) Original-Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg1.iro.umontreal.ca (Proxmox) with ESMTP id 8D72310075B; Tue, 31 Mar 2020 09:20:38 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1585660838; bh=ECTeoMBiiQZfyuO/5pOIoi/7ZWNARcyentqeVQ8J3io=; h=From:To:Cc:Subject:References:Date:In-Reply-To:From; b=lWXrfc7OO6gBlk4FmMxMZFe+MBy8saOVRBoSNjFb3MUrPKmEaEAWT5ODkPGQ3MmK3 Vm74hw9JVYM5wdCsNQs9rtoNA8zw+n9hd7pZ6A5vLOTo8v4IWT0Uv1h7P0fquWEbi1 Rsdbxo26qnBtZpgpccLdeuYVz+KN0tMh1qBhjq7w1P4L+hYzk78xwuv+uZrPuOOQ0I 8zpw9UK8UknL6lgPS1ON2PQjnALdIXrLupB3j9s1yqbcxB5CdAqvWNBVvuiU1fodI5 yoDY4RQhq/VKj2IIPd4WGhtJXP0B32wwaMUEWOdFL1bpB7wVHMQ7Cupo02k5FKHwUR zMFzLDGGN8nVg== Original-Received: from alfajor (unknown [104.247.241.114]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 3B3D112059D; Tue, 31 Mar 2020 09:20:38 -0400 (EDT) In-Reply-To: <87a73w4yp6.fsf@randomsample> (David Engster's message of "Tue, 31 Mar 2020 12:15:49 +0200") X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 132.204.25.50 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:246093 Archived-At: > - It is very easy during testing to completely hang your Emacs session > if one of the font-lock functions hangs. One usually needs to kill > Emacs in this case. `jit-lock-debug-mode` might be helpful there. If it's not good enough for your situation, please `M-x report-emacs-bug`. > We should try to get this into ELPA and advertise it in the manual: > > https://github.com/Lindydancer/font-lock-studio Agreed. > On a more general note: When you use functions for font-locking, I often > find myself in the position that I'm more or less writing a parser, and > I could readily tell font-lock how to fontify several parts of the > buffer with different faces. However, AFAICS, this is not possible with > current font-lock? You can't use the `font-lock-keywords` special syntax for that, but you can still do it (by hand). E.g. (defvar foo-font-lock-keywords `(("someregexp" (1 'foo-face) (2 'bar-face)) (my-parsing-function))) (defun my-parsing-function (limit) ... (while ... (put-text-property x y 'face 'foobar-face) ...) ;; Return nil if you don't want font-lock to call you again right away ;; to "look for the next match". nil) -- Stefan