indent-guide icon indicating copy to clipboard operation
indent-guide copied to clipboard

A method to avoid indent-guide and company-mode conflicts

Open yuzumx opened this issue 5 years ago • 0 comments

Hello:

Inspired by the code of purcell: https://github.com/purcell/emacs.d/blob/ce03e69652f03f636e26c92f12d6d79c024c3d2c/lisp/init-company.el#L26-L43

The following is my "copy or imitate":

(with-eval-after-load 'company
  (with-eval-after-load 'indent-guide
    (defvar sanityinc/indent-guide-on-p nil)
    (make-variable-buffer-local 'sanityinc/indent-guide-on-p)

    (defun sanityinc/indent-guide-disable (&rest ignore)
      (when (setq sanityinc/indent-guide-on-p (bound-and-true-p indent-guide-mode))
        (indent-guide-mode -1)))

    (defun sanityinc/indent-guide-maybe-reenable (&rest ignore)
      (when sanityinc/indent-guide-on-p
        (indent-guide-mode 1)))

    (add-hook 'company-completion-started-hook 'sanityinc/indent-guide-disable)
    (add-hook 'company-completion-finished-hook 'sanityinc/indent-guide-maybe-reenable)
    (add-hook 'company-completion-cancelled-hook 'sanityinc/indent-guide-maybe-reenable)))

What I want to ask is, is there any big performance problem?

Thank you, and sorry for my poor English.

yuzumx avatar Sep 10 '18 04:09 yuzumx