2

I'm using Arch Linux, i3wm and emacs 27.1, and I'm having an issue where emacs hangs when opening certain files, but I can't seem to find a pattern as to which files cause the hang.

When emacs hangs, I can't interact with it in any way. C-g does nothing, I have to kill it using xkill. htop shows that emacs -Q is running at 99% CPU usage.

So far in my testing, it hangs when I open my picom.conf file and my i3 config file, both of which are in a .dotfiles directory and symlinked to my .config directory. Other files in my .dotfiles directory open with no issue. I tried copying picom.conf to my home directory, still causes the freeze. I tried renaming the copy of picom.conf to just textfile thinking maybe it was having issues with the .conf suffix, but still freezes.

When I run emacs in the terminal, the freeze doesn't happen, the window opens just fine.

So far, any file that causes the freeze does so 100% of the time that I try to open it, any file that doesn't cause the freeze doesn't do so 100% of the time that I try to open it.

What are my next steps in troubleshooting this issue?

EDIT: I've narrowed the issue down a little bit thanks to some help from a reddit user. It looks like the crash is happening in files with special (unicode?) characters. My picom.conf file has a japanese character, and my i3 configuration file has font awesome icons embedded. Vim opens these fine, terminal emacs opens them fine, but GUI emacs crashes. Removing the offending characters makes it so that I can open the files in GUI emacs without crashing, but unfortunately, those characters serve an important purpose in my i3 config.

I don't think this is intended behavior, but I can't seem to find examples of my exact issue.

6
  • 1
    I would start to lock at font locking. If both affected files have a .conf suffix, probably the font locking code for conf-mode may be involved.
    – Martin
    Mar 11, 2021 at 15:46
  • @Martin Thanks for the suggestion, took a look at it. Seemed like a promising lead, but disabling global-font-lock-mode didn't prevent the freeze from happening when I opened a file that had an offending character. Mar 11, 2021 at 17:58
  • 1
    Try using a different font, Emacs has a rather weird approach to handling them.
    – wasamasa
    Mar 12, 2021 at 7:40
  • 1
    Have the same problem when using GUI. Tried it with Emacs 27.1 and 28.0.50 (native-comp) and Emacs -Q and multiple fonts.
    – Hubisan
    Mar 14, 2021 at 16:36
  • 2
    Found a solution that at least worked for me: Removed all fonts I've installed and refreshed the font cache. Looks like a font I was not using at all was responsible for the crash/freeze.
    – Hubisan
    Mar 14, 2021 at 21:44

1 Answer 1

1

I think I might find a solution while solving my own problem displaying special chinese characters.

Add this to your emacs config file, change big5 to the charset that character belongs to. You can view list of character set by M-x list-character-sets

(set-fontset-font "fontset-default" 'big5 "Noto Sans Mono CJK TC")

This works for me

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.