minad / org-modern

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

Set which-func-cleanup-function to fix mode line display #235

Closed bcc32 closed 1 month ago

bcc32 commented 1 month ago

Without this, which-function in org buffers returns a string with many text properties, in particular the display property, which causes the name of the current heading in to be rendered incorrectly in the mode line.

I didn't bother to implement something "undoing" this when disabling the mode, since it's not likely to be robust in the face of anything else that sets which-func-cleanup-function (although then again, neither is enabling it in the minor mode with setq-local).---Happy to add this if you prefer I do so.

minad commented 1 month ago

Hi! I'd say which-func-cleanup-function should rather be set in the user configuration, since it handles an integration problem. I also wonder why it is not substring-no-properties by default to be safe.

bcc32 commented 1 month ago

That's an interesting point, but the reason I suggested doing it here was because which-func defines a number of defcustoms for users to customize, but this is a (less-discoverable) defvar, and its docstring suggests that the mode should provide a sensible value when the imenu implementation would be overly verbose. Also, it took me a bit to track down that org-modern was the package causing this display issue for me, and I think it would be convenient to solve this for other users as well.

Happy to add to my config instead if you don't think this is appropriate here, but I'd like to ask you to reconsider because of the above. Thanks!