doomemacs / doomemacs/core

company backends not set when using window-setup-hook

Open
#7,874 0 comments 0 reactions 0 assignees View on GitHub
:completion company is:bug
Dominant language
Emacs Lisp
Stars
22.7k
Forks
3.1k
Avg merge
10h 46m
Merged PRs (30d)
4

Description

### I confirm that...

- [X] I have searched the [issue tracker](https://github.com/doomemacs/doomemacs/issues), [documentation](https://docs.doomemacs.org), [FAQ](https://docs.doomemacs.org/-/faq), [Discourse](https://discourse.doomemacs.org), and [Google](https://google.com), in case this issue has already been reported/resolved.

- [X] I have read "[How to Debug Issues](https://doomemacs.org/d/how2debug)", and will use it to provide as much information about this issue as possible.

- [X] The issue can be reproduced on the **latest** available commit of Doom.

- [X] The issue can be reproduced on a stable release of Emacs, such as 27, 28, or 29. *(Unstable versions end in .50, .60, or .9x)*

### Expected behavior

I would like to show my yasnippets in completion first in any mode.
I want to automatically restore my session without the dashboard.

### Current behavior

When using the code below the variable to company-backends stays the
same `(company-capf)`.

### Steps to reproduce

Put this in config.el or any other place. The company-backends
will not be set. However, if you comment out the part of `window-setup-hook` it will work.
I searched in the sessions to try and find if there was a piece of code that was modifying
the company-backends I could not find it?

```lisp
(progn
(after! elisp-mode
(set-company-backend! '(emacs-lisp-mode lisp-interaction-mode)
'(:separate company-yasnippet company-files company-bbdb company-semantic company-cmake company-capf :with company-tempo company-clang
company-dabbrev-code company-gtags company-keywords
company-oddmuse company-dabbrev)
)))

;; comment here to allow the expected behavior
(add-hook 'window-setup-hook (cmd! (doom/quickload-session t)))

(defun my/doom-reload-last-session (orig-fun &rest args)
"Don't prompt to reload the session."
(setq args '("t"))
(apply orig-fun args))
(advice-add 'doom/quickload-session :around 'my/doom-reload-last-session)
```

### System Information

https://gist.github.com/rickalex21/32ff41f2a411bd501182805003a60fee

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.