integral-dw / org-superstar-mode

Make org-mode stars a little more super
GNU General Public License v3.0
501 stars 21 forks source link

org-indent not working when using org-superstars #21

Closed iburunat closed 3 years ago

iburunat commented 3 years ago

I recently started using this excellent, visually soothing package, thank you! I just noticed an interaction between org-indent and org-superstars, in that I can't seem to hide the preceding stars in ORG headings while keeping the indentation of the text below each heading. Here the issue:

Screenshot 2020-11-21 at 10 11 25 Screenshot 2020-11-21 at 10 11 39

My init.el code referencing org-superstars is as follows:

(add-hook 'org-mode-hook (lambda () (org-superstar-mode 1)))
(setq inhibit-compacting-font-caches t)
;; This is usually the default, but keep in mind it must be nil
(setq org-hide-leading-stars nil)
(setq org-superstar-leading-bullet ?\s)

Have you stumbled upon this problem? Thanks for any help, Cheers!

integral-dw commented 3 years ago

Hi @iburunat! Thanks for bringing this to my attention. It would be a great help if you could provide a minimum working example config of Org (that is, a small excerpt from your setup including org-indent) that reproduces this problem with default Emacs (meaning Emacs run with emacs -Q). If there's any way I can help with that, be sure to let me know!

iburunat commented 3 years ago

@integral-dw, Sure thing! Thanks for looking into this.

First, start emacs with emacs -Q and then run this snippet below on the *scratch* buffer:

(require 'package)
(package-initialize t)
(add-to-list 'load-path "~/.emacs.d/elpa/org-superstar-20200818.2257/")
(require 'org-superstar)
(add-hook 'org-mode-hook (lambda () (org-superstar-mode 1)))
(setq org-hide-leading-stars nil)
(setq org-superstar-leading-bullet ?\s)
(global-hl-line-mode 1)
(custom-set-faces
 '(hl-line ((t (:background "dark magenta" :foreground "white")))))

Now, create a simple orgmode document with two-level headings and add #+STARTUP: indent and run it with C-c C-c, you will get the behaviour I get. To compare, you can run #+STARTUP: noindent and see how the preceeding stars are hidden when the cursor is on that same line.

Hope this works for you and you can reproduce the bug, Thanks in advance!

integral-dw commented 3 years ago

Hi @iburunat, thanks for the working example! I think I have an idea what the root cause for this is (likely it relates to org-indent messing with the leading starts on its own, overriding superstar's behavior). I'll tinker with this a bit, though I may be slow to respond this month. I'll keep you updated!

AtomicNess123 commented 3 years ago

I'm having this issue as well.

iburunat commented 3 years ago

@integral-dw Sounds good. There is no rush, just thought it was worth to mention this issue. Hope there is a "cure" for it in the future :) Thanks a mil.

integral-dw commented 3 years ago

Hi, quick update: I'm pretty sure I found the culprit, but I need to give a little context. Vanilla Org ships with a variable called org-hide-leading-stars. If non-nil, it hides the leading stars in a very primitive fashion, that is by setting their color to the background color (or whatever the face org-hide is set to). org-superstar honors that value, and consequently has a "hands-off" approach when it is enabled. This is done to keep Superstar more orthogonal to Org itself.

Now, you may be wondering why all that matters when you explicitly turned it off? That is because org-indent overrides the value of org-hide-leading-stars while active and sets it to t. Consequently it basically tells Superstar that it wants to take over hiding the stars. This is why you get that strange effect. This can be turned off setting org-indent-mode-turns-on-hiding-stars to nil, adding the following to your config should do:

(setq org-indent-mode-turns-on-hiding-stars nil)

So what remains now is for me to figure out how and where to document this.

iburunat commented 3 years ago

It works perfectly! So beautiful... thanks thanks thanks! :))