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 yBc9Ae62nmE2jAAAgWs5BA (envelope-from ) for ; Wed, 24 Nov 2021 23:04:30 +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 +NKIOO22nmGFfAAAB5/wlQ (envelope-from ) for ; Wed, 24 Nov 2021 22:04:29 +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 90AB52B092 for ; Wed, 24 Nov 2021 23:04:29 +0100 (CET) Received: from localhost ([::1]:37802 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mq0NQ-0004c8-4O for larch@yhetil.org; Wed, 24 Nov 2021 17:04:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46162) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mq0Mp-0004Yg-7k for emacs-orgmode@gnu.org; Wed, 24 Nov 2021 17:03:52 -0500 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:45725) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mq0Mn-00074M-82 for emacs-orgmode@gnu.org; Wed, 24 Nov 2021 17:03:50 -0500 Received: (Authenticated sender: admin@nicolasgoaziou.fr) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 373781C0003; Wed, 24 Nov 2021 22:03:45 +0000 (UTC) From: Nicolas Goaziou To: Ihor Radchenko Subject: Re: [DISCUSSION] Refactoring fontification system References: <87ee7c9quk.fsf@localhost> Date: Wed, 24 Nov 2021 23:03:44 +0100 In-Reply-To: <87ee7c9quk.fsf@localhost> (Ihor Radchenko's message of "Fri, 19 Nov 2021 22:12:35 +0800") Message-ID: <87czmpqkhr.fsf@nicolasgoaziou.fr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain Received-SPF: pass client-ip=217.70.183.197; envelope-from=mail@nicolasgoaziou.fr; helo=relay5-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1637791469; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc: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; bh=ZWyEyubyl8CNK/98EuWYItGuZ/Cy0vBltNgXHkF5egc=; b=iIgZVMpeTGkRGzjjtb3KQatIrFUeYLxDk/D+2Y4JFy7mThDYUGb49+NSSOkeg3Z0hQOUK/ KybkXjo5BFbIIGGTjxRxuoZOLhVbLxYkIf1optfNndggPAAPIbMSIyWT9gt+fZa6iRVjPv cXaiPFnNBsZk20goOvbtLKHh+bZyFS6ZnrDt7LBXl1WLR2+qlqp5QVgxsiXvBVgDV/Zvlq fdjiKfGzWa9lF1CRtk1MsT9Nue58P9FXkTjO8yd7Ym4EZmVl/0mPuEpr01bhTWqbeSkwM+ YEZmnKQS21+WEVBzOKEB67WvGcp38I04YLGJjrrV0+zCB0miebDmiNIxBNwANQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1637791469; a=rsa-sha256; cv=none; b=bKH3fzZMnm6bruCc1gbQGsg3KgPJ6Of82yW+YcZVnScvzmsYwU26MO1dkP+RXEyqNvKQ0v jAzvcHBgHZKm858XVY51gTn8YBb6lGMM/XSYFyHYbMIbRm2IosFns/B+S/3l0aqmNnQmzi VV+7qjDEy1+6dWG4KhboFmaxrKEUEnjyHm7LODsz+S+ZFS7Pis+/16X6jeGATKWhht0mam qYkElr+K6E4lbykdpD9ZRVK60LP2V2SAM/+Aw9302BOyrgKCRNA5IaKYZalLuzDKtmA62n 5IcGD+Mu7vcuBPKyKZ/sAFK8NzZqy7bdiup3tPXJ2mGS2IAUVhvQge5xq0MNZg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -2.99 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 90AB52B092 X-Spam-Score: -2.99 X-Migadu-Scanner: scn1.migadu.com X-TUID: VjoM/tnNzUTa Hello, Ihor Radchenko writes: > 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? I wholeheartedly agree with all these points. Regards, -- Nicolas Goaziou