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

doom-one theme: modeline is blue, really blue #125

Closed
ghost opened this issue Nov 16, 2017 · 10 comments
Closed

doom-one theme: modeline is blue, really blue #125

ghost opened this issue Nov 16, 2017 · 10 comments
Labels
is:bug Something isn't working as intended

Comments

@ghost
Copy link

ghost commented Nov 16, 2017

When I start Emacs with doom-one theme, the modeline is blue. I need to define another theme and choose again doom-one to correct this problem temporarily.

@hlissner
Copy link
Member

hlissner commented Dec 6, 2017

Sorry for the incredibly late reply. Am I right to assume you are an Emacs daemon or terminal user?

@ghost
Copy link
Author

ghost commented Dec 7, 2017

Emacs daemon user, yes.

@hlissner
Copy link
Member

hlissner commented Dec 14, 2017

Sorry for the late reply.

This is a known issue with how Emacs initializes themes in daemon sessions. I talked about it (and a workaround) in #73.

Could you give that a try and let me know if it solves your issue?

@hlissner hlissner added the is:bug Something isn't working as intended label Dec 14, 2017
@c0001
Copy link

c0001 commented Jan 19, 2018

@hlissner

Yes it worked for me and I found this forcing method will let the frame blinking for a moment with start new gui with 'emacsclinet -c'.

Can you fix it or upgrade this method for perfect be?

@hlissner
Copy link
Member

hlissner commented Feb 17, 2018

Sorry for the late reply. Unfortunately, if there is a way to avoid the blink, I don't know it. Reloading the theme causes Emacs to redraw, and I'm pretty sure it's unavoidable.

However, I have changed the code slightly:

(defun doom|init-theme ()
  "Set the theme and load the font, in that order."
  (load-theme 'doom-one t)
  (add-hook 'after-make-frame-functions #'doom|init-theme-in-frame))

(defun doom|init-theme-in-frame (frame)
  "Reloads the theme in new daemon or tty frames."
  (when (or (daemonp) (not (display-graphic-p)))
    (with-selected-frame frame
      (doom|init-theme))))

(add-hook 'emacs-startup-hook #'doom|init-theme)

Perhaps it will work better for you.

@vodik
Copy link

vodik commented Mar 13, 2018

The key to avoiding the blink is that load-theme should be called once and only once inside init-theme-in-frame. The first time the hook it called, the theme is properly applied and will work for all future frames. Every subsequent call reloads the theme and causes the flickering.

Try this:

(defun doom|init-theme ()
  (load-theme 'doom-one t)
  (load-theme 'airline-doom-one t))

(defun doom|init-theme-in-frame (frame)
  (with-selected-frame frame
    (doom|init-theme))

  ;; Unregister this hook once its run
  (remove-hook 'after-make-frame-functions
	       'doom|init-theme-in-frame))

(if (daemonp)
    (add-hook 'after-make-frame-functions
	      'doom|init-theme-in-frame)
  (doom|init-theme))

@hlissner
Copy link
Member

@vodik the problem is how you create that first frame. If you create a terminal frame (emacsclient -nw), your emacs session is initialized with a terminal rendering of the theme. Start a graphical frame (emacsclient -c) and you get the opposite. Only load the theme once snd you’re stuck with one or the other.

If you can keep to one or the other, your solution works, but if you use them interchangeably, you have issues. Like, for instance, when you run a daemon server which you use gui frames for at home and terminal frames for from abroad (e.g. through ssh).

Perhaps a better approach is reload the theme, but only when a new frame type is detected?

@vodik
Copy link

vodik commented Mar 13, 2018

Well honestly, my terminal session looks like its rendering correctly, for what its worth.

Yeah, I see the ugly blue has returned to my GUI session.

@vodik
Copy link

vodik commented Mar 13, 2018

Perhaps a better approach is reload the theme, but only when a new frame type is detected?

I like this idea, might not be a bad idea to publish it as its own package. Seems like its a general emacs problem.

hlissner added a commit that referenced this issue Aug 4, 2018
@hlissner
Copy link
Member

hlissner commented Aug 4, 2018

As of 1cdc201, this issue should be resolved. Feel free to reopen this if that isn't the case.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
is:bug Something isn't working as intended
Projects
None yet
Development

No branches or pull requests

3 participants