From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id wIhbAe+Ml2FZXgAAgWs5BA (envelope-from ) for ; Fri, 19 Nov 2021 12:39:27 +0100 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id oCTlN+6Ml2GnJAAAB5/wlQ (envelope-from ) for ; Fri, 19 Nov 2021 11:39:26 +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 63BBD1AB33 for ; Fri, 19 Nov 2021 12:39:26 +0100 (CET) Received: from localhost ([::1]:44946 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mo2En-0004m9-8V for larch@yhetil.org; Fri, 19 Nov 2021 06:39:25 -0500 Received: from eggs.gnu.org ([209.51.188.92]:51804) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mo2Cc-0004iV-7L for emacs-orgmode@gnu.org; Fri, 19 Nov 2021 06:37:10 -0500 Received: from [2a00:1450:4864:20::12a] (port=40801 helo=mail-lf1-x12a.google.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mo2CY-0006pM-Py for emacs-orgmode@gnu.org; Fri, 19 Nov 2021 06:37:09 -0500 Received: by mail-lf1-x12a.google.com with SMTP id l22so41851121lfg.7 for ; Fri, 19 Nov 2021 03:37:06 -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; bh=2Dg2ujmX+R8Jw2NnssQBZN8wb5tJU7H1opqlR4RK4jo=; b=XLx5ra9kQSzUAI/8lhrnQeJv1XkWWI9hz3H/EKHCdnPVCv5g6IkuQwbuOFua/hg5hE zRv3EzNRLXXuMSY6tbkHahqcLMetKUJFNMNsekAk9F61eAlVFicNmMcEgQL0ZWKny4/z 0k8uBPDNwhjSBovm8tlFgu9qSsnMYZzZq9VtXHf5nM04b6ntTwfinRVMlZa+n7/7nZ1L WfTVgVgWCZpWfyu+Cn6lsn3rL81BRJNJzWAfluxHAaC5Jt6N05bsiHQ7OP5MwdLjWAlt p8Y/7gAlIAzJDp8L82t6FCocXRKWLsW7CD4CLlb1+MakuJT+cEXP2+oFRe0VYAOU8qEP NNUw== 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=2Dg2ujmX+R8Jw2NnssQBZN8wb5tJU7H1opqlR4RK4jo=; b=Fjh56wC2c1GoqpwEr+yTMp4aFU0noKC8HzP9WsYhFok5bOU9EUeqGGZIO92N/ELn44 ZQ42o4MQwlWbnIYkanx/3xkbHDMc4tOXb7Ev/qCBbVUVoNdPpRqDqpAViLKYR1X6C1Ki 4kMacYVEviplxOqdkmFa7W5p7u6EoyqjbEeaE0cVLXRlJHSo17TJqF9KxLLu53gIuPrn gjT497Vciwvv2wefW41jKvGG8Pw79M4Au/8ULQzicwMKc8O2aq9UkdzqqEord1SVdimg qjc9nOvAUOrObcGaOf7FKDkIsFrF2VkJLVZp0v6koBVSptSJ86pVzv93jJau4cSVFmVh 9+IQ== X-Gm-Message-State: AOAM5305MbtwwOnkZnwrX+szTvSiTSc8McGKgj92ibP3u19fJS4vcaMu hi9q6e1/6E2JXU+LNqj+hBs= X-Google-Smtp-Source: ABdhPJy0oy1cnNt1ZIN3w7zUcT+jq0RlY+VaiRr6n4ut6gTnaIN34o6KSCRbvZrIVqw3grVvA2GGpw== X-Received: by 2002:a05:6512:3f2:: with SMTP id n18mr31972039lfq.646.1637321824978; Fri, 19 Nov 2021 03:37:04 -0800 (PST) Received: from localhost ([91.210.107.150]) by smtp.gmail.com with ESMTPSA id t23sm338389lfg.63.2021.11.19.03.37.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Nov 2021 03:37:04 -0800 (PST) From: Ihor Radchenko To: Nicolas Goaziou Subject: [PATCH] Re: c47b535bb origin/main org-element: Remove dependency on =?utf-8?Q?=E2=80=98org-emphasis-regexp-components=E2=80=99?= In-Reply-To: <8735nsv9qo.fsf@nicolasgoaziou.fr> References: <87o86mw86r.fsf@localhost> <87fsrxkahq.fsf@nicolasgoaziou.fr> <87fsrxa1j5.fsf@localhost> <878rxoa6lk.fsf@localhost> <87tug93b2a.fsf@localhost> <87y25l8wvs.fsf@nicolasgoaziou.fr> <87r1bd39ny.fsf@localhost> <8735nsv9qo.fsf@nicolasgoaziou.fr> Date: Fri, 19 Nov 2021 19:38:28 +0800 Message-ID: <87mtm09xzf.fsf@localhost> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Host-Lookup-Failed: Reverse DNS lookup failed for 2a00:1450:4864:20::12a (failed) Received-SPF: pass client-ip=2a00:1450:4864:20::12a; envelope-from=yantar92@gmail.com; helo=mail-lf1-x12a.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: Max Nikulin , emacs-orgmode@gnu.org 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=1637321966; 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=2Dg2ujmX+R8Jw2NnssQBZN8wb5tJU7H1opqlR4RK4jo=; b=RgPV/GdA7uJqbx1V7j7+z/7IKyFpZao07CH75ixleWZD4/rJ4wAtvgA13XsTt8UsrxQMBa G/0MnL0V0EYeyrDD4GZDI1mvfMZnhvOwnZUcPxPEvb4+1wHWQaRxZfUHcfTzLFrWYOjJWD xbYOgKcN2DVYYRMSeVFJyxG3k4kJfNGGru81aTKF1+HuVD5o9SZn9Sba/gqwNbnh3+VYcZ IywnPr2sVy66DqqaNTElDLRIugY+WmCd1G3O67Hd2Zsj3RVRzVffe8AQbOaKzbRS8NP2zx TL0+IZOGvyWd0h9ujfcFxDXcBNig1N3yhqiyDCDEzrxRq5iYyNVNQhnDyY/MYA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1637321966; a=rsa-sha256; cv=none; b=kfCEPU4SI+IF2n3DIBY0VO78bjbzbNb3DwCefo7pm9cY+3kIiSnfOg+dn9K7QouBO8Qe1z bxsEDez9IJgYkLpiAEX+bSq69H9PTvzLhf6UQq+L44lt6rpXMK0Plgrlbb0VZarNtK/lag 1m4tSi2zb6t7xAbPiOUpqKn7Eo/YiKldSgE6qHzJ6bfEfFYOd80828AY4tcwP0iaXaFwig AgG3uOibiyz7M54epkGuAeJvR9YISwlYfh74yYywgnzz9FPitxq6uuDkdo9EUBTKPgAzVI MLfDxhBlyZ6HvLPtYZ/Adevh9c/AAFHm4NoxQn6WmXcJdG3jDu3ebmj4BbKjbw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=XLx5ra9k; 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.06 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=XLx5ra9k; 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: 63BBD1AB33 X-Spam-Score: -3.06 X-Migadu-Scanner: scn0.migadu.com X-TUID: WIhHeiokf0di --=-=-= Content-Type: text/plain Nicolas Goaziou writes: > You can use a zero-width space to help Org sorting out the ambiguity, > for example (| denotes the zero-width space): > > /|A link [[https://orgmode.org/?oops=true][Org Mode]] > > /A code ~user|/?my-user-variable~ with slash/ Makes sense. Maybe we should also mention it in the Markup section of the manual? I attached a tentative patch. Also, part of the problem with /|A link [[https://orgmode.org/?oops=true][Org Mode]] is that the link is emphasised despite not being parser as a link by org-element. I attached a patch for our link/emphasis fontification that makes sure that fontification is always consistent with the parser. The patch might hit the performance slightly, but I do not see obvious slowdown using my 15Mb notes file. Best, Ihor --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-org-manual.org-Clarify-how-to-handle-markup-ambiguit.patch >From 3b4a857582e848e9688a49c01b853ed577dd4935 Mon Sep 17 00:00:00 2001 Message-Id: <3b4a857582e848e9688a49c01b853ed577dd4935.1637321577.git.yantar92@gmail.com> From: Ihor Radchenko Date: Fri, 19 Nov 2021 19:27:56 +0800 Subject: [PATCH] org-manual.org: Clarify how to handle markup ambiguity * doc/org-manual.org (Emphasis and Monospace): Advice users to insert zero width space when Org does not parse emphasized text correctly. --- doc/org-manual.org | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/doc/org-manual.org b/doc/org-manual.org index a38dbec4a..1db993d3d 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -10818,6 +10818,18 @@ ** Emphasis and Monospace ~org-fontify-emphasized-text~ to ~nil~. To narrow down the list of available markup syntax, you can customize ~org-emphasis-alist~. +Sometimes, Org mode has difficulties recognising markup. It usually +happens when markup marker symbols are present inside verbatim or code +blocks: + +#+begin_example +/The whole line is supposed to be marked italic, but the following +~user/?variable~ contains italics =/= marker and confuses Org parser/. +#+end_example + +You can use zero width space to help Org sorting out the ambiguity. +See [[*Escape Character]] for more details. + ** Subscripts and Superscripts :PROPERTIES: :DESCRIPTION: Simple syntax for raising/lowering text. -- 2.32.0 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-org.el-Make-emphasis-and-link-fontification-consiste.patch >From d5413e772fe6aedb8a8aa094f98c96fc20b82d3a Mon Sep 17 00:00:00 2001 Message-Id: From: Ihor Radchenko Date: Fri, 19 Nov 2021 19:13:54 +0800 Subject: [PATCH] org.el: Make emphasis and link fontification consistent with parser * lisp/org.el (org-do-emphasis-faces): (org-activate-links): Do not fontify just based on approximate regexps. Make sure the current object is emphasis. --- lisp/org.el | 62 ++++++++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 29 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index cb1b58c51..d9f073100 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -5106,12 +5106,15 @@ (defun org-do-emphasis-faces (limit) (looking-at-p org-outline-regexp-bol)))) ;; Match full emphasis markup regexp. (looking-at (if verbatim? org-verbatim-re org-emph-re)) - ;; Do not span over paragraph boundaries. - (not (string-match-p org-element-paragraph-separate - (match-string 2))) - ;; Do not span over cells in table rows. - (not (and (save-match-data (org-match-line "[ \t]*|")) - (string-match-p "|" (match-string 4)))))) + ;; Verify that we are at the right object. + (let ((object (save-excursion + (save-match-data + (goto-char (match-beginning 2)) + (org-element-context))))) + (and (memq (org-element-type object) + '(bold italic verbatim code strike-through)) + (eq (match-beginning 2) + (org-element-property :begin object)))))) (pcase-let ((`(,_ ,face ,_) (assoc marker org-emphasis-alist)) (m (if org-hide-emphasis-markers 4 2))) (font-lock-prepend-text-property @@ -5206,7 +5209,7 @@ (defun org-activate-links (limit) (eq 'org-tag face)))))) (let* ((link-object (save-excursion (goto-char start) - (save-match-data (org-element-link-parser)))) + (save-match-data (org-element-context)))) (link (org-element-property :raw-link link-object)) (type (org-element-property :type link-object)) (path (org-element-property :path link-object)) @@ -5229,29 +5232,30 @@ (defun org-activate-links (limit) ((and (pred functionp) f) (funcall f)) (_ `(:uri ,link))) 'font-lock-multiline t))) - (org-remove-flyspell-overlays-in start end) - (org-rear-nonsticky-at end) - (if (not (eq 'bracket style)) - (progn + (when (eq (org-element-type link-object) 'link) + (org-remove-flyspell-overlays-in start end) + (org-rear-nonsticky-at end) + (if (not (eq 'bracket style)) + (progn + (add-face-text-property start end face-property) + (add-text-properties start end properties)) + ;; Handle invisible parts in bracket links. + (remove-text-properties start end '(invisible nil)) + (let ((hidden + (append `(invisible + ,(or (org-link-get-parameter type :display) + 'org-link)) + properties))) + (add-text-properties start visible-start hidden) (add-face-text-property start end face-property) - (add-text-properties start end properties)) - ;; Handle invisible parts in bracket links. - (remove-text-properties start end '(invisible nil)) - (let ((hidden - (append `(invisible - ,(or (org-link-get-parameter type :display) - 'org-link)) - properties))) - (add-text-properties start visible-start hidden) - (add-face-text-property start end face-property) - (add-text-properties visible-start visible-end properties) - (add-text-properties visible-end end hidden) - (org-rear-nonsticky-at visible-start) - (org-rear-nonsticky-at visible-end))) - (let ((f (org-link-get-parameter type :activate-func))) - (when (functionp f) - (funcall f start end path (eq style 'bracket)))) - (throw :exit t))))) ;signal success + (add-text-properties visible-start visible-end properties) + (add-text-properties visible-end end hidden) + (org-rear-nonsticky-at visible-start) + (org-rear-nonsticky-at visible-end))) + (let ((f (org-link-get-parameter type :activate-func))) + (when (functionp f) + (funcall f start end path (eq style 'bracket)))) + (throw :exit t)))))) ;signal success nil)) (defun org-activate-code (limit) -- 2.32.0 --=-=-=--