From: Artur Malabarba <bruce.connor.am@gmail.com>
To: Matthew Carter <m@ahungry.com>
Cc: Stefan Monnier <monnier@iro.umontreal.ca>,
emacs-devel <emacs-devel@gnu.org>
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 [thread overview]
Message-ID: <CAAdUY-KrzLGxyUSqXOzXuMDSrYqzLdtL4RPPuBkP89EBfxd9cg@mail.gmail.com> (raw)
In-Reply-To: <87d25odtai.fsf@ahungry.com>
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.
next prev parent reply other threads:[~2015-02-05 22:08 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-30 21:47 GNU Elpa Theme (ahungry-theme) - should I add code to auto load-theme it? Matthew Carter
2015-01-30 21:50 ` Dmitry Gutov
2015-01-30 23:57 ` Artur Malabarba
2015-02-05 17:44 ` Matthew Carter
2015-02-05 19:13 ` Stefan Monnier
2015-02-05 19:58 ` Matthew Carter
2015-02-05 20:48 ` Stefan Monnier
2015-02-05 22:08 ` Artur Malabarba [this message]
2015-02-06 4:03 ` Matthew Carter
2015-02-06 8:59 ` Artur Malabarba
2015-02-05 19:31 ` Ivan Shmakov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAAdUY-KrzLGxyUSqXOzXuMDSrYqzLdtL4RPPuBkP89EBfxd9cg@mail.gmail.com \
--to=bruce.connor.am@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=m@ahungry.com \
--cc=monnier@iro.umontreal.ca \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).