indent-guide
indent-guide copied to clipboard
Breaks auto-complete interface
Indent-guide breaks auto-complete displaying of completions.
Just an example:
thanks.
it seems that indent-guide
and popup
(internally used by auto-complete
) both put overlays at the same place and the popup glitches.
to fix this we probably need to look into popup.el
and learn how that library shows popup.
i did a little digging on the problem and what happens is that when popup.el it's making the popup (popup-create)
and drawing it (popup-draw)
it gets all the overlays which are set on all the lines contained in the popup height and set its 'display
property to ""
, it saves the old property value on the popup (which is a cl-defstruct
) by the key of invis-overlays
so it can restore it later on (popup-hide)
. This shouldn't be a huge problem but i believe the glitches comes from the fact that both indent-guides and auto-complete hooks on pre/post-command-hook.
That behavior should be correct i believe for other things which i don't have the time to check, so i don't know exactly which of the libraries should be patched.
What is definitely wrong is popup.el hiding all the overlays from beginning-of-line till end-of-line. It should only hide those beneath the popup actual area.
Anyway, for a workaround i did a monkey patch on overlay-put so it can safely ignore indent-guides, it works perfectly fine for my setup, i don't know if it breaks neither did i tested it with other uses of indent-guide or auto-complete/popup:
(defadvice overlay-put (around ignore-indent-guides first activate)
(unless (and (equal (overlay-get (ad-get-arg 0) 'category) 'indent-guide)
(equal (ad-get-arg 1) 'display)
(equal (ad-get-arg 2) ""))
ad-do-it))
Hope that helps.
Further testing showed that a problem persists: Apparently popup.el creates empty lines by prepending whitespaces and dragging the overlayed guides forward. I'm still digging through it.
The problem seems to be that both packages uses overlays before/after-strings. It happens only on empty lines (or lines that are to short to display the indentation) because both overlays get set to the same point and therefore those properties concatenate, there's no overlap possible. I think the only way out is to completely disable those lines when popup.el is being used.
I don't know if auto-complete has the hooks for this but I ran into the same problem with company-mode. Managed to solve it using the hooks to disable/enable the guides while completion is active.
;; disable indent guide while completion is active
(add-hook 'company-mode-hook
(lambda ()
(add-hook 'company-completion-started-hook (lambda (&optional arg)
(indent-guide-mode -1)) nil 'make-it-local)))
(add-hook 'company-mode-hook
(lambda ()
(add-hook 'company-completion-cancelled-hook (lambda (&optional arg)
(indent-guide-mode 1)) nil 'make-it-local)))
(add-hook 'company-mode-hook
(lambda ()
(add-hook 'company-completion-finished-hook (lambda (&optional arg)
(indent-guide-mode 1)) nil 'make-it-local)))
hmm, auto-complete does not provide such hooks and we need to use advices to do the same for auto-complete. i'll inspect more later. thanks.
Setting indent-guide-delay
to a value larger than the popup-delay resolve this issue for me.