Adopt seagle0128/doom-modeline for :ui modeline
And remove obsolete :ui doom-modeline module. Relevant to: #136, #921
This commit is contained in:
parent
868bd15abe
commit
8832737671
17 changed files with 90 additions and 1944 deletions
|
@ -1,8 +1,5 @@
|
|||
;;; lang/python/autoload/python.el -*- lexical-binding: t; -*-
|
||||
|
||||
(defvar +python-version-cache (make-hash-table :test 'equal)
|
||||
"TODO")
|
||||
|
||||
;;;###autoload
|
||||
(defun +python/open-repl ()
|
||||
"Open the Python REPL."
|
||||
|
@ -38,53 +35,3 @@
|
|||
(let ((python-shell-interpreter "jupyter")
|
||||
(python-shell-interpreter-args (format "console %s" (string-join +python-jupyter-repl-args " "))))
|
||||
(+python/open-repl)))
|
||||
|
||||
(defun +python--extract-version (prefix str)
|
||||
(when str
|
||||
(format "%s%s" prefix (cadr (split-string str " ")))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +python-version ()
|
||||
"Return the currently installed version of python on your system or active in
|
||||
the current pipenv.
|
||||
|
||||
This is not necessarily aware of env management tools like virtualenv, pyenv or
|
||||
pipenv, unless those tools have modified the PATH that Emacs picked up when you
|
||||
started it."
|
||||
(condition-case _
|
||||
(if-let* ((proot (and (fboundp 'pipenv-project-p)
|
||||
(pipenv-project-p))))
|
||||
(let* ((default-directory proot)
|
||||
(v (car (process-lines "pipenv" "run" "python" "--version"))))
|
||||
(puthash proot
|
||||
(+python--extract-version "Pipenv " v)
|
||||
+python-version-cache))
|
||||
(puthash (or (doom-project-root) default-directory)
|
||||
(+python--extract-version
|
||||
"Python "
|
||||
(car (process-lines python-shell-interpreter "--version")))
|
||||
+python-version-cache))
|
||||
(error "Python")))
|
||||
|
||||
|
||||
;;
|
||||
;; Hooks
|
||||
|
||||
;;;###autoload
|
||||
(defun +python|update-version (&rest _)
|
||||
"Update `+python--version' by consulting `+python-version' function."
|
||||
(setq +python--version
|
||||
(or (gethash (or (and (fboundp 'pipenv-project-p)
|
||||
(pipenv-project-p))
|
||||
(doom-project-root)
|
||||
default-directory)
|
||||
+python-version-cache)
|
||||
(+python-version))))
|
||||
|
||||
;;;###autoload
|
||||
(defun +python|update-version-in-all-buffers (&rest _)
|
||||
"Update `+python-version' in all buffers in `python-mode'."
|
||||
(dolist (buffer (doom-buffers-in-mode 'python-mode))
|
||||
(setq +python-version-cache (clrhash +python-version-cache))
|
||||
(with-current-buffer buffer
|
||||
(+python|update-version))))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue