Files
.emacs.d/lisp/init-python.el

27 lines
941 B
EmacsLisp
Raw Permalink Normal View History

2025-12-14 23:46:29 +11:00
;; -*- lexical-binding: t; -*-
;; Python Mode
;; Install: pip install pyflakes autopep8
(use-package python
2026-04-02 19:21:30 +11:00
:ensure nil
2025-12-14 23:46:29 +11:00
: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)