Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed freezing emacs when no input is provided to the meow-visit minibuffer #602

Merged
merged 6 commits into from
Jun 2, 2024

Conversation

bunnyanon
Copy link
Contributor

When (meow-visit) is invoked and no input is provided in the minibuffer, Emacs freezes and hogs a CPU core.

this change adds a verification if text is empty, and if it is, visit-point is set to nil, triggering a visit failed message for the user.

It also adds a custom error message for this case, it being Visit <empty> failed.

@eshrh
Copy link
Member

eshrh commented Jun 1, 2024

Thanks! This is definitely a bug.

Would you mind changing your indentation to use spaces instead of tabs? Your patch also currently touches more lines than necessary.

@bunnyanon
Copy link
Contributor Author

Sure! indentations fixed!

@eshrh eshrh merged commit 090f7a4 into meow-edit:master Jun 2, 2024
3 checks passed
@eshrh
Copy link
Member

eshrh commented Jun 2, 2024

Originally I thought that this was probably the best way since it seems that completing-read has no built in way to disallow empty input no matter what you do; and that it's impossible to message the user about the error without using sit-for or timers.

Then I realized just now that you should probably loop until the user gives non-empty input and change the prompt itself which seems like a more user-friendly solution. Failing and stopping like in your patch is usually correct (assume the user knows what they're doing), but in this case there is literally no case where the user wants to visit empty strings -- it's invalid input and therefore shouldn't be allowed at the input stage. I went ahead and wrote this in f1bfad9. Sorry about that, but thanks again for the good catch.

eshrh added a commit that referenced this pull request Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants