emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Possible bug? Combine emphasis marker faces?
@ 2021-09-28 15:14 Protesilaos Stavrou
  2021-09-28 16:54 ` Juan Manuel Macías
  2021-10-03  8:43 ` Ihor Radchenko
  0 siblings, 2 replies; 3+ messages in thread
From: Protesilaos Stavrou @ 2021-09-28 15:14 UTC (permalink / raw)
  To: emacs-orgmode

Hello everyone,

I have noticed that it is not possible to combine org-emphasis-alist
characters.  When applying multiple types of emphasis, the face
corresponding to the outermost pair overrides its innermost counterparts.

For example, */emphasise/* will render with the 'bold' face, while
/*emphasise*/ will use the 'italic' face.

Looking at the code, this seems to be intentional or unavoidable, while
I do not know of a way to blend faces dynamically.

Is there a way to get composite styles?  Such as bold and italic or
verbatim and underline, etc.?

All the best,
Protesilaos (or simply "Prot")

* * *

M-x org-version: Org mode version 9.4.4 (release_9.4.4 @
/usr/share/emacs/28.0.50/lisp/org/)

M-x emacs-version: GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+
Version 3.24.30, cairo version 1.17.4) of 2021-09-28

-- 
Protesilaos Stavrou
https://protesilaos.com


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Possible bug? Combine emphasis marker faces?
  2021-09-28 15:14 Possible bug? Combine emphasis marker faces? Protesilaos Stavrou
@ 2021-09-28 16:54 ` Juan Manuel Macías
  2021-10-03  8:43 ` Ihor Radchenko
  1 sibling, 0 replies; 3+ messages in thread
From: Juan Manuel Macías @ 2021-09-28 16:54 UTC (permalink / raw)
  To: Protesilaos Stavrou; +Cc: orgmode

Hi Protesilaos,

Protesilaos Stavrou writes:

> Is there a way to get composite styles?  Such as bold and italic or
> verbatim and underline, etc.?

A somewhat dirty solution (without patching the code) could be
evaluating highlight-regexp, for example as a local variable:

#+begin_src emacs-lisp
  (defface my/org-it-bold
    '((t :slant italic :bold t))
    "")

(highlight-regexp "\\([-[:space:]('\"{]\\|^\\)\\(\\([*/_+]\\)\\([*/_+]\\)\\([^[:space:]]\\|[^[:space:]].*?\\(?:
.*?\\)\\{0,15\\}[^[:space:]]\\)\\3\\)\\([-[:space:].,:!?;'\")}\\[]\\|$\\)" 'my/org-it-bold)
#+end_src

Best regards,

Juan Manuel 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Possible bug? Combine emphasis marker faces?
  2021-09-28 15:14 Possible bug? Combine emphasis marker faces? Protesilaos Stavrou
  2021-09-28 16:54 ` Juan Manuel Macías
@ 2021-10-03  8:43 ` Ihor Radchenko
  1 sibling, 0 replies; 3+ messages in thread
From: Ihor Radchenko @ 2021-10-03  8:43 UTC (permalink / raw)
  To: Protesilaos Stavrou; +Cc: emacs-orgmode

Protesilaos Stavrou <info@protesilaos.com> writes:

> Hello everyone,
>
> I have noticed that it is not possible to combine org-emphasis-alist
> characters.  When applying multiple types of emphasis, the face
> corresponding to the outermost pair overrides its innermost counterparts.
>
> For example, */emphasise/* will render with the 'bold' face, while
> /*emphasise*/ will use the 'italic' face.

Confirmed

> Looking at the code, this seems to be intentional or unavoidable, while
> I do not know of a way to blend faces dynamically.
>
> Is there a way to get composite styles?  Such as bold and italic or
> verbatim and underline, etc.?

org-element-context does return nested emphasis, so it is certainly
possible to combine composite styles (at least, during export).
Fontification code does not work with elements though and I do not see
an easy way to change it.

Rewriting fontification using org-element API would eliminate this type
of issues.  However, I am not sure about performance (maybe with
org-element-cache?).

Best,
Ihor


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-10-03  8:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-09-28 15:14 Possible bug? Combine emphasis marker faces? Protesilaos Stavrou
2021-09-28 16:54 ` Juan Manuel Macías
2021-10-03  8:43 ` 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).