AnthonyDiGirolamo / airline-themes

vim-airline themes https://github.com/vim-airline/vim-airline-themes for emacs powerline https://github.com/milkypostman/powerline
MIT License
123 stars 20 forks source link

Using use-package to load airline-themes breaks emacsclient #25

Closed justinjk007 closed 7 years ago

justinjk007 commented 7 years ago
(use-package powerline
  :config
  (use-package airline-themes
    :config
    (if (daemonp)
        (add-hook 'after-make-frame-functions
                  (lambda (frame)
                    (select-frame frame)
                    (load-theme 'airline-solarized-alternate-gui)))
      (load-theme 'airline-solarized-alternate-gui))
    ))

This is what I have in my config

In the past when I was not using use package this is what I used and this cleared all problems with emacsclient failing

;;source --> https://github.com/AnthonyDiGirolamo/airline-themes
(add-to-list 'load-path "~/.emacs.d/elpa/airline-themes")
(require 'airline-themes)
(if (daemonp)
    (add-hook 'after-make-frame-functions
              (lambda (frame)
                (select-frame frame)
                (load-theme 'airline-solarized-alternate-gui)))
  (load-theme 'airline-solarized-alternate-gui))

Any clue how to fix this thanks

AnthonyDiGirolamo commented 7 years ago

I'm not sure if you can nest use-package reliably. Try this:

(use-package powerline)

(use-package airline-themes
  :after powerline
  :config
  (if (daemonp)
      (add-hook 'after-make-frame-functions
                (lambda (frame)
                  (select-frame frame)
                  (load-theme 'airline-solarized-alternate-gui)))
    (load-theme 'airline-solarized-alternate-gui)))

For what it's worth I am using almost the same in my config but without using the :after property. It is a nice way to define load order though.

justinjk007 commented 7 years ago

Doing that I get the same error on terminal when trying to start the client, which is

*ERROR*: Unable to find theme file for `airline-solarized-alternate-gui'

No problem with the just emacs thou, only problem is the client works for the first time, then if we close it and start the client again, it spits out the error and vanishes.

AnthonyDiGirolamo commented 7 years ago

Hmm, I'm not sure what's going on. I tried your use-package invocation exactly as is within my config and am not getting that error.

I launch emacs --daemon and then start emacsclient -c. A new frame is created with the *scratch* buffer but the airline modeline is not applied there (or in *messages*). If I open a new file or buffer it appears correctly then.

Why is the after-make-frame-functions hook needed in this case? Does loading the theme once not behave as expected?

I'll try cloning your dotfiles and see if I can reproduce it.

justinjk007 commented 7 years ago

Thanks, I am not that good with elisp, this is a solution I found somewhere when I first started using emacsclient , and that worked. When I recently migrated to use-package it stopped working again.

I launch emacs --daemon and then start emacsclient -c. A new frame is created with the scratch buffer but the airline modeline is not applied there (or in messages). If I open a new file or buffer it appears correctly then.

Yes, that is the behavior I am used to too. But now its not working anymore.

justinjk007 commented 7 years ago

@AnthonyDiGirolamo Problem Solved, I had these in my custom set variables

 '(custom-theme-load-path
   (quote
    ("~/.emacs.d/elpa/airline-themes-20170425.1646"
     "~/.emacs.d/elpa/solarized-theme-1.2.2" custom-theme-directory t)))

but the directory I was referring had the old version number. I corrected that and the theme loads like it is supposed to even in emacsclient. Thanks

But I should ask you, is there any way to completely remove this custom-theme-load-path or at least move it to use-package so I can keep track of it every-time a new update comes?

Thank you very much for sticking around anyways.

justinjk007 commented 7 years ago

I fixed this long time ago...why is this still open ..lol