dieggsy / esh-autosuggest

Fish-like autosuggestions in eshell.
GNU General Public License v3.0
103 stars 10 forks source link

evil-collection-init breaks esh-autosuggest #12

Open codygman opened 3 years ago

codygman commented 3 years ago

With this config esh-autosuggest will not work:


(require 'use-package)

(use-package evil
  :after general
  :init
  (setq evil-want-keybinding nil evil-want-integration t)
  :config
  (setq evil-ex-substitute-global t)
  (setq evil-undo-system 'undo-redo)
  (evil-mode 1)
  )

(use-package evil-collection
  :after evil
  :config
  (evil-collection-init))

(use-package general
  :init
  (setq evil-want-keybinding nil
    evil-want-C-d-scroll t
    evil-want-C-u-scroll t
    evil-want-integration t
    )
  :config
  (general-auto-unbind-keys) ;; NOTE not sure this works?
  (general-evil-setup t))

(use-package eshell :config)

(setq eshell-history-size 1000000)

(setq eshell-destroy-buffer-when-process-dies t)

(use-package esh-autosuggest
  :hook (eshell-mode . esh-autosuggest-mode))

(use-package company
  :config
  (setq company-minimum-prefix-length 1
        company-idle-delay 0.4
        company-selection-wrap-around t
        company-dabbrev-downcase nil
        )
  (global-company-mode))

However... if you comment out the evil-collection-init part out and call that after loading an eshell with esh-autosuggest you'll notice it changes the style of completion. Not sure why that is.

codygman commented 3 years ago

I guess something in the evil-collection eshell module probably conflicts with esh-autosuggest.

codygman commented 3 years ago

Actually I think loading esh-autosuggest before evil-collection fixes it like:

(use-package evil-collection
  :after '(evil esh-autosuggest)
  :config
  (evil-collection-init))
codygman commented 3 years ago

Sadly the above solution messes up other parts of evil-collection such as evilifying magit bindings.

dieggsy commented 3 years ago

Can you provide a more minimal breaking example? I use evil-collection and esh-autosuggest together with no problem.

johnae commented 3 years ago

@dieggsy This illustrates the problem for me:

(eval-and-compile
  (require 'package)
  (package-initialize)
  (require 'use-package)
 )

(use-package evil
  :ensure t
  :init
  (setq evil-want-keybinding nil)
  :config
  (evil-mode 1)
)

(use-package evil-collection
  :ensure t
  :after evil
  :config
  (evil-collection-init)
)

(use-package esh-autosuggest
  :ensure t
  :hook (eshell-mode . esh-autosuggest-mode))

Above will not suggest anything. If you remove the evil-collection-initit works. If you run evil-collection-init after starting an eshell it continues working but the suggestions/completions change position. Just as in the original bug report.

codygman commented 3 years ago

I don't have time to try it right now, but I bet if you replace (evil-collection-init) with (evil-collection-eshell-setup) the bug will still happen meaning we can focus on what it does.

johnae commented 3 years ago

@codygman @dieggsy I think I've found the source of the issue. And it's not the eshell-setup part of evil-collection. This "solves" the problem for me:

(use-package evil-collection
  :ensure t
  :after evil
  :config
  (setq evil-collection-company-use-tng nil)
  (evil-collection-init)
)

So I guess the problem comes from:

https://github.com/company-mode/company-mode/blob/master/company-tng.el

and/or

https://github.com/emacs-evil/evil-collection/blob/b45ec5b3156d27a18a949e4bf55643107a21abc2/modes/company/evil-collection-company.el#L39

https://github.com/emacs-evil/evil-collection/blob/b45ec5b3156d27a18a949e4bf55643107a21abc2/modes/company/evil-collection-company.el#L94

dieggsy commented 3 years ago

@johnae sorry for the delay (I know it can be frustrating to not hear back from project maintainers) and thanks for narrowing this down for me and for the references! This month is crazy busy but I will take a look at the info and see if I can look into a solution. Indeed, I had evil-collection-company-use-tng already set to nil in my config, which would explain why I wasn't seeing this issue.

Maybe I'll make a note of this in the README for the time being...

slotThe commented 2 years ago

@dieggsy I think it would be nice to explicitly mention company-tng-mode instead of evil-collection in the README. Since I don't use evil, I skipped that section and then had to bisect my company config to figure out why the autosuggestions were not working for me.

If you're too busy at the moment, I can try to come up with a nice wording and open a PR