emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GNU Elpa Theme (ahungry-theme) - should I add code to auto load-them


From: Artur Malabarba
Subject: Re: GNU Elpa Theme (ahungry-theme) - should I add code to auto load-theme it?
Date: Thu, 5 Feb 2015 22:08:16 +0000

For starters, a theme *kind of* works if you require it, but that's
the wrong way of doing it. You should use load-theme instead.

> My theme has 3 calls in it:
>
> (deftheme ahungry) [...]
> (provide-theme 'ahungry)
>
> Which I thought were the 3 standard components to a custom theme file?

AFAICT that's the correct way. I think it's always been the case that
loading a theme file loads the theme itself (that's part of what
custom-theme-set-faces does).

> In most cases, a user has zero reason to #'require the theme unless they
> plan to load it, so the fact that the #'require acts as a #'load-theme
> (but based off the load-path instead of custom-theme-load-path) seems
> like a good side-effect to me

Firstly, the user also has zero reason to require the theme. Calling
(load-theme 'ahungry) can be done directly if the theme is on
custom-theme-load-path, so just do that instead.

Secondly, requiring the theme file doesn't do some pretty important
theme-related stuff that load-theme does, so there's a reason NOT to
require.

> (at least until the ELPA generated
> autoload file has support for adding ELPA loaded themes into the
> custom-theme-load-path automatically).

What do you mean by support? Here's what some themes do:

;;;###autoload

(and load-file-name (boundp 'custom-theme-load-path) (add-to-list
'custom-theme-load-path (file-name-as-directory (file-name-directory
load-file-name))))

It might be worth defining a notation of sorts that would have
make-autoloads do this for you automatically. But in the mean time,
use the snippet above, don't ask people to require your theme.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]