From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Carsten Dominik Newsgroups: gmane.emacs.devel Subject: Re: Why js2-mode in Emacs 23.2? Date: Mon, 10 Aug 2009 12:41:58 +0200 Message-ID: References: <7b501d5c0908091634ndfba631vd9db6502db301097@mail.gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1249900951 15061 80.91.229.12 (10 Aug 2009 10:42:31 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 10 Aug 2009 10:42:31 +0000 (UTC) Cc: emacs-devel@gnu.org To: Leo Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Aug 10 12:42:24 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MaSKd-00046S-3Y for ged-emacs-devel@m.gmane.org; Mon, 10 Aug 2009 12:42:23 +0200 Original-Received: from localhost ([127.0.0.1]:50397 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MaSKc-0003sK-8a for ged-emacs-devel@m.gmane.org; Mon, 10 Aug 2009 06:42:22 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MaSKP-0003q3-PG for emacs-devel@gnu.org; Mon, 10 Aug 2009 06:42:09 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MaSKK-0003i3-PY for emacs-devel@gnu.org; Mon, 10 Aug 2009 06:42:08 -0400 Original-Received: from [199.232.76.173] (port=56777 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MaSKK-0003gf-I8 for emacs-devel@gnu.org; Mon, 10 Aug 2009 06:42:04 -0400 Original-Received: from mail-ew0-f211.google.com ([209.85.219.211]:60005) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MaSKI-0004UG-TO for emacs-devel@gnu.org; Mon, 10 Aug 2009 06:42:03 -0400 Original-Received: by ewy7 with SMTP id 7so3180395ewy.42 for ; Mon, 10 Aug 2009 03:42:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:cc:message-id:from:to :in-reply-to:content-type:content-transfer-encoding:mime-version :subject:date:references:x-mailer; bh=pKWKZ+SviEc3w0wGePdmBjWkYx1zJMsT2b9PSn24E10=; b=eAuNIATEUthBEjoqwBuoz5VHj3T9QcoWyckYLXCcyuxi35d7+f7cNDUq+6ArPQ2gRt 1XGZ6bpNj1QlszoI3qioUPqWJvj+ugFEDsT10yR62jbQsxwXSalmCpgp000pX1hQrc9W UMWJHATNLfKa57gDPo5j7r31a2NZZyrUVG1ro= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=cc:message-id:from:to:in-reply-to:content-type :content-transfer-encoding:mime-version:subject:date:references :x-mailer; b=qdU0vJ83GmqBsV/RNBH8OoA11IgYHZn5usKQZh4symkMimHt2f2LdZ92q2HZue75An +LjU/zjzSHWv4vtQP5xDy6vOJAB8yStGQL3cL6pBQ7DHmTwX9TItzvle8playcsJ7qMe 9ZmOYd2lfl4PjfVv0nxhkCbOvq4twcDHjWPgg= Original-Received: by 10.210.128.1 with SMTP id a1mr2935162ebd.22.1249900921330; Mon, 10 Aug 2009 03:42:01 -0700 (PDT) Original-Received: from ?192.168.2.2? (u016822.science.uva.nl [146.50.39.34]) by mx.google.com with ESMTPS id 24sm10835845eyx.53.2009.08.10.03.41.59 (version=TLSv1/SSLv3 cipher=RC4-MD5); Mon, 10 Aug 2009 03:42:00 -0700 (PDT) In-Reply-To: X-Mailer: Apple Mail (2.936) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:113957 Archived-At: On Aug 10, 2009, at 10:44 AM, Leo wrote: > On 2009-08-10 01:49 +0100, Daniel Colascione wrote: > [...] >>> eval-after-load should not be used in emacs packages. >> >> Why not? > > On 2009-08-10 08:06 +0100, Carsten Dominik wrote: > [...] >>> eval-after-load should not be used in emacs packages. >> >> Why not? >> >> - Carsten > > I seem to recall RMS said that sometime ago. It is also documented in > the elisp manual: > > ,----[ (info "(elisp)Hooks for Loading") ] > | In general, well-designed Lisp programs should not use this > feature. > | The clean and modular ways to interact with a Lisp library are (1) > | examine and set the library's variables (those which are meant for > | outside use), and (2) call the library's functions. If you wish > to do > | (1), you can do it immediately--there is no need to wait for when > the > | library is loaded. To do (2), you must load the library (preferably > | with `require'). > | > | But it is OK to use `eval-after-load' in your personal > | customizations if you don't feel they must meet the design standards > | for programs meant for wider use. > `---- I see. Still, I can imagine good use cases for it. For example, if your package needs to do some tweaking to correctly interact with some library, but if that library is only used by very few people. In this case you'd want to avoid loading the library just to apply your tweaks. I'd say this is a good case for using eval-after-load in a normal Emacs library. Here is an example from Org-mode: (eval-after-load "imenu" '(progn (add-hook 'imenu-after-jump-hook (lambda () (if (eq major-mode 'org-mode) (org-show-context 'org-goto)))))) When imenu jumps into a location in a file that is hidden by outline folding, then the context of point needs to be revealed. However, loading imenu just to do this setup is useless for user who do use imenu at all. - Carsten