From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.devel Subject: Re: Package initialization Date: Sun, 19 Jul 2015 09:23:35 +0200 Message-ID: References: <87twt1dmxu.fsf@uwakimon.sk.tsukuba.ac.jp> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1437290640 26952 80.91.229.3 (19 Jul 2015 07:24:00 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 19 Jul 2015 07:24:00 +0000 (UTC) Cc: Artur Malabarba , emacs-devel To: "Stephen J. Turnbull" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 19 09:23:55 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 1ZGix0-0000Fo-W6 for ged-emacs-devel@m.gmane.org; Sun, 19 Jul 2015 09:23:55 +0200 Original-Received: from localhost ([::1]:50683 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZGiwz-0007Y1-Uh for ged-emacs-devel@m.gmane.org; Sun, 19 Jul 2015 03:23:53 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:37665) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZGiwo-0007Xw-L6 for emacs-devel@gnu.org; Sun, 19 Jul 2015 03:23:43 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZGiwl-0002bt-F0 for emacs-devel@gnu.org; Sun, 19 Jul 2015 03:23:42 -0400 Original-Received: from mail-wi0-x22d.google.com ([2a00:1450:400c:c05::22d]:37866) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZGiwl-0002bi-70 for emacs-devel@gnu.org; Sun, 19 Jul 2015 03:23:39 -0400 Original-Received: by wibud3 with SMTP id ud3so71890597wib.0 for ; Sun, 19 Jul 2015 00:23:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=u1+SIeNjfuKKJAmh1/Lri+0IUAY6WBOa7w6RgZgfXIY=; b=JSP2wenXiWuHMrY5XYyTWSNkX3NST/RbYdpBLqQ8U8nVwGHJvMVGW5DbMxP1tOsqHV LX/yoSIkvC6UtlNf/O+CAWX3QIHMaK6XhubMnp49ab0pmcK+iKd19Vw4MB/gTMktLCoh MsZwMysRGv0VO2l4249WHdqET4bNdtispi6gz4B/zZ/DQmr4P77BUqJCLJGAntfMj7YT 7E+X21KgctYJkOETU0HJ+33u3Xc7YXd1qJSCvTeXtRyOdF1DGsBF7opTpDWBxlsKSquW Ov2doGtHcygPUPCzwF9k3zcBV2OSdjEvNlWnZEmskV0p8kzabr/vAZdKl3sM8MKCGVyd 2xgA== X-Received: by 10.194.123.4 with SMTP id lw4mr44027277wjb.94.1437290618569; Sun, 19 Jul 2015 00:23:38 -0700 (PDT) Original-Received: from ix ([212.46.170.156]) by smtp.gmail.com with ESMTPSA id c3sm26080341wja.3.2015.07.19.00.23.37 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 19 Jul 2015 00:23:37 -0700 (PDT) Original-Received: from helmut by ix with local (Exim 4.84) (envelope-from ) id 1ZGiwi-0000Z6-26; Sun, 19 Jul 2015 09:23:36 +0200 In-Reply-To: <87twt1dmxu.fsf@uwakimon.sk.tsukuba.ac.jp> (Stephen J. Turnbull's message of "Sun, 19 Jul 2015 09:13:17 +0900") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::22d 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:187969 Archived-At: On Sun, Jul 19 2015, Stephen J. Turnbull wrote: > 1. The package has an idempotent initialization function, typically > implemented by wrapping the whole function in `(if (not > -initialized-p) ...)'. > 2. The autoloads include exactly those commands that users are > expected to invoke in the uninitialized state. (Users who know > what they are doing can of course explicitly require or load > package files and call any function.) > 3. All autoloaded commands should call the package initialization > function as their first action. > 4. The autoloads may defvar global variables in the package's > namespace. However defcustoms (which are automatically > initialized by the XEmacs package system) are preferred for > variables the user might customize, even if that is unusual. [] > > I quite like to see the explicit call to slime-setup in my .emacs, but > > others might not. > > I think the rules 1-4 above would satisfy both you and those others. I don't see how. Either (require 'slime-autoloads) calls slime-setup or not. Calling it lazily when a SLIME related command is invoked the first time would kinda work for SLIME, but it would be rather strange that say the slime-connect command implicitly adds hooks to lisp-mode-hook. In general, lazy initialization would also not work well if those autoloaded commands should be bound to keys because before the first invocation the keys would not be bound. Helmut