doomemacs / doomemacs/core

Emacs freezes when calling `save-some-buffers` with Ivy open

Open
#5,236 0 comments 0 reactions 0 assignees View on GitHub
is:bug needs-triage
Dominant language
Emacs Lisp
Stars
22.7k
Forks
3.1k
Avg merge
10h 46m
Merged PRs (30d)
4

Description

### What did you expect to happen?

Calling `(save-some-buffers t)` or doing `C-x s` when the Ivy selection window is open freezes emacs after pressing escape, to the point where the only way out is to `pkill -9 emacs`.

This is especially annoying since my private config auto saves all buffers on focus loss, making emacs freeze each time I move focus to another window while the Ivy selector is open:
```elisp
;; Auto save buffers on focus lost
(add-function :after after-focus-change-function (lambda () (save-some-buffers t)))
;; Exit insert mode on focus loss
(add-function :after after-focus-change-function (lambda () (evil-normal-state)))
```

Instead of crashing, I would expect all unsaved buffers to be saved an Ivy to continue working normally.

### What actually happened?

I don't have any logs, since emacs completely freezes. I tried [this approach](https://discourse.doomemacs.org/t/what-is-a-backtrace-how-to-produce-them/85#from-frozen-emacs), but this gives the same error as when pressing escape in Ivy normally, without first doing the `C-x s`. Somewhat surprisingly, the `debug-on-quit` error does show up fine, but emacs still freezes after trying to close that buffer.

### Describe your attempts to resolve the issue

The error is reproducible in the vanilla doom config (`SPC h E` -> `C-c C-p`).

The error is probably related to Ivy, but trying to reproduce it in the vanilla Ivy configuration didn't work (possibly because I don't really know how to use emacs without evil mode).

### Steps to reproduce

1. Open the vanilla doom + modules configuration `SPC h E` `C-c C-p`
2. Open Ivy, e.g. `SPC :`
3. type some chars, e.g. `abc`
4. Call `save-some-buffers` by doing `C-x s`
5. type some more chars
6. press `ESC`
7. Emacs is now frozen

### System Information

https://pastebin.com/KS7fhXyj

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.