I am having a strange problem. I have my init.el
, ~/.emacs.d/lisp
and a Python file tcvw.py
synced between two computers running the exact same version of Emacs (27.1) and same OS (Debian Sid).
In one of these computers, all works perfectly, including LSP (using pyright
). In the other I LSP is not working when trying to open the Python file. Two errors occur, although they might be unrelated.
First, when trying to open tcvm.py
, I am asked if I want to watch files in a different directory (my www-home
), which has too many files. This is directory is not a subdirectory of the project (or the other way around), so I have no idea why I am being asked that. In fact, it happens when I try to open any Python project. (I am not sure if this has anything to do with LSP not working in Python, though...)
Second, I get error messages:
ad-handle-definition: ‘hippie-expand’ got redefined
File local-variables error: (void-variable python-shell-interpreter)
When done with a buffer, type C-x #
Error running timer: (void-variable company-quick-access-hint-function)
Error processing message (void-variable company-quick-access-hint-function). [2 times]
Watching all the files in /home/finotti/GD/www-home would require adding watches to 1071 directories, so watching the repo may slow Emacs down.
Do you want to watch all files in /home/finotti/GD/www-home? (y or n) n
LSP :: You can configure this warning with the `lsp-enable-file-watchers' and `lsp-file-watch-threshold' variables
Error processing message (void-variable company-quick-access-hint-function).
and LSP mode does not load.
It was working yesterday (in both computers) and stopped working in one of them while I was working on it.
Here are some (maybe) relevant parts of my init.el
:
;; set up for breadcrumbs on top
(defun lrf/lsp-mode-setup ()
(setq lsp-headerline-breadcrumb-segments '(path-up-to-project file symbols))
(lsp-headerline-breadcrumb-mode))
(use-package lsp-mode
:commands (lsp lsp-deferred)
:hook
(lsp-mode . lrf/lsp-mode-setup)
;; (LaTeX-mode . lsp)
(web-mode . lsp)
:init
(setq lsp-keymap-prefix "C-c l") ;; Or 'C-l', 's-l'
:config
(lsp-enable-which-key-integration t)
:commands
lsp)
(use-package lsp-ui
:hook
(lsp-mode . lsp-ui-mode)
:custom
;; (lsp-ui-doc-position 'bottom)
(lsp-ui-doc-enable nil))
(use-package lsp-treemacs
:after lsp)
(use-package lsp-ivy)
(use-package company
:after lsp-mode
:hook (lsp-mode . company-mode)
:bind (:map company-active-map
("<tab>" . company-complete-selection))
;; (:map lsp-mode-map
;; ("<tab>" . company-indent-or-complete-common))
:custom
(company-minimum-prefix-length 1)
(company-idle-delay 0.0))
(use-package company-box
:hook (company-mode . company-box-mode))
;; Python (pyright): https://emacs-lsp.github.io/lsp-pyright/
(use-package lsp-pyright
:hook (python-mode . (lambda ()
(require 'lsp-pyright)
(lsp-deferred))))
Any help would be greatly appreciated.
init.el
and my snippets folder to a new (and empty).emacs.d
folder. Thewww-home
folder problem went away, but LSP still doe not load.python-shell-interpreter
in each instance? DoC-h v python-shell-interpreter
to find out. How is it set? Why is it not defined in the non-working instance? How do you set it as a file-local variable?python-shell-interpreter
toinit.el
and it did not help. But, I figured out what was wrong.company
was not installed in the second computer. (I think it was removed when I updated the packages, maybe???) It's strange, since I have(setq use-package-always-ensure t)
. With the old.emacs.d
, thewww-home
problem remains, though...