abougouffa / minemacs

MinEmacs: an Emacs configuration framework for daily use
https://abougouffa.github.io/minemacs/
MIT License
143 stars 16 forks source link

prevent-org-source-block-face-from-bleeding-out-in-fold #58

Closed donneyluck closed 1 year ago

donneyluck commented 1 year ago

hi @abougouffa i have the same problem https://emacs.stackexchange.com/questions/52324/prevent-org-source-block-face-from-bleeding-out-in-fold https://debbugs.gnu.org/cgi/bugreport.cgi?bug=52587 maybe a bug

my solution


(defun get-theme-background-color ()
  (cdr (assoc 'background-color (frame-parameters))))

(defun set-org-block-end-line-color ()
  "Set org-src-block face background color to current theme's background color."
  (interactive)
  (let ((background-color (get-theme-background-color))) ; 
    (set-face-attribute 'org-block-end-line nil :background background-color))) ; 

(advice-add 'consult-theme :after (lambda (&rest args) (set-org-block-end-line-color)))

This is just a suggestion, please join according to your preferences

abougouffa commented 1 year ago

In my experience, this does occur only when there is no empty line between the heading and the #+end_src. I would rather prefer to leave this behavior to remind me to add the missing new line.

donneyluck commented 1 year ago

but if there is an empty line between the heading and the #+end_src like this image press tab can not unfold heading

abougouffa commented 1 year ago

press tab can not unfold heading

Well, in my machine it does unfold it! @donneyluck

I'm using Emacs 29 by the way, it is more stable than Emacs 30 nowadays

donneyluck commented 1 year ago

It should be noted that it is not after the title press tab Cursor needs to be behind ↩ then press tab

abougouffa commented 1 year ago

Cursor needs to be behind  then press tab

In my machine, it unfolds in all cases!

my solution

The code you provided overwrites the #+end_src background, which fixes the issue when the headings are folded, but when you unfold them, you can notice that the #+end_src has the wrong background.

image

EDIT: I don't consider this as an issue, if you add a new line after the #+end_src this will be solved!

* Title

#+src_begin python

#+src_end 
              <----------- Add a new line here!
* Title 2
...