Merge pull request #1903 from gagbo/feature/cython-flag

lang/python: add +cython feature
This commit is contained in:
Henrik Lissner 2019-10-17 03:04:04 -04:00 committed by GitHub
commit e201d139b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 0 deletions

View file

@ -25,6 +25,7 @@ Adds Python support to Doom Emacs.
+ ~+lsp~ Language Server Protocol support + ~+lsp~ Language Server Protocol support
+ ~+pyenv~ Python virtual environment support via [[https://github.com/pyenv/pyenv][pyenv]] + ~+pyenv~ Python virtual environment support via [[https://github.com/pyenv/pyenv][pyenv]]
+ ~+conda~ Python virtual environment support via [[https://conda.io/en/latest/][Conda]] + ~+conda~ Python virtual environment support via [[https://conda.io/en/latest/][Conda]]
+ ~+cython~ Cython files support via [[https://github.com/cython/cython/blob/master/Tools/cython-mode.el][Cython-mode]]
** Plugins ** Plugins
+ [[https://github.com/pythonic-emacs/anaconda-mode][anaconda-mode]]* + [[https://github.com/pythonic-emacs/anaconda-mode][anaconda-mode]]*
@ -43,6 +44,9 @@ Adds Python support to Doom Emacs.
+ ~+lsp~ and ~:tools lsp~ + ~+lsp~ and ~:tools lsp~
+ [[https://github.com/emacs-lsp/lsp-mode][lsp]] + [[https://github.com/emacs-lsp/lsp-mode][lsp]]
+ [[https://github.com/emacs-lsp/lsp-python-ms][lsp-python-ms]]* + [[https://github.com/emacs-lsp/lsp-python-ms][lsp-python-ms]]*
+ ~+cython~
+ [[https://github.com/cython/cython/blob/master/Tools/cython-mode.el][Cython-mode]]
+ ~:tools flycheck~ [[https://github.com/lbolla/emacs-flycheck-cython/tree/master][Flycheck-cython]]
* Prerequisites * Prerequisites
This module has no direct prerequisites. Here are some of its soft dependencies. This module has no direct prerequisites. Here are some of its soft dependencies.
@ -63,6 +67,8 @@ This module has no direct prerequisites. Here are some of its soft dependencies.
+ ~pipenv~ requires [[https://pipenv.readthedocs.io/en/latest/][pipenv]] + ~pipenv~ requires [[https://pipenv.readthedocs.io/en/latest/][pipenv]]
+ ~cython~ requires [[https://cython.org/][Cython]]
** Language Server Protocol Support ** Language Server Protocol Support
Requires the ~+lsp~ flag and ~:tools lsp~ module to be enabled. Requires the ~+lsp~ flag and ~:tools lsp~ module to be enabled.
By default LSP will use Microsoft's language server if installed. By default LSP will use Microsoft's language server if installed.
@ -86,6 +92,7 @@ To enable support for auto-formatting with black enable ~:editor format-all~ in
| Binding | Description | | Binding | Description |
|---------------------+----------------------------------| |---------------------+----------------------------------|
| ~<localleader> c c~ | ~Compile Cython buffer~ |
| ~<localleader> i i~ | ~Insert mising imports~ | | ~<localleader> i i~ | ~Insert mising imports~ |
| ~<localleader> i r~ | ~Remove unused imports~ | | ~<localleader> i r~ | ~Remove unused imports~ |
| ~<localleader> i s~ | ~Sort imports~ | | ~<localleader> i s~ | ~Sort imports~ |

View file

@ -276,3 +276,19 @@ called.")
(defadvice! +python--dont-auto-install-server-a () (defadvice! +python--dont-auto-install-server-a ()
:override #'lsp-python-ms--command-string :override #'lsp-python-ms--command-string
lsp-python-ms-executable)) lsp-python-ms-executable))
(use-package! cython-mode
:when (featurep! +cython)
:mode "\\.p\\(yx\\|x[di]\\)\\'"
:config
(setq cython-default-compile-format "cython -a %s")
(map! :map cython-mode-map
:localleader
:prefix "c"
:desc "Cython compile buffer" "c" #'cython-compile))
(use-package! flycheck-cython
:when (featurep! :tools flycheck)
:after cython-mode)

View file

@ -3,6 +3,10 @@
;; Major modes ;; Major modes
(package! pip-requirements) (package! pip-requirements)
(when (featurep! +cython)
(package! cython-mode)
(when (featurep! :tools flycheck)
(package! flycheck-cython)))
;; LSP ;; LSP
(when (featurep! +lsp) (when (featurep! +lsp)