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")
|
||||
'(org)) ; plain text thought organizer
|
||||
anaconda-mode ; strangles python-mode
|
||||
auctex ; Aalborg University Center TeX
|
||||
blacken ; Black Python-code formatter client
|
||||
citar ; bibliography handling
|
||||
citeproc ; bibliography handling
|
||||
company-anaconda ; complete anything in anaconda-mode
|
||||
consult ; consult completing-read
|
||||
;; eglot ; Emacs polyGLOT LSP client
|
||||
elpy ; Python development environment
|
||||
embark ; act on any buffer selection
|
||||
htmlize ; convert buffer contents to HTML
|
||||
leuven-theme ; beautiful color theme
|
||||
;; lsp-mode ; Language Server Protocol client
|
||||
marginalia ; minibuffer margin notes
|
||||
orderless ; Emacs completion style
|
||||
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)
|
||||
#+end_src
|
||||
|
||||
Install the following packages with [[https://github.com/quelpa/quelpa][quelpa]]:
|
||||
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]].
|
||||
Install ~eglot~ with [[https://github.com/quelpa/quelpa][quelpa]] to get the latest version from [[https://melpa.org/#/][MELPA]].
|
||||
|
||||
#+attr_latex: :options bgcolor=LightGoldenrodYellow
|
||||
#+begin_src emacs-lisp
|
||||
@ -310,10 +306,7 @@ Install the following packages with [[https://github.com/quelpa/quelpa][quelpa]]
|
||||
(quelpa source)))
|
||||
sources))
|
||||
(my-install-sources
|
||||
'(
|
||||
;; (lsp-ui :fetcher github :repo "emacs-lsp/lsp-ui")
|
||||
(eglot :fetcher github :repo "joaotavora/eglot")
|
||||
)))
|
||||
'((eglot :fetcher github :repo "joaotavora/eglot"))))
|
||||
#+end_src
|
||||
|
||||
Install the optional packages.
|
||||
@ -676,7 +669,6 @@ below corrects this by advising to override ~TeX-brace-count-line~ with
|
||||
org-protocol
|
||||
org-tempo))
|
||||
'(org-src-fontify-natively t)
|
||||
'(org-src-window-setup 'current-window)
|
||||
'(org-structure-template-alist
|
||||
'(("a" . "export ascii")
|
||||
("c" . "center")
|
||||
@ -972,35 +964,25 @@ option to run different commands on those selections.
|
||||
|
||||
#+begin_src emacs-lisp
|
||||
(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
|
||||
|
||||
** Python coding
|
||||
|
||||
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:
|
||||
1. [[https://elpy.readthedocs.io/en/latest/][Elpy]] is an opinionated Python integrated development environment with its own
|
||||
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
|
||||
2. [[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
|
||||
[[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
|
||||
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
|
||||
#+begin_src python :tangle example.py :comments link
|
||||
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"))
|
||||
#+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
|
||||
#+begin_src emacs-lisp
|
||||
(with-eval-after-load 'info
|
||||
|
Loading…
x
Reference in New Issue
Block a user