From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id AKFvK8nRl2FE+AAAgWs5BA (envelope-from ) for ; Fri, 19 Nov 2021 17:33:13 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 8L8oJ8nRl2F4ZwAAB5/wlQ (envelope-from ) for ; Fri, 19 Nov 2021 16:33:13 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 5369011613 for ; Fri, 19 Nov 2021 17:33:13 +0100 (CET) Received: from localhost ([::1]:42784 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mo6p5-0007dP-Q5 for larch@yhetil.org; Fri, 19 Nov 2021 11:33:11 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51144) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo6fv-0007Wp-V0 for emacs-orgmode@gnu.org; Fri, 19 Nov 2021 11:23:44 -0500 Received: from [2607:f8b0:4864:20::102f] (port=52197 helo=mail-pj1-x102f.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mo6ft-0005PM-SP for emacs-orgmode@gnu.org; Fri, 19 Nov 2021 11:23:43 -0500 Received: by mail-pj1-x102f.google.com with SMTP id gt5so8330589pjb.1 for ; Fri, 19 Nov 2021 08:23:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=references:user-agent:from:to:subject:date:in-reply-to:message-id :mime-version; bh=uEJ/kPVrNxZeCXvl8Pp4v/4CkAb0UWRMj5ylgcy+r4g=; b=FhHcuEeFKBKmDB05QDX7JIX+3aYUs0t5iRBxb1HWP4Iwsr2O2y2Ewhd20dszpZnBfS rzTgOZ9eywu0GFzBAJqbY3g0os+K8aGP4CKJm439OltRvMfQUu6J8ATibIA0VsU3wMa6 Eu831XCHjSUXWw3ntsq6qbbkFPW68LyfleH36uoah4kynEwp+E9IVZfRAwinJKSFj3wr yydHwfpRk39hgeLq6PcyUTMWYI4AAPq/X53xgJL7r/WjFpxI67o/3PX28Z7qHzOaoN/R QcyYdNf7uGE17Onreiyg2DUZw7Yip2TJTYsoBjfIcyh0Uas87Qv4j3M9kV6/Q+d/CZi4 KX0A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:references:user-agent:from:to:subject:date :in-reply-to:message-id:mime-version; bh=uEJ/kPVrNxZeCXvl8Pp4v/4CkAb0UWRMj5ylgcy+r4g=; b=a48kbVCV0bAardxGVSWf/+90Ui35rqpbxA8mo9GOi/6ggPOOjDToVMROpLvKTUTRbv q0FPrRWRytMf6pbb8rIE0Y6+Dpr7ldifFfiflFmUc54IgM/IVjTBJ8clMekcl3XVqp0o lgoaDSoKqWCzGr30eDqUxljMyhn/L0cV5tFKwJvQNgEe1AG1K5bc2IJy9HXFgLJ6Jzy/ lwPWKvpzthI1hApEsBApYRE+5ZL9rSv+cfwjz/h82yFGKa37eERSQb5LCiYbof3aW6Az fMT3TXkoCssi7GZUzYMnrzKnhYlYjInTZiCyW3SavvXl4Cfw30dFV51nm7fBv7+qCYE7 cptQ== X-Gm-Message-State: AOAM533Z1uIDjxooXlWRh4vdjnwdYNcksAiW3VJ6EjEBIuEsFZfdkYah s0XPaphrsXM7ph5nBDPHD+CqImgZVas= X-Google-Smtp-Source: ABdhPJx3i0UAv8E3rq04v0ly4AN4MgL0WuXOWT8FTbj+16k/BVGbaF7Ppa3pJHQyCnZsdfwfehbHjA== X-Received: by 2002:a17:90b:3a85:: with SMTP id om5mr1119337pjb.28.1637339019715; Fri, 19 Nov 2021 08:23:39 -0800 (PST) Received: from dingbat (2001-44b8-31f2-bb00-0bbf-8064-5177-ffac.static.ipv6.internode.on.net. [2001:44b8:31f2:bb00:bbf:8064:5177:ffac]) by smtp.gmail.com with ESMTPSA id j6sm136001pfu.205.2021.11.19.08.23.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Nov 2021 08:23:39 -0800 (PST) References: <87ee7c9quk.fsf@localhost> User-agent: mu4e 1.7.5; emacs 28.0.60 From: Tim Cross To: emacs-orgmode@gnu.org Subject: Re: [DISCUSSION] Refactoring fontification system Date: Sat, 20 Nov 2021 03:09:17 +1100 In-reply-to: <87ee7c9quk.fsf@localhost> Message-ID: <87tug8t8ql.fsf@gmail.com> MIME-Version: 1.0 Content-Type: text/plain X-Host-Lookup-Failed: Reverse DNS lookup failed for 2607:f8b0:4864:20::102f (failed) Received-SPF: pass client-ip=2607:f8b0:4864:20::102f; envelope-from=theophilusx@gmail.com; helo=mail-pj1-x102f.google.com X-Spam_score_int: -12 X-Spam_score: -1.3 X-Spam_bar: - X-Spam_report: (-1.3 / 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, PDS_HP_HELO_NORDNS=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1637339593; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=uEJ/kPVrNxZeCXvl8Pp4v/4CkAb0UWRMj5ylgcy+r4g=; b=HZDAD4B4s6P9h7yP+2IOqrFbDCKF93mZskTqd9gtZMySaXwjqGlfel6KsgbiBOo03gPLbQ PcKIGs4NioFxvXKjMgVVX9bBMq+ndvhNnG3LeGQKEJSLRhn17ELs7qUmRn0trtLXNVN5lh KPX3b6i8mWEdOp8/+roOBWGy4HFx2/rrAoITSHLMe3LtI+Z7eWX32UYJutoSZQkq/0UfBF +sS8N/HxvvojslFZwxYyW2AsjnfU1uuy47gmZVnnALNK4ja8ybK6QW9DMHk68MuSbisy8l 8xKd9zdzvuk4ekfTP6xKtTVhZ4B2QEnUBAYGlVjMBoQ3Oy78o+DUwGHhJHpfpw== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1637339593; a=rsa-sha256; cv=none; b=nuic5SC7neOJuGa85Utg/CdQXmMxjSI7qQAfUHavcOZG6wyowQIx2Jx28yrjho1b85313x GDqbEPR9ejGNNEPSj3Lod8LdEJkTgFyeF5rkF0QQ6C6use8Cpupq+Ry/TtS+agcPqojpg8 cIxbx8OMAVAoN8178EtlbzXeSqy642m1M9ZWsyASvisBoUyEiUQJaazSBng3AQFCiQVYCI ouOV0c2+g/jO+2OIYKKI32t5HW+lhLWnEkQ1SWN7fEbB4t+t47yOw/l5l/G7HZAWyLBxy7 00buZ36jRYlyb2Z1srr/QXGW4K5ZHQw/smrugKimryUTrrtDxSqMEtzJShQjLg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=FhHcuEeF; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.57 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=FhHcuEeF; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 5369011613 X-Spam-Score: -3.57 X-Migadu-Scanner: scn0.migadu.com X-TUID: eYZEDCPWR1tf Ihor Radchenko writes: > Dear all, > > Recently, there have been multiple issues related to incorrect > fontification: > - https://list.orgmode.org/orgmode/23707.20428.546749.44853@frac.u-strasbg.fr/ > - https://list.orgmode.org/orgmode/87fsujp7mc.fsf@web.de/ > - https://list.orgmode.org/orgmode/87czvqxdn9.fsf@gmail.com/ > - https://list.orgmode.org/8735nsv9qo.fsf@nicolasgoaziou.fr/T/#me1c44b6e493dd280cca4f042b833c24749ae4fe0 > > These issues keep appearing because our current fontification code is > based on regexps and only approximates the actual Org grammar elements. > It is largely a legacy from the times when org-element parser was not a > thing. > > Maybe it is a time to upgrade the fontification according to our > state-of-art parser? > > Instead of fontifying elements individually via regexps, we can leverage > org-element-map, org-element-parse-buffer, org-element-cache, and > jit-lock-mode. Each type of Org element/object can be assigned with a > fontification function accepting a single argument - the element datum. > > Also, the fontification code can be move to a separate library. > > WDYT? > Sounds like a better approach to me. In addition to being more accurate, this would mean we don't need to keep 2 separate definitions in sync or have confusing font locking where the regexp and element definitions are different. Should gives us increased consistency and less maintenance.