syl20bnr/spacemacs

eshell ist very slow

Closed this issue Β· 15 comments

Description :octocat:

eshell is very slow :(

Reproduction guide πŸͺ²

  • Start Emacs
  • SPC '
  • Type ls and hit enter

Observed behaviour: πŸ‘€ πŸ’”
It's very slow in directories with .git repositories. A bit faster in non-git directories but still sluggish.

Expected behaviour: ❀️ πŸ˜„
No noticeable delays when typing simple commands like ls.

System Info πŸ’»

  • OS: darwin
  • Emacs: 26.0.50
  • Spacemacs: 0.300.0
  • Spacemacs branch: develop (rev. 64cf9f5)
  • Graphic display: t
  • Distribution: spacemacs
  • Editing style: vim
  • Completion: ivy
  • Layers:
(html
 (clojure :variables clojure-enable-fancify-symbols t)
 (colors :variables colors-enable-rainbow-mode t)
 elm emacs-lisp git github
 (ivy :variables ivy-wrap t ivy-virtual-abbreviate 'full ivy-extra-directories nil)
 nlinum
 (markdown :variables markdown-live-preview-engine 'vmd)
 osx
 (shell :variables shell-default-shell 'eshell shell-default-height 30 shell-enable-smart-eshell t shell-default-position 'bottom shell-default-full-span nil)
 (spell-checking :variables spell-checking-enable-by-default nil spell-checking-enable-auto-dictionary t)
 search-engine spacemacs-layouts syntax-checking
 (version-control :variables version-control-global-margin t version-control-diff-tool 'git-gutter+)
 yaml
 (auto-completion :variables auto-completion-return-key-behavior nil auto-completion-tab-key-behavior 'complete auto-completion-enable-snippets-in-popup t auto-completion-enable-sort-by-usage t auto-completion-private-snippets-directory "~/.spacemacs.d/snippets" auto-completion-enable-help-tooltip nil)
 aj-javascript)
  • System configuration features: JPEG RSVG IMAGEMAGICK NOTIFY ACL GNUTLS LIBXML2 ZLIB TOOLKIT_SCROLL_BARS NS MODULES

You can disable the git integration in eshell-fancy-prompt
EDIT: eshell-prompt-extras

@CeleritasCelery Could you elaborate? I don't have a variable or function with that name. And I tried removing shell/pre-init-magit but it doesn't seem to help.

I've also noticed that I have to press Enter often twice to run e.g. ls.

eshell-prompt-extras does not get the git status asynchronously, which can make it very slow. Should be able to fix it by using (defun epe-git-p () nil). That will cause it to not run git.

Hm, unfortunately still sluggish. The double-enter problem also remains. :/

Looks like this was already an issue with an attempted fix?

No that was just an attempt to make the git prompt work on remote hosts since EShell has tramp integration. And I do not experience the double enter problem or sluggishness. Maybe remove the shell layer and run EShell to see if it is still slow?

Okay, removing the shell layer and running M-x eshell after SPC q R is indeed way faster. I also noticed the "double enter" problem seems to be related to the popup with completion candidates when typing ls. I just haven't seen it displayed before...

The double enter problem is from company mode because it was not designed for REPL's. In my own config I removed enter from the company-active-map and use C-l to select a candidate.

(spacemacs|use-package-add-hook company
    :post-config
    (define-key company-active-map (kbd "RET") nil)
    (define-key company-active-map [return] nil))

you can also get in the habit of putting a space after every command before you hit enter or disable company-mode in eshell.

As far as the slowness goes. Look at shell-packages in packages.el. Disabling some of those packages related to eshell should fix your slowdown. My money would be on eshell-prompt-extras or eshell-z.

You're right, thanks πŸ‘ eshell-prompt-extras seems to be the problem here.

About removing enter from the company-active-map β€” I've put your snippet in my spacemacs/user-config (like you did) but after SPC f e R running SPC h d v company-active-map still shows:

 (13 . company-complete-selection)
 (return . company-complete-selection)

Any idea why this seems to have no effect?

Because use-package hooks must be defined before the package is loaded. You can eval the two define-key functions (by putting your cursor on the last paren and using , e e) and that should fix your current session. It should get picked up automatically in all future sessions.

My badβ€”it was below (global-company-mode t). So no surprise it didn't work.

Feel free to close this if you feel your question has been answered.

I'm not sure whether this should stay open because disabling eshell-prompt-extras is a workaround and not a real fix?

The only β€œreal” fix would be for the eshell-prompt-extras package owner to make some optimizations. And it’s seems that for most people the performance is not an issue. There is no solution that Spacemacs can implement apart from removing this package. If you feel you can make a compelling case for removing it go ahead and open a PR.

Opened an issue at eshell-prompt-extras (as you can see) β€” so closing it for now. Thanks for the help!

I would like to suggest removing eshel-prompt-extras completely from the set of packages initialized in the shell layer. It is more annoying than useful.