highlight-indent-guides
highlight-indent-guides copied to clipboard
Ghost guide characters when changing indent size
Say I have this code nicely highlighted with gray guides:

When I edit a line (one with <div class="page"> in this case), somehow the character guides get messed up and leave all those "ghost" guide characters (in black) that should not be there:

These ghost characters are not real in a sense that they aren't actually edited into the code itself (killing the buffer and reopening the file renders properly with the new indent size).
This happens when I use highlight-indent-guides with the web-mode hook, but it doesn't happen with my Python code (python-mode). Is this some compatibility issue mentioned in README or actually a bug?
Sorry for the late reply, I could have sworn I had already responded to this. Yeah, I can reproduce it, and it only seems to happen in web-mode. There must be some compatibility issue, though not one I was previously aware of. I'll take a closer look at web-mode to see if I can tell what the problem might be.
this also happens to me in many lisp modes. Also when some indentation is corrected automatically, e.g. by parinfer or by indent-region
Any progress on this issue? It's quite annoying when this happens. And this indeed happens in many different major-modes.
This is probably the single most annoying issue that I've personally encountered using this package.
It might be easier if I had more examples to cross-reference. I've only seen this in web-mode so far, what other modes does it happen in? I still haven't had time for a deep dive into web-mode, but if there's some clear connection between the modes this affects it might shed some light. Beyond that, I'm still planning on a detailed look at web-mode when I get time for it.
There are few cases I could reproduce this issue.
Case 1
This occurs when guides is trying to highlight the guides under dotimes operator (image on left). But once the indentation is mess up by deleting the spaces infront of if operator, then the guides seem to be confused? (image on right)
| before | after |
|---|---|
![]() |
![]() |
Case 2
If I try to delete the newline from beginning of line. There are guides left behind the previous line.
| before | after |
|---|---|
![]() |
![]() |
P.S. This is in emacs-lisp-mode
@jcs090218 Hmm ... yeah neither of these things happen for me, can't reproduce. I'm definitely in emacs-lisp-mode. Perhaps you have a minor mode loaded that's interfering with the update mechanism, or something like that? It seems like font-lock isn't running properly for some reason.
also can't reproduce with this particular example, however this happens to me very often with Parinfer-rust-mode when the whole block of indentation is changed.
here's a minimal repro that works for me with emacs -q: highlight-indent-guides-#70.zip
$ cd highlight-indent-guides-#70
$ emacs -q -l repro-init.el bug.el
By deleting indentation with backspace one by one I get this result:

Here's a GIF:

This is Emacs version: 27.1, and freshly installed highlight-indent-guides without anything else.
I have this issue as well.
I see it most when I apply auto-formatting via lsp in haskell files.
In my case this bug is fixed in a particular buffer when I toggle the highlight-indent-guides-mode off and back on again. The issues no longer appears in this buffer.
highlight-indent-guides is loaded as follows:
(use-package highlight-indent-guides
:ensure t
:after modus-themes
:custom
(highlight-indent-guides-method 'character)
(highlight-indent-guides-auto-character-face-perc 25)
:hook
((prog-mode text-mode conf-mode) . highlight-indent-guides-mode))
Here is my workaround based on @lapinskim's comment:
(use-package
highlight-indent-guides
:init
(add-hook
'prog-mode-hook
(lambda ()
;; NOTE: Workaround to fix wired appearance after
;; reformatting. See
;; https://github.com/DarthFennec/highlight-indent-guides/issues/70#issuecomment-1342713343
;; for more information.
(highlight-indent-guides-mode +1)
(highlight-indent-guides-mode -1)
(highlight-indent-guides-mode +1))))
NOTE: Only tested on Emacs 30.0.50



