Re: Should we obsolete org-emphasis-alist? (was: [PATCH v5] org.el: Warning for unsupported markers in `org-set-emphasis-alist')

2023-02-09 Thread Max Nikulin

On 07/02/2023 17:47, Ihor Radchenko wrote:


Upon looking closer, `org-set-emph-re' is not affected by the value of
`org-emphasis-alist' with a single exception when the value is nil.


You are right, it is result of the following commit:

9fb2e047d 2016-12-08 09:44:26 +0100 Nicolas Goaziou: Split `org-emph-re' 
and `org-verbatim-re'



I think that we should simply obsolete `org-emphasis-alist' and
introduce individual faces for emphasis.


I agree with your conclusions and proposal.

If you are close to merging fontification based on org-element then we 
may just discard this patch. Otherwise it may be merged with minimal 
modifications:

- Do not add the watcher
- Instead of `org-set-emph-re' use a lambda calling new 
`org-emphasis-alist--check-value` as the :set attribute of `defcustom'.

- Fix description of verbatim tag.





Re: Should we obsolete org-emphasis-alist? (was: [PATCH v5] org.el: Warning for unsupported markers in `org-set-emphasis-alist')

2023-02-07 Thread Timothy
Hi Ihor,

> I think that we should simply obsolete `org-emphasis-alist’ and
> introduce individual faces for emphasis.

I’m in favour of this approach.

All the best,
Timothy

-- 
Timothy (‘tecosaur’/‘TEC’), Org mode contributor.
Learn more about Org mode at .
Support Org development at ,
or support my work at .


Should we obsolete org-emphasis-alist? (was: [PATCH v5] org.el: Warning for unsupported markers in `org-set-emphasis-alist')

2023-02-07 Thread Ihor Radchenko
Max Nikulin  writes:

>> +(add-variable-watcher 'org-emphasis-alist #'org-emphasis-alist--check-value)
>
> Thinking more I have realized that I am in doubts if 
> `add-variable-watcher' is appropriate tool in this particular case. The 
> only way to get some effect from change of `org-emphasis-alist' is to 
> call `org-set-emph-re' (its :set function), so it should be enough to 
> call `org-emphasis-alist--check-value' from `org-set-emph-re'.

Upon looking closer, `org-set-emph-re' is not affected by the value of
`org-emphasis-alist' with a single exception when the value is nil.

> I have no idea what should be considered as best practice: should 
> `set-default-toplevel-value' be combined with changes of `org-emph-re' 
> as it is done in current code or `org-set-emph-re' should be split into 
> the function that modifies `org-emph-re' (so it can be called 
> separately) and a tiny setter (that may be defined as lambda this case) 
> that calls the new function and `set-default-toplevel-value'.

I now reviewed the usage of `org-emphasis-alist' and setting/changing
the value has the following effects:

1. nil (and only nil) value makes `org-emph-re' and `org-verbatim-re'
   nil. Otherwise, these regexps are not affected.

   Also, `org-emph-re' only affects fontification.
   `org-verbarim-re' affects fontification and
   `org-in-verbatim-emphasis'. The latter should be fixed to use
   org-element API.

2. The value affects `org-mode-transpose-word-syntax-table'. Should be
   fixed - parser is not affected by `org-emphasis-alist'.

3. Fontification is affected in `org-do-emphasis-faces'.

4. Emphasis selection dialogue in `org-emphasize' is only using the
   emphasis from the alist.

That's all.

I think that we should simply obsolete `org-emphasis-alist' and
introduce individual faces for emphasis.

-- 
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at .
Support Org development at ,
or support my work at