Open evertrol opened 2 years ago
encountered this same problems many times in the last few weeks in both macOS and Debian.
Same here for me. My config:
Emacs.............: 28.2
Elpy..............: Not found (Python), 1.35.0 (Emacs Lisp)
Virtualenv........: None
Interactive Python: python3 3.10.9 (/usr/bin/python3)
RPC virtualenv....: rpc-venv (/home/aheinle/.emacs.d/elpy/rpc-venv)
Python...........: python nil (/home/aheinle/.emacs.d/elpy/rpc-venv/bin/python)
Jedi.............: Not found
Rope.............: Not found
Autopep8.........: Not found
Yapf.............: Not found
Black............: Not found
Syntax checker....: Not found (flake8)
I also run into this a lot, and I just enabled toggle-debug-on-quit
and hammered C-g
, which gave me the following stack trace:
Debugger entered--Lisp error: (quit)
re-search-forward("\\s|" nil t)
python-nav-end-of-statement()
python-nav-end-of-defun()
python-info-current-defun()
run-hook-with-args-until-success(python-info-current-defun)
which-function()
which-func-update-1(#<window 9 on dtw.py>)
which-func-update()
apply(which-func-update nil)
timer-event-handler([t 0 0 500000 t which-func-update nil idle 0 nil])
The python-
functions are from python.el
, so this might actually be a bug from there?
EDIT: Yes, there's a bug report on the mailing list here
EDIT2: There's another very similar bug which is apparently fixed in emacs 29, so we might just have to wait for that to be released.
Summary
When I enter a string, starting with a single quote, under some circumstances, this will freeze Emacs, presumably because Elpy freezes or otherwise stalls.
At that point, I can exit emacs with C-g C-g (running in non-window mode), then kill the current process (i.e., emacs) from the command line, but nothing otherwise afaict. Since this is not the normal way to suspend or stop Emacs, I assume it's a running background process that causes Emacs to hang.
Steps to reproduce
I've managed to trace it to the following minimal Python code to open in Emacs:
Now, typing a single quote,
'
, on the empty line abovetext = ...
, at the same indentation, and waiting a second, will cause Emacs to freeze. One way to prevent this seems to be to type''
quickly enough that Elpy doesn't kick in, then fill in the actual string contents. Also, a single double opening quote doesn't cause this either.I do seem to need the lines with the triple quotes, single function call, and function call with the empty string.
My configuration & OS
I'm running Emacs on macOS 13.0.1, through a Homebrew installation, in iTerm (same issue in Terminal, not surprisingly). My Python interpreter is installed with PyEnv; no idea how relevant this is.
I have tried this on Ubuntu 22.04 as well, but there is no problem there. So it seems to be related to macOS or my specific setup there.
I have seen a few possibly related, but older issues, on freezes (one specifically Macos related), but I can't tell whether that amounts to the same thing. I'm unfortunately too unfamiliar with Emacs and the Emacs package eco-system to be able to debug this further.
Result of
(elpy-config)
Elpy configuration in my init.el
This is the full, minimal,
init.el
that I need to reproducce this problem.