From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: Calling (package-initialize) sooner during initialization Date: Tue, 31 Mar 2015 16:46:02 -0400 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1427834792 29427 80.91.229.3 (31 Mar 2015 20:46:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 31 Mar 2015 20:46:32 +0000 (UTC) Cc: bruce.connor.am@gmail.com, emacs-devel To: Sebastian Wiesner Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Mar 31 22:46:24 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 1Yd33H-0005et-2v for ged-emacs-devel@m.gmane.org; Tue, 31 Mar 2015 22:46:23 +0200 Original-Received: from localhost ([::1]:40534 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yd33G-0003cm-G1 for ged-emacs-devel@m.gmane.org; Tue, 31 Mar 2015 16:46:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53257) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yd333-0003bf-FE for emacs-devel@gnu.org; Tue, 31 Mar 2015 16:46:10 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Yd32y-0007YO-Bm for emacs-devel@gnu.org; Tue, 31 Mar 2015 16:46:09 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:32074) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Yd32y-0007Y8-7s for emacs-devel@gnu.org; Tue, 31 Mar 2015 16:46:04 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AgUFAGvvdVRBbthL/2dsb2JhbAA3gVOhb4EIgXUBAQQBViMFCwsOJhIUGA0kiBOiEYt7CBQIRQwDgz4Dg3AEqDs X-IPAS-Result: AgUFAGvvdVRBbthL/2dsb2JhbAA3gVOhb4EIgXUBAQQBViMFCwsOJhIUGA0kiBOiEYt7CBQIRQwDgz4Dg3AEqDs X-IronPort-AV: E=Sophos;i="5.01,1,1400040000"; d="scan'208";a="115081623" Original-Received: from 65-110-216-75.cpe.pppoe.ca (HELO pastel.home) ([65.110.216.75]) by ironport2-out.teksavvy.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 31 Mar 2015 16:46:03 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 81B491054; Tue, 31 Mar 2015 16:46:02 -0400 (EDT) In-Reply-To: (Sebastian Wiesner's message of "Tue, 31 Mar 2015 16:51:38 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 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:184673 Archived-At: > So we could just require that a mode that is supposed to be enabled > through customize also has a ':require' keyword for the corresponding > feature. The require will fail if executed before calling package-initialize. > And for :require features the whole problem looks pretty simple to me: > Try to load the feature on 'set-custom-variables'. If it fails > remember the corresponding form somewhere (i.e. 'custom-delayed-vars' > or whatever), and just try again after 'package-initialize'. If it > still fails, report an error. Doesn't seem significantly simpler than adding (package-initialize) in the ~/.emacs file. Also the "lazy calling" of that function makes it harder to figure out what's going on. Also, the canonical way to handle minor modes is not to have them use :require but to mark them as autoload. In this case, Custom might not even know that this var is a minor-mode until after package-initialize is called, so if package-initialize is not called early, then Custom may simply "do the wrong thing", oblivious to the fact that it should have called a minor mode function instead of just setting the variable. Stefan