emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Weird face behavior with org-hide-emphasis-markers enabled
@ 2020-02-04 22:11 D
  2020-02-04 23:22 ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: D @ 2020-02-04 22:11 UTC (permalink / raw)
  To: emacs-orgmode

Hi all,

maybe I overlooked something in the archives, but I can't find this
issue having been brought up yet.  org-hide-emphasis-markers has a
strange interaction with faces like org-code: when trying to draw a box
around an emphasized expression it does not draw the right border.

Cheers,
D.

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

* Re: Weird face behavior with org-hide-emphasis-markers enabled
  2020-02-04 22:11 Weird face behavior with org-hide-emphasis-markers enabled D
@ 2020-02-04 23:22 ` Bastien
  2020-02-04 23:30   ` D
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2020-02-04 23:22 UTC (permalink / raw)
  To: D; +Cc: emacs-orgmode

Hi,

D <d.williams@posteo.net> writes:

> org-hide-emphasis-markers has a
> strange interaction with faces like org-code: when trying to draw a box
> around an emphasized expression it does not draw the right border.

Can you provide an emacs and org version, the value of the variables
at stake and an reproducible example?

Thanks,

-- 
 Bastien

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

* Re: Weird face behavior with org-hide-emphasis-markers enabled
  2020-02-04 23:22 ` Bastien
@ 2020-02-04 23:30   ` D
  2020-02-12 17:24     ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: D @ 2020-02-04 23:30 UTC (permalink / raw)
  To: Bastien, emacs-orgmode

> Can you provide an emacs and org version, the value of the variables
> at stake and an reproducible example?

Hi,

naturally, I just wasn't at all sure I just overlooked something obvious
and it's actually common knowledge.

Naturally, using emacs -Q

GNU Emacs 26.3 (build 1, x86_64-redhat-linux-gnu, GTK+ Version 3.24.13)
of 2019-12-10

Org mode version 9.1.9 (release_9.1.9-65-g5e4542)

minimal setup:
(setq org-hide-emphasis-markers t)
(set-face-attribute 'org-code nil :box '(:line-width 1))

an example file mwe.org:
~sample text~

This reproduces the issue reliably.

Cheers,
D.

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

* Re: Weird face behavior with org-hide-emphasis-markers enabled
  2020-02-04 23:30   ` D
@ 2020-02-12 17:24     ` Bastien
  2020-02-12 18:19       ` D
  0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2020-02-12 17:24 UTC (permalink / raw)
  To: D; +Cc: emacs-orgmode

Hi,

D <d.williams@posteo.net> writes:

> Org mode version 9.1.9 (release_9.1.9-65-g5e4542)
>
> minimal setup:
> (setq org-hide-emphasis-markers t)
> (set-face-attribute 'org-code nil :box '(:line-width 1))
>
> an example file mwe.org:
> ~sample text~
>
> This reproduces the issue reliably.

I can reproduce this issue but I have no clue what can be wrong in
Org.  Perhaps you can submit this to emacs-devel@gnu.org.

-- 
 Bastien

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

* Re: Weird face behavior with org-hide-emphasis-markers enabled
  2020-02-12 17:24     ` Bastien
@ 2020-02-12 18:19       ` D
  2020-02-12 22:47         ` D
  0 siblings, 1 reply; 7+ messages in thread
From: D @ 2020-02-12 18:19 UTC (permalink / raw)
  To: Bastien, emacs-orgmode

Hi,

On 12.02.20 18:24, Bastien wrote:
> I can reproduce this issue but I have no clue what can be wrong in
> Org.  Perhaps you can submit this to emacs-devel@gnu.org.
Very strange indeed.  In that case I'll try poking around the code a bit
more (I think there is a lot I can learn from investigating org's code
base) and relay the issue to emacs-devel if I find nothing helpful.

I'll report back in a few days!

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

* Re: Weird face behavior with org-hide-emphasis-markers enabled
  2020-02-12 18:19       ` D
@ 2020-02-12 22:47         ` D
  2020-02-12 23:11           ` Bastien
  0 siblings, 1 reply; 7+ messages in thread
From: D @ 2020-02-12 22:47 UTC (permalink / raw)
  To: Bastien, emacs-orgmode

Hi,

After some I found the culprit!  The issue arises from
org-do-emphasis-faces.  The bug is caused by the line

(font-lock-prepend-text-property
  (match-beginning 2) (match-end 2) 'face face)

which makes the surrounding "~"s part of the box, combined with

(add-text-properties (match-end 4) (match-beginning 5)
  '(invisible org-link))

setting them invisible.  This appears to confuse Emacs.  Anything along
the lines of

(let ((num (if org-hide-emphasis-markers 4 2)))
  (font-lock-prepend-text-property
   (match-beginning num) (match-end num) 'face face))

should fix the issue.

To demonstrate the behavior, I created a MWE function reproducing the bug.

(defun mwe (start end)
  "Reproduce a weird fontification behaviour cutting off boxes."
  (interactive "r")
  (font-lock-prepend-text-property
   start end 'face '(:box (:line-width 3 :color "grey")))
  (add-text-properties (1- end) end '(invisible org-link)))


Hope that is helpful,
D.

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

* Re: Weird face behavior with org-hide-emphasis-markers enabled
  2020-02-12 22:47         ` D
@ 2020-02-12 23:11           ` Bastien
  0 siblings, 0 replies; 7+ messages in thread
From: Bastien @ 2020-02-12 23:11 UTC (permalink / raw)
  To: D; +Cc: emacs-orgmode

D <d.williams@posteo.net> writes:

> After some I found the culprit!  The issue arises from
> org-do-emphasis-faces.

Fixed in maint, following your suggestion.  Thanks!

-- 
 Bastien

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

end of thread, other threads:[~2020-02-12 23:11 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-04 22:11 Weird face behavior with org-hide-emphasis-markers enabled D
2020-02-04 23:22 ` Bastien
2020-02-04 23:30   ` D
2020-02-12 17:24     ` Bastien
2020-02-12 18:19       ` D
2020-02-12 22:47         ` D
2020-02-12 23:11           ` Bastien

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).