Files
.emacs.d/lisp/init-python.el
Zelong Kuang 2fe4ba46e8 Update
2026-04-05 21:31:02 +10:00

27 lines
941 B
EmacsLisp

;; -*- lexical-binding: t; -*-
;; Python Mode
;; Install: pip install pyflakes autopep8
(use-package python
:ensure nil
:functions exec-path-from-shell-copy-env
:hook (inferior-python-mode . (lambda ()
(process-query-on-exit-flag
(get-process "Python"))))
:init
;; Disable readline based native completion
(setq python-shell-completion-native-enable nil)
:config
(add-to-list 'major-mode-remap-alist '(python-mode . python-ts-mode))
;; Default to Python 3. Prefer the versioned Python binaries since some
;; systems stupidly make the unversioned one point at Python 2.
(when (and (executable-find "python3")
(string= python-shell-interpreter "python"))
(setq python-shell-interpreter "python3"))
;; Env vars
(with-eval-after-load 'exec-path-from-shell
(exec-path-from-shell-copy-env "PYTHONPATH")))
(provide 'init-python)