Python support
This commit is contained in:
3
init.el
3
init.el
@@ -32,9 +32,10 @@
|
|||||||
|
|
||||||
(require 'init-llm)
|
(require 'init-llm)
|
||||||
|
|
||||||
|
(require 'init-lsp)
|
||||||
(require 'init-coding)
|
(require 'init-coding)
|
||||||
(require 'init-org)
|
(require 'init-org)
|
||||||
(require 'init-tex)
|
(require 'init-tex)
|
||||||
(require 'init-typst)
|
(require 'init-typst)
|
||||||
(require 'init-cc)
|
(require 'init-cc)
|
||||||
|
(require 'init-python)
|
||||||
|
|||||||
@@ -2,13 +2,14 @@
|
|||||||
|
|
||||||
(use-package cc-mode
|
(use-package cc-mode
|
||||||
:ensure nil
|
:ensure nil
|
||||||
:init (setq-default c-basic-offset 4))
|
:init (setq-default c-basic-offset 2))
|
||||||
|
|
||||||
(when (treesit-available-p)
|
(when (treesit-available-p)
|
||||||
(use-package c-ts-mode
|
(use-package c-ts-mode
|
||||||
|
:ensure nil
|
||||||
:functions centaur-treesit-available-p
|
:functions centaur-treesit-available-p
|
||||||
:init
|
:init
|
||||||
(setq c-ts-mode-indent-offset 4)
|
(setq c-ts-mode-indent-offset 2)
|
||||||
|
|
||||||
(when (boundp 'major-mode-remap-alist)
|
(when (boundp 'major-mode-remap-alist)
|
||||||
(add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode))
|
(add-to-list 'major-mode-remap-alist '(c-mode . c-ts-mode))
|
||||||
@@ -16,10 +17,10 @@
|
|||||||
(add-to-list 'major-mode-remap-alist
|
(add-to-list 'major-mode-remap-alist
|
||||||
'(c-or-c++-mode . c-or-c++-ts-mode)))))
|
'(c-or-c++-mode . c-or-c++-ts-mode)))))
|
||||||
|
|
||||||
(use-package eglot
|
(with-eval-after-load 'eglot
|
||||||
:hook (c-mode . eglot-ensure)
|
(add-hook 'c-ts-mode-hook #'eglot-ensure)
|
||||||
:hook (c++-mode . eglot-ensure)
|
(add-hook 'c++-ts-mode-hook #'eglot-ensure)
|
||||||
:config
|
|
||||||
(add-to-list 'eglot-server-programs '((c++-mode c-mode) "clangd")))
|
(add-to-list 'eglot-server-programs '((c++-mode c-mode) "clangd")))
|
||||||
|
|
||||||
|
|
||||||
(provide 'init-cc)
|
(provide 'init-cc)
|
||||||
|
|||||||
@@ -32,9 +32,9 @@
|
|||||||
;; Optionally use the `orderless' completion style.
|
;; Optionally use the `orderless' completion style.
|
||||||
(use-package orderless
|
(use-package orderless
|
||||||
:custom
|
:custom
|
||||||
(completion-styles '(orderless basic))
|
(completion-styles '(orderless partial-completion basic))
|
||||||
(completion-category-defaults nil)
|
(completion-category-defaults nil)
|
||||||
(completion-category-overrides '((file (styles basic partial-completion))))
|
(completion-category-overrides nil)
|
||||||
(orderless-component-separator #'orderless-escapable-split-on-space))
|
(orderless-component-separator #'orderless-escapable-split-on-space))
|
||||||
|
|
||||||
;; Support Pinyin
|
;; Support Pinyin
|
||||||
@@ -149,6 +149,23 @@
|
|||||||
;; setting is useful beyond Corfu.
|
;; setting is useful beyond Corfu.
|
||||||
(read-extended-command-predicate #'command-completion-default-include-p))
|
(read-extended-command-predicate #'command-completion-default-include-p))
|
||||||
|
|
||||||
|
(use-package cape
|
||||||
|
:init
|
||||||
|
;; Add `completion-at-point-functions', used by `completion-at-point'.
|
||||||
|
(add-to-list 'completion-at-point-functions #'cape-dabbrev)
|
||||||
|
(add-to-list 'completion-at-point-functions #'cape-file)
|
||||||
|
;;(add-to-list 'completion-at-point-functions #'cape-history)
|
||||||
|
;;(add-to-list 'completion-at-point-functions #'cape-keyword)
|
||||||
|
;;(add-to-list 'completion-at-point-functions #'cape-tex)
|
||||||
|
;;(add-to-list 'completion-at-point-functions #'cape-sgml)
|
||||||
|
;;(add-to-list 'completion-at-point-functions #'cape-rfc1345)
|
||||||
|
;;(add-to-list 'completion-at-point-functions #'cape-abbrev)
|
||||||
|
;;(add-to-list 'completion-at-point-functions #'cape-ispell)
|
||||||
|
;;(add-to-list 'completion-at-point-functions #'cape-dict)
|
||||||
|
;;(add-to-list 'completion-at-point-functions #'cape-symbol)
|
||||||
|
;;(add-to-list 'completion-at-point-functions #'cape-line)
|
||||||
|
)
|
||||||
|
|
||||||
(provide 'init-completion)
|
(provide 'init-completion)
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|||||||
@@ -12,12 +12,18 @@
|
|||||||
eglot-send-changes-idle-time 0.5))
|
eglot-send-changes-idle-time 0.5))
|
||||||
|
|
||||||
(use-package eglot-booster
|
(use-package eglot-booster
|
||||||
|
:ensure (eglot-booster :type git :host nil :repo "https://github.com/jdtsmith/eglot-booster")
|
||||||
:after eglot
|
:after eglot
|
||||||
:config (eglot-booster-mode))
|
:config (eglot-booster-mode))
|
||||||
|
|
||||||
(use-package consult-eglot
|
(use-package consult-eglot
|
||||||
:after consult eglot
|
:after consult eglot
|
||||||
:bind (:map eglot-mode-map
|
:bind (:map eglot-mode-map
|
||||||
("C-M-." . consult-eglot-symbols)))
|
("C-M-." . consult-eglot-symbols))
|
||||||
|
:config
|
||||||
|
(advice-add 'eglot-completion-at-point :around #'cape-wrap-buster))
|
||||||
|
|
||||||
|
(with-eval-after-load 'eglot
|
||||||
|
(setq completion-category-defaults nil))
|
||||||
|
|
||||||
(provide 'init-lsp)
|
(provide 'init-lsp)
|
||||||
|
|||||||
31
lisp/init-python.el
Normal file
31
lisp/init-python.el
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
;; -*- 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")))
|
||||||
|
|
||||||
|
(with-eval-after-load 'eglot
|
||||||
|
(add-hook 'python-ts-mode-hook #'eglot-ensure)
|
||||||
|
(add-to-list 'eglot-server-programs '((python-mode python-ts-mode) . ("pyright-langserver" "--stdio"))))
|
||||||
|
|
||||||
|
|
||||||
|
(provide 'init-python)
|
||||||
15
recentf
15
recentf
@@ -1,11 +1,16 @@
|
|||||||
;;; Automatically generated by ‘recentf’ on Sun Dec 14 23:02:01 2025 -*- mode: emacs-lisp; lexical-binding: t -*-
|
;;; Automatically generated by ‘recentf’ on Sun Dec 14 23:44:36 2025 -*- mode: emacs-lisp; lexical-binding: t -*-
|
||||||
|
|
||||||
(setq recentf-list
|
(setq recentf-list
|
||||||
'(
|
'(
|
||||||
"~/.emacs.d/lisp/init-cc.el"
|
"~/.emacs.d/lisp/a.py"
|
||||||
"~/programming/leetcode/2.c"
|
"~/.emacs.d/lisp/init-python.el"
|
||||||
"~/.emacs.d/lisp/init-lsp.el"
|
|
||||||
"~/.emacs.d/init.el"
|
"~/.emacs.d/init.el"
|
||||||
|
"~/.emacs.d/lisp/init-completion.el"
|
||||||
|
"~/.emacs.d/lisp/init-lsp.el"
|
||||||
|
"~/.emacs.d/lisp/init-cc.el"
|
||||||
|
"~/programming/leetcode/test.cpp"
|
||||||
|
"~/programming/leetcode/2.c"
|
||||||
|
"~/.emacs.d/.gitignore"
|
||||||
"~/.emacs.d/lisp/init-better-default.el"
|
"~/.emacs.d/lisp/init-better-default.el"
|
||||||
"~/.emacs.d/url/cookies"
|
"~/.emacs.d/url/cookies"
|
||||||
"~/.config/fish/config.fish"
|
"~/.config/fish/config.fish"
|
||||||
@@ -16,11 +21,9 @@
|
|||||||
"~/.emacs.d/lisp/init-typst.el"
|
"~/.emacs.d/lisp/init-typst.el"
|
||||||
"~/build-emacs-for-macos/builds/Emacs.app/Contents/Resources/lisp/loaddefs.el.gz"
|
"~/build-emacs-for-macos/builds/Emacs.app/Contents/Resources/lisp/loaddefs.el.gz"
|
||||||
"~/.config/emacs_bak/doom/config.org"
|
"~/.config/emacs_bak/doom/config.org"
|
||||||
"~/.emacs.d/.gitignore"
|
|
||||||
"~/.emacs.d/lisp/init-org.el"
|
"~/.emacs.d/lisp/init-org.el"
|
||||||
"~/org/roam/20251212003211-presentation_of_group.org"
|
"~/org/roam/20251212003211-presentation_of_group.org"
|
||||||
"~/.emacs.d/lisp/init-tex.el"
|
"~/.emacs.d/lisp/init-tex.el"
|
||||||
"~/.emacs.d/lisp/init-completion.el"
|
|
||||||
"~/.emacs.d/lisp/init-edit.el"
|
"~/.emacs.d/lisp/init-edit.el"
|
||||||
"~/org/roam/20251117171745-emacs.org"
|
"~/org/roam/20251117171745-emacs.org"
|
||||||
"~/.emacs.d/lisp/init-ui.el"
|
"~/.emacs.d/lisp/init-ui.el"
|
||||||
|
|||||||
Reference in New Issue
Block a user