evil-open-line in python src block is extremely slow
et2010 opened this issue · 1 comments
et2010 commented
Issue type
- Bug report
Environment
Emacs version: GNU Emacs 27.0.50 (build 1, x86_64-w64-mingw32)
Operating System: Windows 8.1
Evil version: Evil version evil-git-bb013ef99
Evil installation type: MELPA
Graphical/Terminal: Graphical
Tested in a make emacs
session (see CONTRIBUTING.md): No
Reproduction steps
- Start Emacs
- Open an org file
- Insert a Python src block
- Move cursor onto the src block
- Call
evil-open-line
witho
Expected behavior
Open a line without perceptible slowdown
Actual behavior
Opening a line takes 4-5 seconds
Further notes
Opening line in other code blocks such as elisp blocks doesn't suffer from this behavior.
et2010 commented
I found a workaround by disabling auto-indent when the cursor is in python src-block:
(defvar et/evil-open-line-no-indent-langs '("python" "ipython"))
(defun evil-open-no-autoindent (oldfun arg)
(if (and evil-auto-indent
(eq major-mode 'org-mode)
(member (org-eldoc-get-src-lang) et/evil-open-line-no-indent-langs))
(let ((evil-auto-indent nil))
(funcall oldfun arg))
(funcall oldfun arg)))
(advice-add #'evil-open-above :around #'evil-open-no-autoindent)
(advice-add #'evil-open-below :around #'evil-open-no-autoindent)