My setup: Emacs 27.1 under Ubuntu 20.04 from Kevin Kelley's PPA, and configured to use ligatures with the JetBrains Mono fonts, as described here.

I experiencing Bug#45038 27.1; blank display, or something very much like it.

On some modes (for example when I am trying to open my ~/.emacs.d/init.el file, when my window is more than 115 columns wide, my screen go blank.

Using trial and error, I found that when I disable the auto-composition-mode this doesn't happen, however this also disables the ligature support.

So I am trying my hand at writing this workaround:

(defun my/wa-45038 (frame)
  (if (<= (window-width) 115) ; 115 found empirically
        (auto-composition-mode 1)
        (message "auto composition on")
    (auto-composition-mode 0)
    (message "auto composition off")

(if (and (window-system)
         (version<= "27.0" emacs-version)
         (version<= emacs-version "27.2")) ; It seems this will not be fixed in 27.2
    (add-to-list 'window-size-change-functions 'my/wa-45038)

I can see it working (by inspecting the *Messages*), however this does not fix my issue, it seems that when I get a blank display my CPU is also pegged at 100% for the single core Emacs runs on, and I suspect my code does not have the chance to be executed.

So my question boils down to: Is there a way to disable auto-composition-mode just before the new window size is set? If so, I will be able to conditionally re-enable it after the new window size was set with my workaround above.

Update: The high CPU load issue, that prevented this workaround from working, was probably due to me, messing up my configuration. I had both old and new code that tried to enable ligatures in different ways and most likely conflicted with itself. Removing the old code fixed the CPU load issue, and the workaround above is now working for me.

Note that the base question remains: Is there a way to [run a command] just before the new window size is set? But now it is mostly for intellectual pursuit.


Your Answer

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

Browse other questions tagged or ask your own question.