jdtsmith / indent-bars

Fast, configurable indentation guide-bars for Emacs
GNU General Public License v3.0
343 stars 14 forks source link

integration with whitespace-mode #13

Closed nicolasavru closed 1 year ago

nicolasavru commented 1 year ago

Nice project!

I use whitespace-mode to make whitespace visible and it would be cool to be able to highlight those symbols instead of inserting new symbols. See screenshot for example.

I got that to work by having indent-bars--stipple return an empty list and, in indent-bars--draw, replacing (put-text-property pos (1+ pos) 'face (indent-bars--face barnum) obj) with (put-text-property pos (+ pos indent-bars-spacing) 'face (indent-bars--face barnum) obj). That's not completely correct though as that also highlights part of the code (see lines 7847 and 7848), so we want to do that but only highlight up to the first non-whitespace character.

It may be desirable to do something special with the first 4 columns, maybe start the indent-bars highlighting at col 0 instead of 4. In my screenshot their color is what it would have been without indent-bars.

indent_bars_whitespace_example

jdtsmith commented 1 year ago

Interesting, never heard of that one. Why not try a very small central stipple? You could also enable indent-bars-prefer-character and configure indent-bars-no-stipple-char to be the same as the one your white-space mode uses.

nicolasavru commented 1 year ago

The difference is colorizing a single column, the "bar", vs the entire background area at an indentation level. With a bar, I find I need to shift my eyes left from the text at the beginning of the current line to the bar and then follow it up/down, whereas with the colored whitespace I can more easily take in the entire area at a glance.

jdtsmith commented 1 year ago

You may enjoy https://codeberg.org/ideasman42/emacs-hl-indent-scope as it also fills the entire level.

Have you tried just using a stipple? It will overlay the space dot without issue, maybe with something like :pattern = ". ." and a fairly wide width, to get the pattern to lie above & below the dot. Closing as this is beyond the design scope for indent-bars.