Add support for python and python-ts to v4

This commit is contained in:
Sameer Rahmani 2024-03-25 17:21:04 +00:00
parent aea303fdb0
commit 895294e1c0
Signed by: lxsameer
GPG Key ID: 8741FACBF412FFA5
4 changed files with 109 additions and 3 deletions

View File

@ -66,8 +66,6 @@
ninja-mode
eldoc-cmake
cmake-mode
pyenv-mode
pyvenv
poetry
lsp-pyright
python-black

View File

@ -27,7 +27,9 @@
;; Language support
(require 'fg42/autocomplete)
(require 'fg42/langs/cpp)
(require 'fg42/langs/verilog))
(require 'fg42/langs/verilog)
(require 'fg42/langs/python)
(require 'fg42/langs/elisp))
(require 'server)

46
lisp/fg42/help.el Normal file
View File

@ -0,0 +1,46 @@
;;; 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:
;; emacs --batch --eval=(require 'ox-texinfo) --eval=(find-file "README.org\") --eval=(org-texinfo-export-to-info)
(require ox-texinfo)
(org-texinfo-export-to-info)
(defun build-manual ()
"Build FG42's manual."
(interactive)
(with-temp-buffer
(find-file (file-name-concat (expand-file-name fg42-home) "docs/fg42.org"))
(org-texinfo-export-to-info)))
(defun fg42-manual ()
"Show FG42's manual."
(interactive)
;; TODO: move this to the init script
(add-to-list 'Info-default-directory-list (file-name-concat (expand-file-name fg42-home) "docs/"))
(info "(fg42)"))
(provide 'fg42/help)
;;; help.el ends here

60
lisp/fg42/langs/python.el Normal file
View File

@ -0,0 +1,60 @@
;;; 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