Tweak and simplify my Python programming setup.
This commit is contained in:
parent
f73e056459
commit
43049889cf
56
README.org
56
README.org
|
@ -273,17 +273,16 @@ compatibility with Emacs-28.1. The [[info:elisp#Backquote][info:backquote]] pag
|
||||||
`(
|
`(
|
||||||
,@(when (version< emacs-version "28.0")
|
,@(when (version< emacs-version "28.0")
|
||||||
'(org)) ; plain text thought organizer
|
'(org)) ; plain text thought organizer
|
||||||
|
anaconda-mode ; strangles python-mode
|
||||||
auctex ; Aalborg University Center TeX
|
auctex ; Aalborg University Center TeX
|
||||||
blacken ; Black Python-code formatter client
|
blacken ; Black Python-code formatter client
|
||||||
citar ; bibliography handling
|
citar ; bibliography handling
|
||||||
citeproc ; bibliography handling
|
citeproc ; bibliography handling
|
||||||
|
company-anaconda ; complete anything in anaconda-mode
|
||||||
consult ; consult completing-read
|
consult ; consult completing-read
|
||||||
;; eglot ; Emacs polyGLOT LSP client
|
|
||||||
elpy ; Python development environment
|
|
||||||
embark ; act on any buffer selection
|
embark ; act on any buffer selection
|
||||||
htmlize ; convert buffer contents to HTML
|
htmlize ; convert buffer contents to HTML
|
||||||
leuven-theme ; beautiful color theme
|
leuven-theme ; beautiful color theme
|
||||||
;; lsp-mode ; Language Server Protocol client
|
|
||||||
marginalia ; minibuffer margin notes
|
marginalia ; minibuffer margin notes
|
||||||
orderless ; Emacs completion style
|
orderless ; Emacs completion style
|
||||||
pdf-tools ; interactive docview replacement
|
pdf-tools ; interactive docview replacement
|
||||||
|
@ -295,10 +294,7 @@ compatibility with Emacs-28.1. The [[info:elisp#Backquote][info:backquote]] pag
|
||||||
(my-install-packages my-packages)
|
(my-install-packages my-packages)
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
Install the following packages with [[https://github.com/quelpa/quelpa][quelpa]]:
|
Install ~eglot~ with [[https://github.com/quelpa/quelpa][quelpa]] to get the latest version from [[https://melpa.org/#/][MELPA]].
|
||||||
1. ~lisp-ui~ (including ~lisp-mode~), because ~lisp-ui~ is yet available from
|
|
||||||
[[https://elpa.gnu.org/][GNU ELPA]], [[https://elpa.nongnu.org/][NonGNU ELPA]], or [[https://melpa.org/#/][MELPA]].
|
|
||||||
2. ~eglot~ to get the latest version from [[https://melpa.org/#/][MELPA]].
|
|
||||||
|
|
||||||
#+attr_latex: :options bgcolor=LightGoldenrodYellow
|
#+attr_latex: :options bgcolor=LightGoldenrodYellow
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
|
@ -310,10 +306,7 @@ Install the following packages with [[https://github.com/quelpa/quelpa][quelpa]]
|
||||||
(quelpa source)))
|
(quelpa source)))
|
||||||
sources))
|
sources))
|
||||||
(my-install-sources
|
(my-install-sources
|
||||||
'(
|
'((eglot :fetcher github :repo "joaotavora/eglot"))))
|
||||||
;; (lsp-ui :fetcher github :repo "emacs-lsp/lsp-ui")
|
|
||||||
(eglot :fetcher github :repo "joaotavora/eglot")
|
|
||||||
)))
|
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
Install the optional packages.
|
Install the optional packages.
|
||||||
|
@ -676,7 +669,6 @@ below corrects this by advising to override ~TeX-brace-count-line~ with
|
||||||
org-protocol
|
org-protocol
|
||||||
org-tempo))
|
org-tempo))
|
||||||
'(org-src-fontify-natively t)
|
'(org-src-fontify-natively t)
|
||||||
'(org-src-window-setup 'current-window)
|
|
||||||
'(org-structure-template-alist
|
'(org-structure-template-alist
|
||||||
'(("a" . "export ascii")
|
'(("a" . "export ascii")
|
||||||
("c" . "center")
|
("c" . "center")
|
||||||
|
@ -972,35 +964,25 @@ option to run different commands on those selections.
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(with-eval-after-load 'eglot
|
(with-eval-after-load 'eglot
|
||||||
(add-to-list 'eglot-server-programs '(python-mode "pylsp")))
|
(add-to-list 'eglot-server-programs '(python-mode "pylsp"))
|
||||||
|
(setq-default
|
||||||
|
eglot-workspace-configuration
|
||||||
|
`((:pylsp . (:plugins (:jedi_completion (:eager nil))))
|
||||||
|
(:pylsp . (:plugins (:jedi_completion (:cache_for ,(vconcat '("astropy"
|
||||||
|
"numpy"
|
||||||
|
"scipy")))))))))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
** Python coding
|
** Python coding
|
||||||
|
|
||||||
Here, the focus is on three ways to extend Emacs's built-in ~python-mode~ out of
|
Here, the focus is on three ways to extend Emacs's built-in ~python-mode~ out of
|
||||||
the options listed on the [[https://www.emacswiki.org/emacs/PythonProgrammingInEmacs][Python Programming in Emacs]] wiki page:
|
the options listed on the [[https://www.emacswiki.org/emacs/PythonProgrammingInEmacs][Python Programming in Emacs]] wiki page:
|
||||||
1. [[https://elpy.readthedocs.io/en/latest/][Elpy]] is an opinionated Python integrated development environment with its own
|
2. [[https://github.com/joaotavora/eglot][Eglot - Emacs polyGLOT: an Emacs LSP client that stays out of your way]]. The
|
||||||
Python server and its own server protocol. Its main disadvantages are:
|
|
||||||
1. It requires a high number of Elisp and Python packages.
|
|
||||||
2. It imposes its way making it hard to do otherwise for beginners.
|
|
||||||
3. It requires a new maintainer, because the current maintainer has no time
|
|
||||||
anymore for adding new features or squashing hard bugs.
|
|
||||||
Its main advantages are:
|
|
||||||
1. Its usability out of the box.
|
|
||||||
2. Its documentation quality.
|
|
||||||
3. Its compatibility with the Org source block editing mode.
|
|
||||||
2. [[https://emacs-lsp.github.io/lsp-mode/][LSP Mode - Language Server Protocol support for Emacs]] with its [[https://emacs-lsp.github.io/lsp-ui/][LSP-UI]] user
|
|
||||||
interface extensions. According to [[https://github.com/emacs-lsp/lsp-mode/blob/master/docs/manual-language-docs/lsp-org.md][Literate programming using LSP and
|
|
||||||
org-mode(alpha)]], this package tries to be compatible with the Org source
|
|
||||||
block editing mode, but it is not ready for daily usage.
|
|
||||||
3. [[https://github.com/joaotavora/eglot][Eglot - Emacs polyGLOT: an Emacs LSP client that stays out of your way]]. The
|
|
||||||
maintainer also contributes to Emacs itself and has a deep understanding of
|
maintainer also contributes to Emacs itself and has a deep understanding of
|
||||||
[[https://sheer.tj/the_way_of_emacs.html][the Way of Emacs]]. He refuses to add new features without seeing how they fit
|
[[https://sheer.tj/the_way_of_emacs.html][the Way of Emacs]]. He refuses to add new features without seeing how they fit
|
||||||
into [[https://sheer.tj/the_way_of_emacs.html][the Way of Emacs]] as this discussion at [[https://github.com/joaotavora/eglot/issues/523][Eglot github issue: org-mode
|
into [[https://sheer.tj/the_way_of_emacs.html][the Way of Emacs]] as this discussion at [[https://github.com/joaotavora/eglot/issues/523][Eglot github issue: org-mode
|
||||||
source code blocks]] shows.
|
source code blocks]] shows.
|
||||||
|
|
||||||
[[https://emacs.stackexchange.com/questions/45164/does-org-have-any-inverse-tangle-operations-e-g-for-collaborating-with-non-or][Does org have any "inverse-tangle" operations e.g. for collaborating with non-org users?]]
|
|
||||||
|
|
||||||
#+attr_latex: :options bgcolor=LightGoldenrodYellow
|
#+attr_latex: :options bgcolor=LightGoldenrodYellow
|
||||||
#+begin_src python :tangle example.py :comments link
|
#+begin_src python :tangle example.py :comments link
|
||||||
import numpy
|
import numpy
|
||||||
|
@ -1021,20 +1003,6 @@ the options listed on the [[https://www.emacswiki.org/emacs/PythonProgrammingInE
|
||||||
(pyenv-mode-set "3.9.8/envs/python-3.9.8"))
|
(pyenv-mode-set "3.9.8/envs/python-3.9.8"))
|
||||||
#+end_src
|
#+end_src
|
||||||
|
|
||||||
#+begin_src emacs-lisp
|
|
||||||
(when (fboundp 'elpy-enable)
|
|
||||||
(custom-set-variables
|
|
||||||
'(elpy-modules '(elpy-module-sane-defaults
|
|
||||||
elpy-module-company
|
|
||||||
elpy-module-eldoc
|
|
||||||
elpy-module-pyvenv))
|
|
||||||
'(elpy-project-root-finder-functions '(elpy-project-find-python-root
|
|
||||||
elpy-project-find-git-root
|
|
||||||
elpy-project-find-hg-root))
|
|
||||||
`(elpy-rpc-ignored-buffer-size ,(lsh 1 18))
|
|
||||||
'(elpy-rpc-virtualenv-path 'current)))
|
|
||||||
#+end_src
|
|
||||||
|
|
||||||
#+attr_latex: :options bgcolor=LightGoldenrodYellow
|
#+attr_latex: :options bgcolor=LightGoldenrodYellow
|
||||||
#+begin_src emacs-lisp
|
#+begin_src emacs-lisp
|
||||||
(with-eval-after-load 'info
|
(with-eval-after-load 'info
|
||||||
|
|
Loading…
Reference in New Issue