-
Notifications
You must be signed in to change notification settings - Fork 4
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
Emacs loops/segfaults with certain buffer contents in certain major modes #18
Comments
Hi Nathan, Thanks for reporting this. I can confirm that there is a problem. It's quite strange, and I'm surprised it took this long to be found. Yet, it seems to only happen under certain circumstances, ones which I haven't encountered in my own usage, despite using Here's what I did to reproduce:
After the first quotation mark (actually, after I press the key, but before it is displayed) Emacs goes into a 100%-CPU usage loop. If I press If, while Emacs is looping, I send the
I can confirm that the same thing happens in And, of course, typing the I tried using So there may be a bug in Emacs here (because AFAIK Elisp should never be able to cause Emacs to segfault), but maybe also a bug in And, of course, I'm not on an M2 Mac, so that appears to be unrelated to the problem. For reference, what version of Emacs are you using, and where did the build come from? As you said, I suppose one would need to use |
You're most welcome, and thank you in return for Prism.
Thanks, I wasn't aware of
I've reproduced this on the emacs-mac fork which is currently on 28.2, as well as the 28.2 build from emacsformacosx.com which purports to be a straight port with minimal/no changes.
Sure, I'll pursue that this week and report back here with any findings. |
Thank you! |
Hi Nathan, I hope I have fixed it. Please try this commit: ba53105 It seems to work for me with the following test code in Elisp mode, and your test code in Lisp mode, and the HTML snippet: (P"")
(P "")
(P P)
(P"foo bar")
(P "foo bar")
(P "foo")
(P """""") Please test it and let me know if it works for you. (Obviously, be sure to save any work in progress first, or use a separate Emacs session, in case it does still cause Emacs to crash.) Thanks. |
Thanks for this. I'll take a look as soon as able, life's been very hectic lately so I haven't yet been able to put together an emacs bug report to upstream. |
Nevermind, I found that that change causes another bug. I'll continue working on it. |
Ok, this commit seems to fix the problems noted here without causing any new problems: c2d52ed Please test it carefully and let me know what you find. Thanks. |
It seems to be working well, so I merged it to master and released v0.3 with this fix. @nathanvy Please do let me know how it works for you. If there are any more problems, I'll release a fix in v0.3.1. |
Thanks again. I noticed in your commit you mentioned prism isn't intended for HTML. Should I be using |
You can try it, but it's not intended for HTML either. See #16 |
Okay thanks. I basically have been using prism for literally anything, haha. |
I'm glad whereever it works. :) As I described in #16, the Emacs functions for SGML-type languages aren't quite sufficient to do what |
@nathanvy BTW, did you confirm that this issue is fixed by v0.3? |
I've just tested now, while Peppa Pig was parenting my kids. Edit: Just so we're on the same page, I upgraded to latest using In any case, this no longer freezes emacs: (#P"") But this still does, immediately upon typing the doublequote. <html lang="
I'm willing to just cease using Prism for HTML and friends, as a long-term workaround, as it seems the lisp side of things is resolved. |
Thanks I'll test it this evening |
Hello I've also experienced this issue, I tried using the wip/18 branch but it still hangs here. I've was able to narrow it down to this minimum example to reproduce. // I'm a comment
foo = bar The issue seems to be apostrophes in comments, I've disabled prism-comments for now as a workaround. Just FYI to anyone else stumbling across this |
just wanted to note that I also experienced this issue and can confirm that in my case |
@JasZhe @fkr-0 I just pushed another commit to the WIP branch: https://github.com/alphapapa/prism.el/tree/wip/18 It seems to fix that problem. Please test it and let me know if it does for you. Thanks. |
This should hopefully prevent further bugs of the kind mentioned in issue #18 from causing infinite loops (which sometimes cause Emacs to crash).
This should hopefully prevent further bugs of the kind mentioned in issue #18 from causing infinite loops (which sometimes cause Emacs to crash).
I went ahead and pushed v0.3.1 that seems to fix this problem. Please let me know your experience. Thanks. |
I was having this same issue this morning when trying to enable |
@polaris64 Thanks for letting me know. |
Just updated as well. |
Updated to the latest master, re-enabled comments, it no longer freezes emacs, but I do get the infinite loop error message:
using the same example from before in
Thank you for the quick turnaround on this! |
0.3.0 was affected by alphapapa/prism.el#18, thus had to be skipped.
@JasZhe Hm, thanks, I'll look at that. |
Some major modes' syntax tables (like c-mode and go-mode) don't allow for searching for comment-start or comment-delimiter characters, so we must use ppss to determine whether point is in or at a comment. See <#18 (comment)>. Thanks to Jason Zhen (@JasZhe) for reporting.
@JasZhe I just pushed v0.3.2 which should fix that Go example. Please let me know if it works for you. And to all who have chimed in on this issue: Thanks. I didn't know that this package was being used for so many different major modes and languages. And I didn't know that some of those major modes don't work the same way internally with regard to syntax tables, so I've had to make some minor adjustments to compensate for that. In the future, Emacs 29 will likely make this kind of code simpler to write by using tree-sitter. But for now, it's complicated. |
@JasZhe Great, thank you! I didn't think many people were using |
I'm a simple man, I just like seeing more pretty colors in my code :) |
We've gotta keep the fun in computing! BTW, feel free to suggest any screenshots you think might look good in the readme: #19 Your theme seems to fit prism well. |
Hi all,
edit: Original title was "Prism mode causes emacs to freeze/lock up when typing double-quote characters on ARM macbooks"
Title says it all. I am not sure how to debug this further, because emacs hangs entirely and the only way to recover is to force-quit the application. I suppose one could use gdb or another debugger but I am not an expert in that sort of debugging and wouldn't know where to start.
Steps to reproduce:
package.el
pulled down for me).lisp
file and attempt to type the following:(#P"")
which is a Common Lisp pathname literal. I have also seen this when editing HTML and attempting to type<html lang="en">
The text was updated successfully, but these errors were encountered: