From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp10.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id wON3IP75ZGLhNgEAbAwnHQ (envelope-from ) for ; Sun, 24 Apr 2022 09:19:26 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp10.migadu.com with LMTPS id MBejH/75ZGJ+cwAAG6o9tA (envelope-from ) for ; Sun, 24 Apr 2022 09:19:26 +0200 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 092DBFBA for ; Sun, 24 Apr 2022 09:19:26 +0200 (CEST) Received: from localhost ([::1]:34924 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1niWWi-0000Gz-KW for larch@yhetil.org; Sun, 24 Apr 2022 03:19:24 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:39388) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1niWWA-0000Gk-IC for emacs-orgmode@gnu.org; Sun, 24 Apr 2022 03:18:50 -0400 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]:44951) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1niWW8-00024w-Qz for emacs-orgmode@gnu.org; Sun, 24 Apr 2022 03:18:50 -0400 Received: by mail-pg1-x531.google.com with SMTP id i63so10816146pge.11 for ; Sun, 24 Apr 2022 00:18:48 -0700 (PDT) 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; bh=HbOPv+YbyOjGLJqqOMzDY7Qj489mQN+n9VckEzxR91I=; b=X8pFV0916eUontkeXqGPIAWglQ2fR3DuPJFpFe6bbzb+m0QugmYb/t4pFUAi5kT48C dThGlHiUGsK0lqwPH41v+UnqnJwdLnpjYs515m21VPNAAo3WxLoozihrQC8VzF0FnsQy CjI5Qh3WFp5wOcTV1WoP965eHVlcscTK+xED/sGTC35Nlz8MHYGfc1sQvnWDMKD05KHX jJcZexZ3/6H9DCQ6AM48uePIrgpJMQ9/ccZSYXZTr1qYBnXspkU59ZFXv7lMeJJLc4g0 /icGi1rmd9Jg4MgJ+pO/NxBonFMaGkFldQGTgR0YVk08gbfGWVU4wf1mF8XD+PZsCYr0 O2Cg== 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; bh=HbOPv+YbyOjGLJqqOMzDY7Qj489mQN+n9VckEzxR91I=; b=fCxJo3i37ynSi46+a1fUpsah+DmKveREz7Av91k40mWsDIj3TnpDnWE7bB0MUN3NP7 g/1sk2DgnWEiUB6t0HeBws5cl3fUVzc2JaDkgWJMfR/WQTVvk8AWDD/qpFTBivcC04jW n0BOIXsOOc7W/smfVzgGbRQITqn7yIVQ/1+kBFbPGpXOT7Yed+OYb7MuXu0JaFxvJARU qMoYg15+CPkaKH0ITgnvxuLo9ehgeUqvD14UTlCwBZnRmlZ/jCNZprMxXb1SpmhrtYb1 uM02YcOQPHeJuJx8by+ENWmpDhvdAcmteaO+7xIFy1Typ6HFjeu/kiuThHy3PJBT+8Za aFyg== X-Gm-Message-State: AOAM533AQrlvJpjPZm9ryG0iEBjqSXvBLfDmXRBfba6MKVa2lPKLpc5v sd6CAw0uvNo/nYehKXQkCWw= X-Google-Smtp-Source: ABdhPJwETUzdXoKEz8Zru2tXIgaKUwqrGkxUHpcCXjrChYoKrWHq12q++FsHbikJ68KysAmI1W72Ug== X-Received: by 2002:a05:6a00:2392:b0:4fa:dcd2:5bc1 with SMTP id f18-20020a056a00239200b004fadcd25bc1mr13184055pfc.8.1650784727292; Sun, 24 Apr 2022 00:18:47 -0700 (PDT) Received: from localhost ([211.22.184.184]) by smtp.gmail.com with ESMTPSA id h19-20020a632113000000b0039d9c5be7c8sm6323671pgh.21.2022.04.24.00.18.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 24 Apr 2022 00:18:46 -0700 (PDT) From: Ihor Radchenko To: Nicolas Goaziou Subject: Re: overlap between cite syntax and link activation In-Reply-To: <87levxavtb.fsf@nicolasgoaziou.fr> References: <87levxavtb.fsf@nicolasgoaziou.fr> Date: Sun, 24 Apr 2022 15:19:39 +0800 Message-ID: <874k2jne2c.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2607:f8b0:4864:20::531; envelope-from=yantar92@gmail.com; helo=mail-pg1-x531.google.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 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, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 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: org-mode-email , Bruce D'Arcus , John Kitchin Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1650784766; 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:dkim-signature; bh=HbOPv+YbyOjGLJqqOMzDY7Qj489mQN+n9VckEzxR91I=; b=f6VGskAJJkJk34ya0wbLwf4qovATN0R5B1UXc52obeSOn2OC2a3lWxFTbDiFePoNeGexhl +sfC36lUaj15ddZAEZ9rdOrIgSz74+V/UQ1pctqiVdnT6ug84ESu0Yse7lpdUwsEztgFRm edI1UaDbLrllSwX9R3tvOfNma2twq7nH+eReLVTddd8fI0TmHLiuY5TKn+m3t1NGTgXBrh dlvpET88KZ1hOlL1X/JApuURb11gSFZuGptKfNRsMswIgiPUpttguz25N18dR/oIlcdYh0 sEmpVl0GwhiIy3OHFxlXW36vbSK/qcJkvdT285+F76YCY4YbQeH4CInjnjlmPg== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1650784766; a=rsa-sha256; cv=none; b=fjrP7ayx4XwK+UYOOp9V7690lPoa7hQ3j8tdlOF/S4XEskAaVlTNLhwT4BhSPW27F4yE5U H4mDAIZcrOmoXq7FkDI/hS11dX3lPqTR5l9DUW87rtTJaljrdtD7STZSSnGEYfFhlFTQn4 qffybZ1fcCPq9V37iNBUsiTy0tpcTRiyxy3taXc+3Jl4CZfclWVL28sdhRt7KqCW1oo95u TVoCnkwemYKScMk+OiR1S6bfdJkyQs/l43r4M6ODMLSKvf3EyenXrTOCCXvM/8Af78LJhb g01zpWWqYEvlyNeLo8B/1OQ58JU7GTUlLVCgftZGUCz4tIl34dzBrxNs6o6v+A== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=X8pFV091; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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: 6.68 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gmail.com header.s=20210112 header.b=X8pFV091; dmarc=fail reason="SPF not aligned (relaxed)" header.from=gmail.com (policy=none); 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: 092DBFBA X-Spam-Score: 6.68 X-Migadu-Scanner: scn1.migadu.com X-TUID: 3xk46JnzWbdl --=-=-= Content-Type: text/plain Nicolas Goaziou writes: >> It's the second of the two stoppers that John identified. >> >> He seems to have reported a related issue last August, but it slipped >> through the cracks. >> >> https://lists.gnu.org/archive/html/emacs-orgmode/2021-08/msg00303.html > A long-term solution would be to apply fontification on top of parsed > data exclusively. IIRC, I think Ihor started to work on something like > this, but I don't know about the current state of that project. Yeah, but I afraid that I will have to implement object-level caching to get sustainable performance. Currently, I got something semi-working in https://github.com/yantar92/org/tree/feature/org-font-lock-element, but it still chocks on large paragraphs with a lot of emphasis objects. > One short-term solution would be to use the same function to fontify > links and cites. I.e., "org.el" could define > `org-activate-cites-and-links', which in turn, would dispatch work to > either `org-activate-links' or `org-cite-activate'. A quick temporary fix could be like the attached. Or checking (org-element-context) instead of direct call to citation parser. Best, Ihor --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-org-cite-activate-Temporary-fix-to-not-fontify-links.patch >From 033677f02141f498ca3e1a84e85bb4c9a6d189c9 Mon Sep 17 00:00:00 2001 Message-Id: <033677f02141f498ca3e1a84e85bb4c9a6d189c9.1650784539.git.yantar92@gmail.com> From: Ihor Radchenko Date: Sun, 24 Apr 2022 15:14:26 +0800 Subject: [PATCH] org-cite-activate: Temporary fix to not fontify links as citations * lisp/oc.el (org-cite-activate): Use heuristics to check previous char to determine if current match is not citation, but link. --- lisp/oc.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/oc.el b/lisp/oc.el index 360f1fadc..147bda368 100644 --- a/lisp/oc.el +++ b/lisp/oc.el @@ -1214,7 +1214,9 @@ (defun org-cite-activate (limit) #'org-cite-fontify-default))) (when (re-search-forward org-element-citation-prefix-re limit t) (let ((cite (org-with-point-at (match-beginning 0) - (org-element-citation-parser)))) + (and (or (bolp) + (not (eq ?\[ (char-before)))) + (org-element-citation-parser))))) (when cite (funcall activate cite) ;; Move after cite object and make sure to return -- 2.35.1 --=-=-=--