* Emphasis issues with special blocks and latex
@ 2023-02-14 9:14 User Name
2023-02-16 12:26 ` Ihor Radchenko
0 siblings, 1 reply; 2+ messages in thread
From: User Name @ 2023-02-14 9:14 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1871 bytes --]
I am having several issues with the fontification of emphasis markers in
org-special-blocks and inside latex equations in my org-files.
I have changed `org-emphasis-regexp-components` to be the following...
```
(with-eval-after-load 'org
(setcar org-emphasis-regexp-components "\t('\"{[:alpha:]:-“”\[\\") ;;
chars for prematch
(setcar (nthcdr 1 org-emphasis-regexp-components)
"\][:alpha:]-_^[:space:]:\t.,!?;''“”\")}/\\“”") ;; chars for postmatch
(setcar (nthcdr 2 org-emphasis-regexp-components) "\\\\\t\r\n,\"") ;;
forbidden chars
(setcar (nthcdr 3 org-emphasis-regexp-components) ".") ;; body
(setcar (nthcdr 4 org-emphasis-regexp-components) 5) ;; max newlines
(org-set-emph-re 'org-emphasis-regexp-components
org-emphasis-regexp-components))
```
I would like to be able to intersperse emphasis markers inside of strings,
which is why I included alphabetical characters for pre and post-match. I'd
like to be able to have *w*or*d* only bold the w & the d if possible, and
to be able to use backslashes between emphasized words (eg. ideally
=this=/d *be* /so//*cool*! should codify "this", italicize /so/, and bold
"cool*).
The main issue I get is that special-block metalines seem to get
font-locked (eg. `#+begin_theorem` becomes `#+begintheorem` and the
metalines themselves seem to cause the underlining of the contents within
the block. Inside latex equations, I end up with fontlocking if I don't
include spaces between underscores, pluses, minuses, or equal signs. I am
wondering if there is a way to fix this by adding more forbidden characters
(ie. forbid `#+begin_`, and `#+attr_latex` from being or causing emphasis,
and forbid emphasis between $$ $$, \begin{} \end{}, \( \), \[ \], $ $) or
possibly to include look-around using visual-regexp-sterioids.el.
Thanks in advance.
[-- Attachment #2: Type: text/html, Size: 2138 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Emphasis issues with special blocks and latex
2023-02-14 9:14 Emphasis issues with special blocks and latex User Name
@ 2023-02-16 12:26 ` Ihor Radchenko
0 siblings, 0 replies; 2+ messages in thread
From: Ihor Radchenko @ 2023-02-16 12:26 UTC (permalink / raw)
To: User Name; +Cc: emacs-orgmode
User Name <name58564@gmail.com> writes:
> I am having several issues with the fontification of emphasis markers in
> org-special-blocks and inside latex equations in my org-files.
>
> I have changed `org-emphasis-regexp-components` to be the following...
I advice against playing with this variable. It only affects
fontification and not the parser. And current Org's fontification is
fragile. It will be more reliable to write a custom font-lock keyword if
you want Emacs to highlight things differently.
--
Ihor Radchenko // yantar92,
Org mode contributor,
Learn more about Org mode at <https://orgmode.org/>.
Support Org development at <https://liberapay.com/org-mode>,
or support my work at <https://liberapay.com/yantar92>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-02-16 12:28 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-14 9:14 Emphasis issues with special blocks and latex User Name
2023-02-16 12:26 ` Ihor Radchenko
Code repositories for project(s) associated with this public 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).