(use-package yasnippet
  :ensure t
  (prog-mode . yas-minor-mode)

(use-package yasnippet-snippets
  :ensure t
  :after yas)

(use-package common-lisp-snippets
  :ensure t
  :after yas
  :hook lisp-mode-hook)

(use-package slime-company
  :ensure t
  :after (slime company)
         . (lambda ()
             (set (make-local-variable 'company-backends)
                  '((company-slime company-yasnippet company-semantic)))))
         . (lambda ()
             (set (make-local-variable 'company-backends)
                  '((company-slime company-yasnippet company-semantic)))))
  (setq slime-company-completion 'fuzzy
        slime-company-after-completion 'slime-company-just-one-space))

In a lisp file, "defpackage"(imported by common-lisp-snippets) is show when using:


but company doesn't show for it. How to config company-yasnippet to find it?

1 Answer 1


Firstly, (make-local-variable 'company-backends) is outdated, with newest company and other packages, we only need to set one global company-backends.
That's because all backends do check whether it's the right major-mode etc. for it to take responsibility. In other words, company-slime checks whether it's in common lisp code, and step out of the way if not, so it's fine to just put it in a global company-backends.

To find out why company-yasnippet isn't working, check whether it's really in the backends, with describe-variable. Also see whether some other backend is giving some unhelpful candidates while company-yasnippet is queued after that. (if any backend gives any result, the ones after it won't be used at all.) (with newest company you can see the current candidate-giving backend in the completion UI.)

You may want to mix results of two or more backends, you can refer to the document for how to do this. But it's usually unnecessary, because you likely just need to put lightweight backend before others and they'll work only when it really think it should (company-files for example)

  • It seems that I have use the wrong keyword for company-yasnippet. It should be defp instead of defpackage. But it comes all the way down. Hmm, how could I change the sort of predict to put it in the front?
    – C-Entropy
    Commented Oct 16, 2020 at 8:12
  • This seems to be another question, better post a new one with the completion list you get.
    – JJPandari
    Commented Oct 16, 2020 at 8:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.