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: Package initialization Date: Sat, 18 Jul 2015 18:16:05 +0100 Message-ID: References: Reply-To: bruce.connor.am@gmail.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1437239782 19792 80.91.229.3 (18 Jul 2015 17:16:22 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 18 Jul 2015 17:16:22 +0000 (UTC) Cc: emacs-devel To: Helmut Eller Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jul 18 19:16:21 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 1ZGVim-0003iZ-UF for ged-emacs-devel@m.gmane.org; Sat, 18 Jul 2015 19:16:21 +0200 Original-Received: from localhost ([::1]:48914 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZGVim-00056e-0q for ged-emacs-devel@m.gmane.org; Sat, 18 Jul 2015 13:16:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43701) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZGViZ-000564-MQ for emacs-devel@gnu.org; Sat, 18 Jul 2015 13:16:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZGViY-0008LB-Tf for emacs-devel@gnu.org; Sat, 18 Jul 2015 13:16:07 -0400 Original-Received: from mail-lb0-x229.google.com ([2a00:1450:4010:c04::229]:33752) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZGViY-0008L0-Lx for emacs-devel@gnu.org; Sat, 18 Jul 2015 13:16:06 -0400 Original-Received: by lbbyj8 with SMTP id yj8so75793532lbb.0 for ; Sat, 18 Jul 2015 10:16:05 -0700 (PDT) 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:content-transfer-encoding; bh=PRT+c4lLMXOGHPTj24txv+St4FhDs0EIuyNcaKcb3ng=; b=iP3sT3/LlgtX0nS6nD4dOPlzqM4JugXq1J9AMR4d9xwojqDtf+GqnmqXfWKbDwrNED yiEzhMErb37/QjXOUEj29clkC45aTpiHgs4859qpOXuho0jZRamQIgmlBl94jMVfG4Tu pc+E/8FqPeKbCo5aM0wk7mQJobISMDoz/YlC0VJGmaeKyp8ZyQNu5qeXktjUhXxUr2t2 fdv2C3cZkVLoJVruTRgpj+ctrxXcG52UpPsXJEeaAJki5wGT4vzOKZRzS+3vt3IeJ8K2 MuULGmorLa62BcyYlQHZtuorAF9Uea7rHC+GlllBBuoQXtrTFHgU1o1UvkIYH+6xKDKD 4eyw== X-Received: by 10.152.37.136 with SMTP id y8mr19873146laj.21.1437239765778; Sat, 18 Jul 2015 10:16:05 -0700 (PDT) Original-Received: by 10.25.134.139 with HTTP; Sat, 18 Jul 2015 10:16:05 -0700 (PDT) In-Reply-To: X-Google-Sender-Auth: 5KG1zG7LcvPodD4z838crtc-eSk X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4010:c04::229 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:187951 Archived-At: > The manual says this about NAME-autoload.el files: > > They are typically used to autoload the principal user commands define= d > in the package, but they can also perform other tasks, such as adding > an element to =E2=80=98auto-mode-alist=E2=80=99 > > Which seems to suggest that one should write some > ;;;###autoload (progn ...) > somewhere that does the initialization. Is this the way it should be > done? Yes, that line can be added to any of the package's =E2=80=9C.el=E2=80=9D f= iles. Any code that you write there will be run when your package is activated (not loaded). This means the code is run when Emacs starts, (either during or after loading the init file, depending on what's in the actual init file). Note, however, that the package itself will not be loaded at this time. And neither should this code load your package (or be slow in some other way). Adding an entry to auto-mode-alist is fine. > And what is supposed to happen if two packages make conflicting changes > to auto-mode-alist? If you add your entry with add-to-list, nothing unexpected will happen. If two different packages add entries regarding the same extension, then both entries will get added. When the user visits a file, the entry on top (the most recently added) will be the one used, but I suppose that's what they get for installing two major-modes for the same file type.