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 MLYmJQ2Mm2EILwAAgWs5BA (envelope-from ) for ; Mon, 22 Nov 2021 13:24:45 +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 KJjiIA2Mm2G/fgAAB5/wlQ (envelope-from ) for ; Mon, 22 Nov 2021 12:24:45 +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 35AAB12CB3 for ; Mon, 22 Nov 2021 13:24:45 +0100 (CET) Received: from localhost ([::1]:57330 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mp8NG-000681-OI for larch@yhetil.org; Mon, 22 Nov 2021 07:24:42 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46352) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mp8Ks-0004qu-Lb for emacs-orgmode@gnu.org; Mon, 22 Nov 2021 07:22:16 -0500 Received: from [2a00:1450:4864:20::133] (port=36399 helo=mail-lf1-x133.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mp8Kq-0006HW-Pk for emacs-orgmode@gnu.org; Mon, 22 Nov 2021 07:22:14 -0500 Received: by mail-lf1-x133.google.com with SMTP id k37so80017125lfv.3 for ; Mon, 22 Nov 2021 04:22:12 -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=vVaZyUzzA2W9HY2GMsHZPpHUGV/K5R2zSK9G8b9oYlw=; b=ATRMdRhZPYhL7nZaTW4RQIc3cwrmhbeqqKOY0wFsP+ffT7helmT0ruSt1SAiiQZCwz t/lK6UP3PXhIhlXjjY73g6Xij1sBLBdQtsAx3U45SQdkFf7vGaxltnZPq1HVsPDNa4Wa /OJxGXPmqwO2XQYlpYp/vTGbFUdUjPmTsYob3gvQgU1TruZXEZnfFi1XQ4QEj1/mqDBx HofR1yEZpJsgCzVWJ98Ta6QwgI8bHk7nTq2f0krZPB0Tk90IyrJu+BVl8Rk2fZvInGLr QVNY+bAz4iAlgiaNQ7vH67tYGXH/kCk/x74OUSEEhBT66Yj+GjQZCiM2Hb7/dzl337GA 4dYg== 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=vVaZyUzzA2W9HY2GMsHZPpHUGV/K5R2zSK9G8b9oYlw=; b=X9UzHfAqUqVKntVcUcsCLBptmAo/dt3M0aUUqMX3xpfqf4i8IKA/r2fFnepSKJLScP KJ7WR4WgeqKitsfgqJ4bJvWgrmQyYPLGmLhnKVRWr4BmlJotnNgl+aFqPEaCg0FjQNUU 3LoKaKE2fQFkNECde0DgbWdohbUzeLoa/33o/afXemOOc5KWQNWunN+tH5DZ6B3JXjoz F5PvqNDh6JNzBzcBduegsf+GpndxEM9Y/7u08JVYwAkpW+txGlgQgbvQ3FR+cYGSycwi vV8eny5Yt5tgkHY8YsQpNEnGNgJX5e6KC4sdNeAZw1EcvpYmPwB5JRdv+nUD0APOUmEU Y1Ng== X-Gm-Message-State: AOAM533A7FGpKr4h+FFn4PUX6yWAJskDaChiNMGsq0uYGHBnQlyO5RLM uTXd+E5B9Y6eQ/ubSI2X8WU= X-Google-Smtp-Source: ABdhPJy26LTk1njAMqUGKE1cHwuMgKl5IOZ8+6V8v/EYzkOJm0DBOrJk0gneQyKWP2jseEWmGz7A0Q== X-Received: by 2002:a05:6512:11cf:: with SMTP id h15mr57371048lfr.138.1637583731084; Mon, 22 Nov 2021 04:22:11 -0800 (PST) Received: from localhost ([158.255.2.9]) by smtp.gmail.com with ESMTPSA id q19sm945062lfe.197.2021.11.22.04.22.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 04:22:10 -0800 (PST) From: Ihor Radchenko To: Timothy Subject: Re: [PATCH] Fontification for inline src blocks In-Reply-To: <875ysk76bo.fsf@gmail.com> References: <87pmzf4bd0.fsf@gmail.com> <87o86d7g05.fsf@gmail.com> <875ysk76bo.fsf@gmail.com> Date: Mon, 22 Nov 2021 20:23:35 +0800 Message-ID: <87a6hwpeew.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::133 (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::133; envelope-from=yantar92@gmail.com; helo=mail-lf1-x133.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=1637583885; 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=vVaZyUzzA2W9HY2GMsHZPpHUGV/K5R2zSK9G8b9oYlw=; b=eKm2G5b5QQTCJOS9+yod4DPL0qnRewidHXEh63V7q/rkf3GOGL/MxbNYcYavH6vySvjk0h xHZbcTWUc0+u+9+Vj9iVH99UYM/PsiyJK5b8m3AItWrJJiH46tTablwb509ItjRlj0gfWi xE0JrpliwUBHJDQwaN20Tmcps7qSYooEcEtKMnaVuPqJdnEWwasuUSh6pOD5WXNLuYF6d0 EDLUeeZrYiGZVZ4+qMQE2UVQvY9kargaBRRrjYuSDW1pGcDVPpzYyoMHSyovWwLhTDLFa4 UzSu4tLYIIh0Wd60rlLRVru9Wv+n5JS1qLqxh6/LN94w9+1RbuHgMzU1q3o2QA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1637583885; a=rsa-sha256; cv=none; b=AbDQtrYQBTQqoOukgIfU4RKkk0Q+pbofQ+bk2b9Oynbq/xMWuWxRVdggwQfmTnlB8WXOl/ BFuPidV5H2TGPTHS0To4BAk3NLfPYDB3LnOFg+xAMIxzciNynSpOxrHwjPEtQ4c0L1r+6G Nd8xIbnbZoFt1ed21PaoMO5zM6SdFJ/yAlHFqfE0hnZAaaLqRLHEZSWNpjzyR6C/cUVhmB +bcjUiPpJFvuE14Jz6L5UPmPJd18sZna8/9E4l0njpqauiWGSQ389TVnZeXUxi9QbRE3k+ jL3kIg183E29JTYEP6ln+WeSS4qS45m/W/bYuHyDlBeI0NPlQC4RHCYzIYRKQQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=ATRMdRhZ; 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=ATRMdRhZ; 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: 35AAB12CB3 X-Spam-Score: -3.58 X-Migadu-Scanner: scn0.migadu.com X-TUID: wJkAV2tB8OUQ Timothy writes: > See attached for a patch which just adds this face. I feel like this migh= t be > the final version of this patch so I=E2=80=99d appreciate thoughts on thi= s. I have some comments. See below. > (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? > +(defun org-fontify-inline-src-blocks (limit) > + "Try to apply `org-fontify-inline-src-blocks-1'." > + (condition-case nil > + (progn > + (org-fontify-inline-src-blocks-1 limit) > + (org-fontify-inline-src-results limit)) org-fontify-inline-src-results is not defined in this patch.=20 > + (font-lock-append-text-property lang-beg lang-end 'face 'org-met= a-line) > + (font-lock-append-text-property beg lang-beg 'face 'shadow) > + (font-lock-append-text-property beg lang-end 'face 'org-inline-s= rc-block) Is there some special reason why you apply both 'shadow and 'org-inline-src-block? What about 'org-meta-line face? Maybe 'org-meta-line should not be hard-coded? > + (setq pt (goto-char lang-end)) > + ;; `org-element--parse-paired-brackets' doesn't take a limit, so= to > + ;; prevent it searching the entire rest of the buffer we tempora= rily > + ;; narrow the active region. > + (save-restriction > + (narrow-to-region beg (min (point-max) > + limit > + (+ lang-end org-inline-src-fontify-= max-length))) > + (when (ignore-errors (org-element--parse-paired-brackets ?\[)) > + (font-lock-append-text-property pt (point) 'face 'org-inline= -src-block) > + (setq pt (point))) > + (when (ignore-errors (org-element--parse-paired-brackets ?\{)) It looks like you are repeating the job of org-element-context here. Why don't you just get the proper object? > + (remove-text-properties pt (point) '(face nil)) > + (font-lock-append-text-property pt (1+ pt) 'face '(org-block= shadow)) Do you really intend to use 'org-block and 'shadow faces here? Not 'org-inline-src-block? > +(defcustom org-inline-src-prettify-results t Looks like a stray defcustom. At least, it is not mentioned in the commit message and not used within the patch. Best, Ihor