sebastiencs / company-box

A company front-end with icons
561 stars 64 forks source link

company-box faces improperly overriding company faces #155

Closed genovese closed 1 year ago

genovese commented 3 years ago

When loading company-box after company, a variety of the faces from company get redefined with circular inheritance. For instance, company-tooltip-selection ends up a blank font that inherits from company-tooltip-selection. I have to go and reset all these faces manually, even though the original company definitions are good ones.

I think this stems from the code in company-box.el lines 76-116. The company-box version of the faces are defined as obsolete face aliases for selected company faces and then afterwards, some of the company box faces are defined to inherit those company faces.

As a test of this hypothesis, try

(defface fooface
  '((((background light)) :foreground "black")
    (t :foreground "white"))
  "Test face")

(define-obsolete-face-alias 'barface 'fooface nil)

(defface barface
  '((t :inherit fooface))
  "Another test face")

and then you'll see fooface redefined as a blank face inheriting from fooface.

It seems that removing the deffaces for the company-box faces defined as obsolete face aliases will solve the problem.

I'm using company-box 20210103.1605 from Melpa on Emacs 27.1 (Mac OS X 10.14.5), though the relevant code does not seem to have changed in the current HEAD. Here's my init spec:

(use-package company
  :bind (([(control ?\')]    . company-complete)
         (:map company-active-map
               ("<tab>"      . company-complete-selection)
               ("C-d"              . company-show-doc-buffer)
               ([(control return)] . company-show-location)))
  :config (with-eval-after-load 'lsp-mode
            (bind-key "<tab>" #'company-indent-or-complete-common lsp-mode-map)))

(use-package company-box
  :hook (company-mode . company-box-mode))

Thanks for a terrific package!

Yevgnen commented 2 years ago

Same issue here