FG42/lisp/fg42/langs/python.el

61 lines
1.8 KiB
EmacsLisp

;;; FG42 --- The mighty editor for the emacsians -*- lexical-binding: t; -*-
;;
;; Copyright (c) 2010-2024 Sameer Rahmani & Contributors
;;
;; Author: Sameer Rahmani <lxsameer@gnu.org>
;; URL: https://devheroes.codes/FG42/FG42
;; Version: 3.0.0
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.
;;
;;; Commentary:
;;; Code:
(eval-when-compile
(require 'fpkg))
(use! python-black
"This cube reformats python code using black formatter tool."
:commands (python-black-on-save-mode
python-black-buffer
python-black-region
python-black-statement)
:hook (python-mode . python-black-on-save-mode))
(use! poetry
"Poetry support for FG42. To use it, just use `M-x poetry'."
:config
(setq poetry-tracking-strategy 'switch-buffer)
:hook (python-mode . poetry-tracking-mode))
(use! python-ts-mode
"Python setup. We're using treesitter version of python mode."
:init
;; Remap the standard python mode
(add-to-list 'major-mode-remap-alist '(python-mode . python-ts-mode))
:config
(setq python-indent-guess-indent-offset-verbose nil)
:hook
(python-ts-mode . eglot-ensure)
(python-ts-mode . company-mode)
(python-ts-mode . flyspell-prog-mode))
(provide 'fg42/langs/python)
;;; python.el ends here