From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Matthew Carter Newsgroups: gmane.emacs.devel Subject: Re: GNU Elpa Theme (ahungry-theme) - should I add code to auto load-theme it? Date: Thu, 05 Feb 2015 23:03:03 -0500 Organization: Ahungry (http://ahungry.com) Message-ID: <87siejd6vc.fsf@ahungry.com> References: <87iofo7xfo.fsf@ahungry.com> <87mw4sdzi0.fsf@ahungry.com> <87d25odtai.fsf@ahungry.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1423195400 25729 80.91.229.3 (6 Feb 2015 04:03:20 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 6 Feb 2015 04:03:20 +0000 (UTC) Cc: Stefan Monnier , emacs-devel To: Artur Malabarba Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 06 05:03:15 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 1YJa8R-00020c-6m for ged-emacs-devel@m.gmane.org; Fri, 06 Feb 2015 05:03:15 +0100 Original-Received: from localhost ([::1]:46611 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJa8Q-0004Yx-IE for ged-emacs-devel@m.gmane.org; Thu, 05 Feb 2015 23:03:14 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:44896) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJa8N-0004Yp-2j for emacs-devel@gnu.org; Thu, 05 Feb 2015 23:03:12 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YJa8J-00073S-IW for emacs-devel@gnu.org; Thu, 05 Feb 2015 23:03:11 -0500 Original-Received: from li130-200.members.linode.com ([69.164.215.200]:37150 helo=mail.ahungry.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YJa8J-000735-Fd for emacs-devel@gnu.org; Thu, 05 Feb 2015 23:03:07 -0500 Original-Received: from Prometheus (99-40-9-245.lightspeed.livnmi.sbcglobal.net [99.40.9.245]) by mail.ahungry.com (Postfix) with ESMTPSA id 4A15F4079; Thu, 5 Feb 2015 23:03:04 -0500 (EST) In-Reply-To: (Artur Malabarba's message of "Thu, 5 Feb 2015 22:08:16 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 69.164.215.200 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:182491 Archived-At: Artur Malabarba writes: >> (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. > I had actually tried the aforementioned snippet (placed in ahungry-theme.el) in the past, but it never gets evaluated unless I have a (require 'ahungry-theme) in the init (which is how I discovered that the simple 'require' applies most the theme). Adding the following to ahungry-theme-autoloads.el: (add-to-list 'custom-theme-load-path (or (file-name-directory #$) (car load-path))) lets a simple (load-theme 'ahungry) work as expected (prompt to trust the theme, and a second to remember the trust choice), as well as applying the theme, without requiring user intervention of setting the custom-theme-load-path in their init. Since I have a dependency defined in the theme file of ((emacs "24)), which will thus have the load-theme support, it is probably unnecessary to have a check for (boundp 'custom-theme-load-path) right? If I manually create and add an "ahungry-theme-autoloads.el" file in elpa/packages/ahungry-theme, will it supersede the one Elpa creates automatically? -- Matthew Carter (m@ahungry.com) http://ahungry.com