minad / org-modern

:unicorn: Modern Org Style
GNU General Public License v3.0
1.55k stars 48 forks source link

Invalid face box error in `org-modern--update-label-face` after Emacs@30 update #161

Closed LuciusChen closed 11 months ago

LuciusChen commented 11 months ago

Describe the Issue

After the latest update(commit dcd755dabcf9ef95d6d0534c11c668f44c6f89c2) to Emacs@30, the org-modern--update-label-face function in the org-modern plugin seems to generate an invalid :box attribute value, causing the redisplay function to throw an error.

Error Message

redisplay--pre-redisplay-functions: (error "Invalid face box" :color "#f6fff9" :line-width (0 . -3))
minad commented 11 months ago

Can you please report this problem upstream? A line-width of 0 should not necessarily be considered invalid, since we may want to draw a border around text only above/below or to the left/right of the text.

minad commented 11 months ago

I've looked into this and it seems that 0 should have never been allowed, see https://lists.gnu.org/archive/html/bug-gnu-emacs/2023-11/msg01236.html. It is a bit unfortunate since we lose styling opportunities this way and there is no real reason why 0 should be disallowed. The display code works even for 0. :(

jdtsmith commented 11 months ago

I just encountered this same bug on master while testing other things:

Debugger entered--Lisp error: (error "Invalid face box" :color "#287a287a287a" :line-width (0 . -3))
  set-face-attribute(org-modern-label nil :box (:color "#287a287a287a" :line-width (0 . -3)))
  org-modern--update-label-face()
  org-modern--pre-redisplay(#<window 3 on test2.org>)
  run-hook-with-args(org-modern--pre-redisplay #<window 3 on test2.org>)
  redisplay--pre-redisplay-functions(t)
  redisplay_internal\ \(C\ function\)()
minad commented 11 months ago

@jdtsmith The issue is fixed in org-modern 1.1.

mrdylanyin commented 3 days ago

@minad In Emacs 30.92, I face the issue

redisplay--pre-redisplay-functions: (error "Invalid face box" :color "#242730" :line-width (-1 . -0.3))