0

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.

5
  • Have you compared the init files on the two computers? How are you syncing them?
    – NickD
    Dec 30, 2021 at 16:35
  • I sync them with Google Drive and InSync. They are identical.
    – finotti
    Dec 30, 2021 at 16:56
  • I also tried copying only init.el and my snippets folder to a new (and empty) .emacs.d folder. The www-home folder problem went away, but LSP still doe not load.
    – finotti
    Dec 30, 2021 at 16:57
  • What is the value of the variable python-shell-interpreter in each instance? Do C-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?
    – NickD
    Dec 30, 2021 at 17:06
  • @NickD: Thanks for the help! I added the python-shell-interpreter to init.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, the www-home problem remains, though...
    – finotti
    Dec 30, 2021 at 17:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.