From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Artur Malabarba Newsgroups: gmane.emacs.devel 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 Message-ID: References: <87iofo7xfo.fsf@ahungry.com> <87mw4sdzi0.fsf@ahungry.com> <87d25odtai.fsf@ahungry.com> Reply-To: bruce.connor.am@gmail.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1423174112 29223 80.91.229.3 (5 Feb 2015 22:08:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 5 Feb 2015 22:08:32 +0000 (UTC) Cc: Stefan Monnier , emacs-devel To: Matthew Carter Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 05 23:08:31 2015 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1YJUb9-0002Pt-5Y for ged-emacs-devel@m.gmane.org; Thu, 05 Feb 2015 23:08:31 +0100 Original-Received: from localhost ([::1]:45751 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJUb8-0007wY-Bq for ged-emacs-devel@m.gmane.org; Thu, 05 Feb 2015 17:08:30 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34797) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJUav-0007wO-Hq for emacs-devel@gnu.org; Thu, 05 Feb 2015 17:08:18 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJUau-0004YO-Jp for emacs-devel@gnu.org; Thu, 05 Feb 2015 17:08:17 -0500 Original-Received: from mail-oi0-x22b.google.com ([2607:f8b0:4003:c06::22b]:58732) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJUau-0004YJ-Eo for emacs-devel@gnu.org; Thu, 05 Feb 2015 17:08:16 -0500 Original-Received: by mail-oi0-f43.google.com with SMTP id z81so8887702oif.2 for ; Thu, 05 Feb 2015 14:08:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:reply-to:sender:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=HejgI3iC/49f5M1CxTcbBIHZYTxzBmWRXP0W+ct9FWk=; b=0LpHivSp3JLq1ANhmmTRsMYka51Z3NveEUt2EoUh1uIDbl0gv54zTPojVmeyUk9oF9 P/u7/9KF8PEwGTTxQOfR+q/GBat6/fs0q+I1qCHHOTCx8Z7DAD72Q7UB5GMaNr75O1/h Jk2TATdZkZMm9aRaidYmnFJb+tW6q3YQnS05TO3fz4T1KD/ixluur4JBxGzbytFRCJh+ 9Tp6SJboLGikpxYQTqA44y+N80XPSyDz9bqAGhZ/LfPOqOOrLn7n6k2vff4R44eb7dLt yNPX01FO558w61uSXcut+dOetlfpBr27I3KqsnPOcatwjlBrE0tqD1vR4QYqji4k+TON dSRw== X-Received: by 10.182.68.12 with SMTP id r12mr249552obt.84.1423174096131; Thu, 05 Feb 2015 14:08:16 -0800 (PST) Original-Received: by 10.76.125.1 with HTTP; Thu, 5 Feb 2015 14:08:16 -0800 (PST) In-Reply-To: <87d25odtai.fsf@ahungry.com> X-Google-Sender-Auth: 1bKd6y1IHwJn3rzs10EqT0Kqang X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4003:c06::22b X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:182482 Archived-At: 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.