From: Ihor Radchenko <email@example.com> To: Max Nikulin <firstname.lastname@example.org>, Nicolas Goaziou <email@example.com> Cc: firstname.lastname@example.org Subject: Re: c47b535bb origin/main org-element: Remove dependency on ‘org-emphasis-regexp-components’ Date: Thu, 18 Nov 2021 20:25:33 +0800 [thread overview] Message-ID: <87tug93b2a.fsf@localhost> (raw) In-Reply-To: <email@example.com> [-- Attachment #1: Type: text/plain, Size: 2569 bytes --] Max Nikulin <firstname.lastname@example.org> writes: > These regexps will always fail under some conditions, since it is not > strict markup. An example is emphasis terminated inside link target > > /A link [[https://orgmode.org/?oops=true][Org Mode]] Your example actually reveals a much bigger issue with current element parser. Even though the link is fontified by Org, if you run org-element-context on the link, it will return nil. The parsed sentence will look like: <begin italic>/A link [[https://orgmode.org/<end italic><begin ordinary text - it is not a link!>?oops=true][Org Mode]]<end of ordinary text> The reason behind is partially regexps used to detect emphasised text and partially the way our parser works - no intersected objects are allowed. My intuition says that the current parser behaviour is not correct. It would make more sense to prioritise link over italics. However, it would require a major change in the parser - instead of a single pass, the parser may parse different types of objects sequentially. The emphasis objects should come last avoiding the markers to have different parents. Nicolas, WDYT? >> Maybe something like the attached? > > Thank you, Ihor. Another reason why I have not tried to do it myself is > that it is necessary to test behavior for users who customized markers. > The change should not be fatal for them. I have not checked it with you > patch yet. > > I was considering some way to warn users if improper customization is > detected (unexpected marker is noticed). It should be noticeable to make > user aware of export issues but not too annoying. > >> +The characters in the alist must not be changed. They do not affect >> +the actual Org syntax, just fontification. > > Since this is known point of abuses, maybe stronger words are appropriate. > > Do not change makers and do not add new ones to use custom markers for > existing styles or to introduce new styles. Org syntax is not meant to > be configurable and such modifications will not work with export. If you > are interested in fontification of custom markup inside Emacs only, > there are other ways to achieve desired effect. > ... > In addition, I do not like the following phrase in the manual: > >> To narrow down the list of available markup syntax, you can customize org-emphasis-alist. I updated the patch dropping your last suggested sentence in the docstring. I find it not very helpful for the user. We should either say nothing (as in the patch) or give a concrete reference how to "achieve the desired effect". Best, Ihor [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: 0001-org-emphasis-alist-Update-defcustom-making-emphasis-.patch --] [-- Type: text/x-diff, Size: 3276 bytes --] From c950768bc08b4cae07ba3cb451d8af0abfec7dc8 Mon Sep 17 00:00:00 2001 Message-Id: <email@example.com> From: Ihor Radchenko <firstname.lastname@example.org> Date: Tue, 16 Nov 2021 15:40:35 +0800 Subject: [PATCH] org-emphasis-alist: Update defcustom making emphasis characters constant * lisp/org.el (org-emphasis-alist): Mention that emphasis characters should not be changed by user. Update the defcustom type accordingly. * doc/org-manual.org (Emphasis and Monospace): Update the referece to `org-emphasis-alist'. --- doc/org-manual.org | 5 +++-- lisp/org.el | 41 ++++++++++++++++++++++++++++++++++++----- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/doc/org-manual.org b/doc/org-manual.org index c4bb7ef30..9fea2c42e 100644 --- a/doc/org-manual.org +++ b/doc/org-manual.org @@ -10814,9 +10814,10 @@ ** Emphasis and Monospace exported verbatim. #+vindex: org-fontify-emphasized-text +#+vindex: org-emphasis-alist To turn off fontification for marked up text, you can set -~org-fontify-emphasized-text~ to ~nil~. To narrow down the list of -available markup syntax, you can customize ~org-emphasis-alist~. +~org-fontify-emphasized-text~ to ~nil~. For more fine-tuned +fontification, you can customize ~org-emphasis-alist~. ** Subscripts and Superscripts :PROPERTIES: diff --git a/lisp/org.el b/lisp/org.el index 603b57279..00ac00ab3 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -3833,18 +3833,49 @@ (defcustom org-emphasis-alist marker characters and the face to be used by font-lock for highlighting in Org buffers. +Do not change the characters and do not add new ones to use custom +markers for existing styles or to introduce new styles. Org syntax is +not meant to be configurable and such modifications will not work with +export. + You need to reload Org or to restart Emacs after customizing this." :group 'org-appearance :set 'org-set-emph-re :version "24.4" :package-version '(Org . "8.0") - :type '(repeat + :type '(list (list - (string :tag "Marker character") + (const "*") + (choice + (face :tag "Bold emphasis face") + (plist :tag "Bold emphasis face property list"))) + (list + (const "/") + (choice + (face :tag "Italic emphasis face") + (plist :tag "Italic emphasis face property list"))) + (list + (const "_") + (choice + (face :tag "Underline emphasis face") + (plist :tag "Underline emphasis face property list"))) + (list + (const "=") + (choice + (face :tag "Verbatim emphasis face") + (plist :tag "Verbatim emphasis face property list")) + (const verbatim)) + (list + (const "~") + (choice + (face :tag "Code emphasis face") + (plist :tag "Code emphasis face property list")) + (const verbatim)) + (list + (const "+") (choice - (face :tag "Font-lock-face") - (plist :tag "Face property list")) - (option (const verbatim))))) + (face :tag "Strike-through emphasis face") + (plist :tag "Strike-through emphasis face property list"))))) (defvar org-protecting-blocks '("src" "example" "export") "Blocks that contain text that is quoted, i.e. not processed as Org syntax. -- 2.32.0
next prev parent reply other threads:[~2021-11-18 12:24 UTC|newest] Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-11-15 0:53 Ihor Radchenko 2021-11-15 9:56 ` Nicolas Goaziou 2021-11-15 15:20 ` Ihor Radchenko 2021-11-15 16:25 ` Max Nikulin 2021-11-16 7:43 ` Ihor Radchenko 2021-11-16 21:56 ` Samuel Wales 2021-11-16 22:16 ` Samuel Wales 2021-11-17 16:44 ` Max Nikulin 2021-11-17 22:44 ` Samuel Wales 2021-11-18 12:25 ` Ihor Radchenko [this message] 2021-11-18 12:35 ` Nicolas Goaziou 2021-11-18 12:55 ` Ihor Radchenko 2021-11-19 8:18 ` Nicolas Goaziou 2021-11-19 11:38 ` [PATCH] " Ihor Radchenko 2021-11-19 12:37 ` Nicolas Goaziou 2021-11-19 13:53 ` Ihor Radchenko 2021-11-20 18:25 ` Nicolas Goaziou 2021-11-21 9:28 ` Ihor Radchenko 2021-11-22 18:44 ` Nicolas Goaziou 2021-11-23 14:28 ` Ihor Radchenko 2021-11-27 12:16 ` org parser and priorities of inline elements Max Nikulin 2021-11-27 19:02 ` Nicolas Goaziou 2021-11-19 16:34 ` c47b535bb origin/main org-element: Remove dependency on ‘org-emphasis-regexp-components’ Max Nikulin 2021-11-20 12:02 ` Max Nikulin 2021-11-21 10:01 ` Ihor Radchenko 2021-11-21 16:36 ` Max Nikulin 2021-11-23 17:05 ` [PATCH] org.el: Warning for unsupported markers in `org-set-emphasis-alist' Max Nikulin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style List information: https://www.orgmode.org/ * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=87tug93b2a.fsf@localhost \ --email@example.com \ --firstname.lastname@example.org \ --email@example.com \ --firstname.lastname@example.org \ --subject='Re: c47b535bb origin/main org-element: Remove dependency on ‘org-emphasis-regexp-components’' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
Code repositories for project(s) associated with this inbox: https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).