emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Ihor Radchenko <yantar92@gmail.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: emacs-orgmode@gnu.org
Subject: Re: c47b535bb origin/main org-element: Remove dependency on ‘org-emphasis-regexp-components’
Date: Mon, 15 Nov 2021 23:20:30 +0800	[thread overview]
Message-ID: <87fsrxa1j5.fsf@localhost> (raw)
In-Reply-To: <87fsrxkahq.fsf@nicolasgoaziou.fr>

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Ihor Radchenko <yantar92@gmail.com> writes:
>
>> This commit may cause random failures when
>> org-emphasis-regexp-components is changed by user.
>
> This is not supported anyway.

Yeah. Though I have seen people changing this variable.
Maybe we should change defvar to defconst?

>> org-emph-re is calculated according to org-emphasis-regexp-components.
>> Changing org-emphasis-regexp-components can make "(when (looking-at
>> org-emph-re)" in parsers return nil. The emphasised text will still be
>> fontified, but not available in the parsed buffer.
>
> That’s exactly my point. The syntax is not meant to be configurable.
> I wrote a patch also removing ‘org-emph-re’ depedency from
> "org-element.el", but I was delayed. I just applied it.

Thanks!

>> Maybe we need to move the logic for org-emph-re from org.el to
>> org-element.el?
>
> ‘org-emph-re’ has some limitations which do not belong to syntax
> definition. There’s no point in adding it in "org-element.el".
>
> The grand scheme is to remove most "org.el" dependencies from
> "org-element.el", and move the others.

That would be great. I was thinking about unifying the grammar better.
Things like org-set-regexps-and-options define part of the grammar
non-transparently outside org-element. As a result, the new org-persist
library can be potentially broken if the user changes grammar between
Emacs session (e.g. org-off-levels-only, org-todo-keywords, etc). Keeping
all the variables that change the grammar in one place would be helpful.

Maybe we could save the complete grammar state right inside output of
org-element-parse-buffer. In the updated element cache code, I
introduced properties into org-data element. Maybe we can keep all the
important variables for the buffer grammar in org-data? That way, the
job of org-set-regexps-and-options will be done by
org-element-org-data-parser. Moreover, users exporting using ox-org will
be able to create self-sufficient Org files that can be shared without
relying on the same configuration in init.el.

>> Also, there is org-emphasis-alist. It is even defcustom, but ignored by
>> org-element.el.
>
> This variable is a defcustom for the faces, not the markers. I.e., it is
> not meant to add, remove, or change emphasis markup, but rather alter
> how they appear. IMO, this should be removed altogether: it’s up to
> a theme to set such a thing.

Unless I miss something, org-emphasis-alist is used in org-emphasise.
Though it just another reason to remove it.

Best,
Ihor


  reply	other threads:[~2021-11-15 15:20 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 [this message]
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
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=87fsrxa1j5.fsf@localhost \
    --to=yantar92@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    --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).