ryuslash/mode-icons

presence of (mode-icons-mode) crashes init.el when used in daemon mode

vidjuheffex opened this issue · 2 comments

(add-hook 'after-make-frame-functions ‘mode-icons-mode)
Doesnt seem to fix it either.

rgd commented

I don't know if this is still an issue for you, but I've sort of worked around it by adding something like this in my init.el (I'm 'paraphrasing' as I've got things split up into a number of elisp files and I'll just put the relevant portions here):

(defun my/invoke-post-setup-frame (frame)
 (with-selected-frame frame
    (my/post-setup-frame) ) )

(defun my/post-setup-frame
  (progn
      ...
     (require 'mode-icons)
     (mode-icons-mode)
     ... ) )
...
(if (daemonp)
 (progn
   (add-to-list 'after-make-frame-functions #'my/invoke-post-setup-frame)
 ) 
 (progn
   ;; if not daemon mode just do it now
   (my/post-setup-frame)
 ) 
)
...

So if I'm starting emacs in daemon mode where there is no frame, it defers the calling of mode-icons-mode (and the require) until after the first frame is created. I'm sure it could be improved but it works pretty well for me on Windows 10 with the Emacs builds from FSF (the pretest 27.0.50 builds here https://alpha.gnu.org/gnu/emacs/pretest/windows/emacs-27/).

(I saw this post because mode-icons doesn't appear to work so well in my setup when using the "emax64" build - takes 30-45 seconds to finish - but it's probably my setup. Just haven't figured it all out yet and going back to the FSF build it works just fine.)

I made some commits recently that should have fixed an issue with daemon mode. Last time I tested everything worked fine, so I hope this issue is fixed now too. I'm optimistically closing this, but if this issue still exists, please feel free to reopen :)