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

Emacs crashes when xwidget mode is enabled #6

Closed
andykuszyk opened this issue Oct 21, 2022 · 8 comments
Closed

Emacs crashes when xwidget mode is enabled #6

andykuszyk opened this issue Oct 21, 2022 · 8 comments

Comments

@andykuszyk
Copy link

I saw your post on Reddit and this package looks really interesting!

I built emacs 28.2 from source with xwidget support.

I normally use exwm, although I tried in i3 as well.

In both cases, when I enabled xwidget mode on a simple markdown file, emacs crashed immediately.

Let me know if I can provide any further information or logs.

@cfclrk
Copy link
Owner

cfclrk commented Oct 21, 2022

Oof, that doesn't sound good! Can you try running M-x xwidget-webkit-browse-url to see if you can visit a webpage? If that doesn't work, it's some kind of problem with xwidget-webkit.

@andykuszyk
Copy link
Author

You're right, this was an issue with xwidget support for me.

I solved it by following the instructions here: https://www.emacswiki.org/emacs/EmacsXWidgets. Specifically by launching emacs this way:

SNAP=1 SNAP_NAME=1 SNAP_REVISION=1 src/emacs

However, whilst this prevented emacs from crashing, the xwidget buffer was flickering rapidly and was unusable.

I solved this problem by following these instructions: akirakyle/emacs-webkit#18 (comment)

This resulted in the xwidget buffer being rendered correctly.

It looks great, but then I found that mermaid diagrams weren't rendered, and we're just rendered as an empty code block.

Would you like me to raise a new issue for this?

@cfclrk
Copy link
Owner

cfclrk commented Oct 24, 2022

Nice troubleshooting!

Regarding the mermaid thing: how exactly did you specify the dependency on markdown-xwidget in your emacs config?

Some maybe-applicable context:

Mermaid diagrams are rendered via javascript (interestingly, that's how GitHub does it too; they don't actually render the diagram on their servers, they just include a link to mermaid.js and browsers render the diagrams client-side).

So, it could be something with javascript not executing in your xwidget-webkit buffer, or it could be that the relative paths to the necessary javascript/css/html resources are mangled, or maybe the local javascript resources aren't there at all.

If you use straight, you won't get the necessary javascript/html/css files unless you specify the :files directive as below:

:straight (markdown-xwidget
             :type git
             :host github
             :repo "cfclrk/markdown-xwidget"
             :files (:defaults "resources"))

Other package managers should have similar means to deal with multi-file packages.

@cfclrk
Copy link
Owner

cfclrk commented Oct 31, 2022

Hey friend! I'm going to close this issue since it's nominally about Emacs crashing, which you got sorted out.

If you try this out again and mermaid doesn't work, mind opening another issue?

@cfclrk cfclrk closed this as completed Oct 31, 2022
@andykuszyk
Copy link
Author

Hey friend! I'm going to close this issue since it's nominally about Emacs crashing, which you got sorted out.

If you try this out again and mermaid doesn't work, mind opening another issue?

No problem, thanks for steering me in the right direction. I did t try again with mermaid in the end, but I did try the configuration in your README without success.

If I follow it up and have problems, I'll open another issue 🙂

@cfclrk
Copy link
Owner

cfclrk commented Oct 31, 2022

Ugh, I think I know what happened. It turns out I tested the mermaid support using multimarkdown and not with pandoc. I'll bet you're using pandoc.

It seems like pandoc creates slightly different HTML, which is incompatible with mermaid. I'm sure I can address that somehow; I just have to figure something out.

@andykuszyk
Copy link
Author

Ugh, I think I know what happened. It turns out I tested the mermaid support using multimarkdown and not with pandoc. I'll bet you're using pandoc.

It seems like pandoc creates slightly different HTML, which is incompatible with mermaid. I'm sure I can address that somehow; I just have to figure something out.

Yep, I was using pandoc 👍

@Schievel1
Copy link

Issue like this will come up more often in the future I guess.
Emacs crashes when markdown-xwidget is started with newer version of webkitgtk. But there is nothing we can do about it atm
https://www.reddit.com/r/emacs/comments/17g6npv/xwidgetwebkit_has_started_crashing_emacs_sessions/

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

No branches or pull requests

3 participants