syl20bnr / spacemacs

A community-driven Emacs distribution - The best editor is neither Emacs nor Vim, it's Emacs *and* Vim!
http://spacemacs.org
GNU General Public License v3.0
23.71k stars 4.9k forks source link

With the Python and LSP layers when a Python file is found an error occurs and missing are key bindings of the LSP layer #16652

Closed JohnADawson closed 1 week ago

JohnADawson commented 2 weeks ago

Description :octocat:

With the Python and LSP layers when a Python file is found an error occurs and missing are key bindings of the LSP layer, like SPC m r r.

Reproduction guide :beetle:

Observed behaviour: :eyes: :broken_heart: An error occurs, the backtrace whereof is below; missing are key bindings of the LSP layer, like SPC m r r.

Expected behaviour: :heart: :smile: No error occurs; no key bindings are missing.

System Info :computer:

Backtrace :paw_prints:

Debugger entered--Lisp error: (error "Eager macro-expansion failure: (excessive-lisp-nes...")
  error("Eager macro-expansion failure: %S" (excessive-lisp-nesting 1601))
  internal-macroexpand-for-load((defalias 'epc:connect #'(lambda (host port) "[internal] Connect the server, initialize the proc..." (epc:log ">> Connection start: %s:%s" host port) (lexical-let* ((connection-id (epc:uid)) (connection-name (format "epc con %s" connection-id)) (connection-buf (epc:make-procbuf ...)) (connection-process (open-network-stream connection-name connection-buf host port)) (channel (cc:signal-channel connection-name)) (connection (make-epc:connection :name connection-name :process connection-process :buffer connection-buf :channel channel))) (epc:log ">> Connection establish") (set-process-coding-system connection-process 'binary 'binary) (set-process-filter connection-process (lambda (p m) (epc:process-filter connection p m))) (set-process-sentinel connection-process (lambda (p e) (epc:process-sentinel connection p e))) (set-process-query-on-exit-flag connection-process nil) connection))) t)
  load-with-code-conversion("/home/john/.emacs.d/elpa/29.3/develop/epc-20140610..." "/home/john/.emacs.d/elpa/29.3/develop/epc-20140610..." nil t)
  #<subr require>(epc nil nil)
  funcall(#<subr require> epc nil nil)
  (let ((load-path (cons path load-path))) (funcall func feature filename noerror))
  (if path (let ((load-path (cons path load-path))) (funcall func feature filename noerror)) (funcall func feature filename noerror))
  (let* ((s (and t (and feature (not filename) load-hints))) (path (and s (spacemacs//lookup-load-hints (symbol-name feature))))) (if path (let ((load-path (cons path load-path))) (funcall func feature filename noerror)) (funcall func feature filename noerror)))
  require@LOAD-HINTS(#<subr require> epc)
  apply(require@LOAD-HINTS #<subr require> epc)
  require(epc)
  load-with-code-conversion("/home/john/.emacs.d/elpa/29.3/develop/importmagic-..." "/home/john/.emacs.d/elpa/29.3/develop/importmagic-..." nil t)
  (importmagic-mode)
  (if (eq 32 (string-to-char (buffer-name))) nil (importmagic-mode))
  (lambda nil (if (eq 32 (string-to-char (buffer-name))) nil (importmagic-mode)))()
  run-hooks(change-major-mode-after-body-hook prog-mode-hook python-base-mode-hook python-mode-hook)
  apply(run-hooks (change-major-mode-after-body-hook prog-mode-hook python-base-mode-hook python-mode-hook))
  run-mode-hooks(python-mode-hook)
  python-mode()
  set-auto-mode-0(python-mode nil)
  set-auto-mode--apply-alist((("SConscript\\'" . python-mode) ("SConstruct\\'" . python-mode) ("Cask\\'" . emacs-lisp-mode) ("\\*.el\\'" . emacs-lisp-mode) ("requirements\\.in" . pip-requirements-mode) ("requirements[^z-a]*\\.txt\\'" . pip-requirements-mode) ("\\.pip\\'" . pip-requirements-mode) ("\\.\\(?:md\\|markdown\\|mkd\\|mdown\\|mkdn\\|mdwn\\)\\'" . markdown-mode) ("\\.editorconfig\\'" . editorconfig-conf-mode) ("\\.pxi\\'" . cython-mode) ("\\.pxd\\'" . cython-mode) ("\\.pyx\\'" . cython-mode) ("\\.ipynb\\'" . code-cells-convert-ipynb) ("\\.env\\.example\\'" . dotenv-mode) ("\\.env\\'" . dotenv-mode) ("\\(\\.e?ya?ml$\\|\\.\\(yml\\|yaml\\)\\'\\|Procfile\\'\\)" lambda nil (configuration-layer//auto-mode 'yaml 'yaml-mode)) ("\\(\\.ps[dm]?1\\'\\|\\.ps1$\\)" lambda nil (configuration-layer//auto-mode 'windows-scripts 'powershell-mode)) ("\\(\\.bat$\\)" lambda nil (configuration-layer//auto-mode 'windows-scripts 'dos-mode)) ("\\(_vimperatorrc\\'\\|_pentadactylrc\\'\\|\\.penta\\'\\|vi..." lambda nil (configuration-layer//auto-mode 'vimscript 'dactyl-mode)) ("\\(\\.vim\\'\\|[._]?g?vimrc\\'\\|\\.exrc\\'\\|_vimrc\\'\\|\\.v..." lambda nil (configuration-layer//auto-mode 'vimscript 'vimrc-mode)) ("\\(\\.ts$\\)" lambda nil (configuration-layer//auto-mode 'typescript 'typescript-mode)) ("\\(\\.fish\\'\\|/fish_funced\\..*\\'\\)" lambda nil (configuration-layer//auto-mode 'shell-scripts 'fish-mode)) ("\\(\\.\\(nspawn\\|automount\\|busname\\|mount\\|service\\|..." lambda nil (configuration-layer//auto-mode 'systemd 'systemd-mode)) ("\\(\\.swift\\'\\)" lambda nil (configuration-layer//auto-mode 'swift 'swift-mode)) ("\\(\\.sql\\'\\)" lambda nil (configuration-layer//auto-mode 'sql 'sql-mode)) ("\\(\\.s\\(ml\\|ig\\)\\'\\|\\.\\(sml\\|sig\\)\\'\\)" lambda nil (configuration-layer//auto-mode 'sml 'sml-mode)) ("\\.toml\\'" lambda nil (configuration-layer//auto-mode 'toml 'toml-mode)) ("\\(\\.rs\\|Cargo.lock\\|\\.cargo/config\\)\\'" lambda nil (configuration-layer//auto-mode 'rust 'rust-mode)) ("\\(\\(?:\\.rb\\|ru\\|rake\\|thor\\|jbuilder\\|gemspec\\|pod..." lambda nil (configuration-layer//auto-mode 'ruby 'ruby-mode)) ("\\(\\.http\\'\\)" lambda nil (configuration-layer//auto-mode 'restclient 'restclient-mode)) ("\\(\\.rkt[dl]?\\'\\)" lambda nil (configuration-layer//auto-mode 'racket 'racket-mode)) ("\\(\\.purs\\'\\)" lambda nil (configuration-layer//auto-mode 'purescript 'purescript-mode)) ("\\`PKGBUILD\\'" lambda nil (configuration-layer//auto-mode 'makepkg 'pkgbuild-mode)) ("\\(\\.proto\\'\\)" lambda nil (configuration-layer//auto-mode 'protobuf 'protobuf-mode)) ("\\(\\.amk\\'\\|/Amkfile\\'\\|\\.phtml\\'\\|\\.php[s345t]?\\'\\..." lambda nil (configuration-layer//auto-mode 'php 'php-mode)) ("\\.\\(p[lm]x?\\|P[LM]X?\\)\\'" lambda nil (configuration-layer//auto-mode 'perl5 'cperl-mode)) ("\\(\\.ml[ip]?\\'\\|\\.eliomi?\\'\\)" lambda nil (configuration-layer//auto-mode 'ocaml 'tuareg-mode)) ("\\(\\.markdown\\'\\|\\.md\\'\\|\\.m[k]d\\)" lambda nil (configuration-layer//auto-mode 'markdown 'markdown-mode)) ("\\(\\.m\\'\\)" lambda nil (configuration-layer//auto-mode 'octave 'octave-mode)) ("\\(nginx\\.conf\\'\\|/nginx/.+\\.conf\\'\\)" lambda nil (configuration-layer//auto-mode 'nginx 'nginx-mode)) ("\\(\\.lua$\\|\\.lua\\'\\)" lambda nil (configuration-layer//auto-mode 'lua 'lua-mode)) ("\\(\\.jsx$\\)" lambda nil (configuration-layer//auto-mode 'react 'react-mode)) ("\\(\\.json$\\)" lambda nil (configuration-layer//auto-mode 'javascript 'json-mode)) ("\\(\\.js\\'\\)" lambda nil (configuration-layer//auto-mode 'javascript 'js2-mode)) ("\\(\\.coffee\\'\\|\\.iced\\'\\|Cakefile\\'\\|\\.cson\\'\\)" lambda nil (configuration-layer//auto-mode 'javascript 'coffee-mode)) ("\\(\\.idr$\\|\\.lidr$\\)" lambda nil (configuration-layer//auto-mode 'idris 'idris-mode)) ("\\(\\.phtml\\'\\|\\.tpl\\.php\\'\\|\\.twig\\'\\|\\.html\\'\\|\\.h..." lambda nil (configuration-layer//auto-mode 'html 'web-mode)) ("\\(\\.slim\\'\\)" lambda nil (configuration-layer//auto-mode 'html 'slim-mode)) ("\\(\\.scss\\'\\)" lambda nil (configuration-layer//auto-mode 'html 'scss-mode)) ("\\(\\.sass\\'\\)" lambda nil (configuration-layer//auto-mode 'html 'sass-mode)) ...) nil nil)
  set-auto-mode()
  normal-mode(t)
  after-find-file(nil t)
  find-file-noselect-1(#<buffer play.py> "~/Documents/play/play.py" nil nil "~/Documents/play/play.py" (1338200 66306))
  #<subr find-file-noselect>("/home/john/Documents/play/play.py")
  apply(#<subr find-file-noselect> "/home/john/Documents/play/play.py" nil)
  editorconfig--advice-find-file-noselect(#<subr find-file-noselect> "/home/john/Documents/play/play.py")
  apply(editorconfig--advice-find-file-noselect #<subr find-file-noselect> "/home/john/Documents/play/play.py")
  find-file-noselect("/home/john/Documents/play/play.py")
  mapcar(find-file-noselect ("/home/john/Documents/play/play.py"))
  (let* ((files (helm-marked-candidates)) (buffers (mapcar 'find-file-noselect files))) (spacemacs//helm-open-buffers-in-windows buffers))
  (lambda (candidate) (let* ((files (helm-marked-candidates)) (buffers (mapcar 'find-file-noselect files))) (spacemacs//helm-open-buffers-in-windows buffers)))("/home/john/Documents/play/play.py")
  helm-execute-selection-action-1()
  helm-execute-selection-action()
  helm-internal((helm-source-find-files helm-find-files-dummy-source) "/home/john/" "Find files or url: " nil nil "*helm find files*" nil "/home/john/0.999.0@29.3" nil)
  apply(helm-internal ((helm-source-find-files helm-find-files-dummy-source) "/home/john/" "Find files or url: " nil nil "*helm find files*" nil "/home/john/0.999.0@29.3" nil))
  helm((helm-source-find-files helm-find-files-dummy-source) "/home/john/" "Find files or url: " nil nil "*helm find files*" nil "/home/john/0.999.0@29.3" nil)
  apply(helm ((helm-source-find-files helm-find-files-dummy-source) "/home/john/" "Find files or url: " nil nil "*helm find files*" nil "/home/john/0.999.0@29.3" nil))
  helm(:sources (helm-source-find-files helm-find-files-dummy-source) :input "/home/john/" :case-fold-search smart :preselect nil :ff-transformer-show-only-basename t :dim-prompt-on-update t :default "/home/john/0.999.0@29.3" :prompt "Find files or url: " :buffer "*helm find files*")
  helm-find-files-1("/home/john/")
  (let* ((hist (and arg helm-ff-history (helm-find-files-history nil))) (default-input hist) (input (cond ((and (eq major-mode 'dired-mode) default-input) (file-name-directory default-input)) ((and (not (string= default-input "")) default-input)) (t (expand-file-name (helm-current-directory)))))) (set-text-properties 0 (length input) nil input) (helm-find-files-1 input))
  spacemacs/helm-find-files(nil)
  funcall-interactively(spacemacs/helm-find-files nil)
  command-execute(spacemacs/helm-find-files)
  lazy-helm/spacemacs/helm-find-files()
  funcall-interactively(lazy-helm/spacemacs/helm-find-files)
  command-execute(lazy-helm/spacemacs/helm-find-files)
fnussbaum commented 2 weeks ago

I can reproduce the error (also without the lsp layer) when dotspacemacs-enable-load-hints is t. It does not occur after disabling this new load-hints feature on my system. @sunlin7 Would you take a look?

sunlin7 commented 2 weeks ago

I'm going to reproduce it, give me some time, will update later. Thanks.

sunlin7 commented 2 weeks ago

Can reproduce the issue with the reported environment. Disable the feature first #16654 ; I'm try to find the root cause. Thanks

sunlin7 commented 1 week ago

The Emacs had count in depth in the code,
https://github.com/emacs-mirror/emacs/blob/3496234c8ed10a14f740199722ec727bd43c82d3/src/eval.c#L269-L270

  max_lisp_eval_depth += diff;
  lisp_eval_depth_reserve -= diff;

So use the :filter-args to avoid the nesting calls.