summary refs log tree commit diff
path: root/emacs/custom/my-lang-python.el
diff options
context:
space:
mode:
authorFranck Cuny <franck@fcuny.net>2022-10-17 18:29:37 -0700
committerFranck Cuny <franck@fcuny.net>2022-10-17 18:29:37 -0700
commit7084581ae2df832689f362ccdf5305b34c8bf0cf (patch)
treef17130e46cdc82e605534d750fc003091931a9ea /emacs/custom/my-lang-python.el
parentref(prog): wrap comments at column 120 (diff)
downloademacs.d-7084581ae2df832689f362ccdf5305b34c8bf0cf.tar.gz
ref(lsp): switch from lsp-mode to eglot
The experimentation was a disaster: lsp-mode was buggy, slow, littering
the interface with a lot of things I did not understood or needed.

eglot is definitely simpler and works better for me.

Change-Id: Ie7e7e6f1c8e7b26aa5cb79d636f3ad53c1493617
Diffstat (limited to '')
-rw-r--r--emacs/custom/my-lang-python.el15
1 files changed, 13 insertions, 2 deletions
diff --git a/emacs/custom/my-lang-python.el b/emacs/custom/my-lang-python.el
index c5f612a..04f3d00 100644
--- a/emacs/custom/my-lang-python.el
+++ b/emacs/custom/my-lang-python.el
@@ -6,14 +6,25 @@
 ;;; Code:
 
 (require 'python)
-(require 'python-mode)
 
+(setq python-shell-interpreter "python3")
+(setq python-shell-interpreter-args "-i")
+
+;;; bindings
+(define-key python-mode-map (kbd "C-h f") 'python-eldoc-at-point)
+
+;;; hooks
 ;; if black is present, enable it
 (when (executable-find "black")
   (require 'blacken)
   (add-hook 'python-mode-hook 'blacken-mode))
 
-(setq python-shell-interpreter "python3")
+(when (executable-find "pylsp")
+  (add-hook 'python-mode-hook 'eglot-ensure)
+  ;; https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md
+  (setq-default eglot-workspace-configuration
+                '((pylsp (plugins (flake8      (enabled . :json-false))
+                                  (pycodestyle (enabled . :json-false)))))))
 
 (provide 'my-lang-python)