Closed
Description
I am using emacs 28.0.50 on Mac Monterey and am experiencing a "too many files" open error. After looking at the processes list I see that blacken has many open ones. Specifically blacken-error, All I did was automatically start blacken when opening a python file.
(use-package blacken
:diminish ""
:custom
(blacken-skip-string-normalization t)
(blacken-line-length 120))
(use-package python
:delight " Py"
:mode ("\\.py" . python-mode)
:hook ((python-mode . pyvenv-mode)
(python-mode . blacken-mode)
(python-mode . (lambda () (aaronzinhoo--python-setup))))
:preface
(defun aaronzinhoo--python-buffer-setup ()
(setq python-indent-offset 4)
(setq-local highlight-indentation-offset 4))
(defun aaronzinhoo--activate-python-shell-complettion ()
"Return non-nil if can trigger native completion."
(let ((python-shell-completion-native-enable t)
(python-shell-completion-native-output-timeout
python-shell-completion-native-try-output-timeout))
(python-shell-completion-native-get-completions
(get-buffer-process (current-buffer))
nil "_")))
;;https://lists.gnu.org/archive/html/help-gnu-emacs/2021-09/msg00535.html
;; used to help pyright find venv folders
(defun aaronzinhoo--pyvenv-workon ()
(when (buffer-file-name)
(let* ((python-version ".python-version")
(project-dir (locate-dominating-file (buffer-file-name) python-version)))
(when project-dir
(progn
;; https://github.com/emacs-lsp/lsp-pyright/issues/62#issuecomment-942845406
(lsp-workspace-folders-add project-dir)
(pyvenv-workon
(with-temp-buffer
(insert-file-contents (expand-file-name python-version project-dir))
(car (split-string (buffer-string))))))))))
(defun aaronzinhoo--python-setup ()
(aaronzinhoo--python-buffer-setup)
(aaronzinhoo--pyvenv-workon))
:custom
(python-check-command "flake8")
:init
(setenv "WORKON_HOME" "~/.pyenv/versions")
(add-to-list 'process-coding-system-alist '("python" . (utf-8 . utf-8)))
(with-eval-after-load 'python (defun temp () (aaronzinhoo--activate-python-shell-complettion))))
Metadata
Metadata
Assignees
Labels
No labels