From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id UDmYKXWqm2HgdAAAgWs5BA (envelope-from ) for ; Mon, 22 Nov 2021 15:34:29 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id qK05JXWqm2HtVQAAB5/wlQ (envelope-from ) for ; Mon, 22 Nov 2021 14:34: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 5114FA1E1 for ; Mon, 22 Nov 2021 15:34:29 +0100 (CET) Received: from localhost ([::1]:47186 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mpAOq-00029T-H0 for larch@yhetil.org; Mon, 22 Nov 2021 09:34:28 -0500 Received: from eggs.gnu.org ([209.51.188.92]:56022) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mpAOP-00026U-Bz for emacs-orgmode@gnu.org; Mon, 22 Nov 2021 09:34:01 -0500 Received: from [2a00:1450:4864:20::534] (port=38407 helo=mail-ed1-x534.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mpAON-00036Y-T4 for emacs-orgmode@gnu.org; Mon, 22 Nov 2021 09:34:01 -0500 Received: by mail-ed1-x534.google.com with SMTP id x6so65988262edr.5 for ; Mon, 22 Nov 2021 06:33:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-transfer-encoding; bh=p/W964gKpDGtsdz6ArbKa4P6glVhJBj60gVP45Qievk=; b=CW8yZrnGTXAeDsEDQkPhC4mo7J+C4J4WDe6s5q6csxHk+uavtEs4XeiAiSwmsmOVd0 cFfhmWDd9QhhsOc86/sJlE+OhZsOkw8wM0JtlGq7mdEcQ0Ziupi1FS+hREwmqi5cO6t9 SzwhUweKgNRoCIJL9q84ena4ZA2DihBMoFR/u53R4zNKJLKVkHx9BfZtiuzu9mxTfDGt NRsz5Aqn9MVa2Mpww/hyEc9uqcfxI/OV4dW9eU2TcXexbyprwTmiYXudmQ5CMmZ4wJly Q5J5G/3H9UGJrENV5m/dAePVgDgBA8IiLqZjKrlx1tx+6rhrAtiqmF8gjh/lKOm8kurQ 8HzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=p/W964gKpDGtsdz6ArbKa4P6glVhJBj60gVP45Qievk=; b=RUG7H/lJ56Q8VySlbyBnU06EpkhtvaFwSnwCXTzrbJwKSUTEMIAtpRshOP5ZFzs4+V pw5b7PlRRJmswkitYuuuUvWNQ3tZvjUpz/dUHZ7cSoP7K0LYmVKmKQKyCWXk6HusH0ma 3YUBhXHoHLSJesMAMzJOhM4CHb5S8F1hf5HbrFX2eZuU8qqXYfKkw5ysMfiydhQ97ldo KtmmTzCdCk3SGwE6hCrUwY9sfhuelbzRdMakXSHHuOWlyMq6qO16ScI/AGxtpwTqwqBv F5YkP8pN9wx7fg1cbbG7y2Kpj88fD9Ud0GGh86zxjT7i65YM+wrDahHx7eaGYEdkat6j oc0A== X-Gm-Message-State: AOAM530GVRlIjzuh1mvsZyQscYXPdRVf0oKqhhMhIoV254iJochhyS+o AVBPUQ1yDkpSj2l+mraDN/A= X-Google-Smtp-Source: ABdhPJx0Oiwrw8T8RKvA2ABKb7LwwU1oY6l96VNQ/1bYMGZWTSTP3dedrhOEsZbcS0L9TbLofd8Cbg== X-Received: by 2002:a05:6402:268d:: with SMTP id w13mr66832286edd.257.1637591637430; Mon, 22 Nov 2021 06:33:57 -0800 (PST) Received: from localhost ([158.255.2.9]) by smtp.gmail.com with ESMTPSA id b7sm4353082edd.26.2021.11.22.06.33.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 06:33:56 -0800 (PST) From: Ihor Radchenko To: Timothy Subject: Re: [PATCH] Fontification for inline src blocks In-Reply-To: <87zgpw5lt9.fsf@gmail.com> References: <87pmzf4bd0.fsf@gmail.com> <87o86d7g05.fsf@gmail.com> <875ysk76bo.fsf@gmail.com> <87a6hwpeew.fsf@localhost> <87zgpw5lt9.fsf@gmail.com> Date: Mon, 22 Nov 2021 22:35:20 +0800 Message-ID: <87k0h0b6mv.fsf@localhost> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::534 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::534; envelope-from=yantar92@gmail.com; helo=mail-ed1-x534.google.com X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.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_ENVFROM_END_DIGIT=0.25, 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: , Cc: org-mode-email 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=1637591669; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=p/W964gKpDGtsdz6ArbKa4P6glVhJBj60gVP45Qievk=; b=neGygMRcoBgIblzP5DwPlr9e/zvBDVtoBu3r9ea220fZAJI/S2ogDPRi/fg4jIiHW3SlnL nwLg2tWF1kmAbW27MvOmENKMiJhXF+f1Ad9z5QmQPv/ETd0XCL0aR7RfW3WwjOgzmE//Rf 7Q/Yiw3eaxBijOeDwU7/sdQh3C11tvE9t0TeqdVOg/ZnmR+UD50QBTti8VwaahuNvDIRMO Rx766SyWx/hYJY6V+iWfJ8VaVYy4LSFjNmLyzddb8Jv2xq0VS9+Y65MQYbkZiM8S1ghJKJ Kn31xbjEkyDgQwJ2OlCRKNHivcFRhlITjNJQzqFd394OJbYVbKlZWAGlWTLokQ== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1637591669; a=rsa-sha256; cv=none; b=Ip0NvvkV8foc7juPbn9D+n0nAR3IVX5aEV1F9c8ScrAP+7pd04uAoro7VwyCV8PGBsn0CC 1Zthhpn3ijZH/QuB0+r6QkClc/dPMx+iAzdgeV4CU4EzdWpoK/V4e1xap9TqWM8nHOEY3B elY+tgJPX++c5f8W1DK1q99wYNFsvEi3olsHxm5F8hM3/WujB9+ls3STsszuB8wluJhgP5 IbyzK080m4Cf/2ptRwWdpd9+9SGuUIgNJhlCluhJRmo62+07XkqoU3l0pIgLBujbt2hw4v EN1dMiz3c6DVjJTGW+XkloaxrgeoV6DkVNzkpfqzU1QCrymCRWot8NcmOvBc7w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=CW8yZrnG; dmarc=pass (policy=none) header.from=gmail.com; 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.58 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=CW8yZrnG; dmarc=pass (policy=none) header.from=gmail.com; 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: 5114FA1E1 X-Spam-Score: -3.58 X-Migadu-Scanner: scn0.migadu.com X-TUID: PjLRknlgofqT Timothy writes: >> I have some comments. See below. > > Thanks for going through this, and for all your help previously. > I appreciate it :) Welcome. >>> (org-inline-src-fontify-max-length): Create a variable to limit the >>> maximum length of an inline-src block fontified, to protect from lag >>> spikes (e.g. when typing out src_lang{ and half of the buffer is >>> fontified). >> >> I do not like this. Even with this variable, some part of buffer may be >> spuriously fontified. Maybe you just verify that you are at actual >> inline-src block by examining org-element-context? > > The description may need updating, as that=E2=80=99s a tad inaccurate. Th= at value > actually limits how far forwards a paired paren is searched for. There=E2= =80=99s no > spurious fontification. I can see the purpose. However, it still looks like overcomplication. org-element-context takes care about this issue simply by narrowing to current element (inline src block is an object and hence must end within current element). >>> + (font-lock-append-text-property lang-beg lang-end =E2=80=99fac= e =E2=80=99org-meta-line) >>> + (font-lock-append-text-property beg lang-beg =E2=80=99face =E2= =80=99shadow) >>> + (font-lock-append-text-property beg lang-end =E2=80=99face =E2= =80=99org-inline-src-block) >> >> Is there some special reason why you apply both =E2=80=99shadow and >> =E2=80=99org-inline-src-block? What about =E2=80=99org-meta-line face? M= aybe >> =E2=80=99org-meta-line should not be hard-coded? > > I think there=E2=80=99s an argument for more faces that can be made becau= se of element > like this, but it comes down to the idea that in a `src_lang[options]{con= tent}' > construct `src_' is effectively visual noise, particularly once fortifica= tion > occurs and it=E2=80=99s obvious that it=E2=80=99s inline code even withou= t it. So, I find it > nicest if it=E2=80=99s faded, which `shadow' does. Also applying `org-inl= ine-src-block' > allows for a consistent background colour across the whole construct. Makes sense.=20 >> It looks like you are repeating the job of org-element-context here. Why >> don=E2=80=99t you just get the proper object? > > IIRC `org-element-context' doesn=E2=80=99t separate out the `src_', `lang= ', `[options]', and > `{content}' of an inline source code block (which we want). Sounds like an omission in org-element-context. At least, the parser could return :contents-begin and :contents-end. Then, you would also not need to re-implement the parser. Best, Ihor