From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Daniel Brockman Newsgroups: gmane.emacs.devel Subject: `eval-after-load' broken for symbols? Date: Tue, 1 Nov 2011 16:17:58 +0100 Message-ID: <980A1209-F9FB-4B2F-95A3-592EA5206B7A@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v1251.1) Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1320164199 22418 80.91.229.12 (1 Nov 2011 16:16:39 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 1 Nov 2011 16:16:39 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Nov 01 17:16:34 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RLH0o-0005ll-5R for ged-emacs-devel@m.gmane.org; Tue, 01 Nov 2011 17:16:30 +0100 Original-Received: from localhost ([::1]:41938 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLH0n-0005wg-5H for ged-emacs-devel@m.gmane.org; Tue, 01 Nov 2011 12:16:29 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:52695) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLG6J-0004EU-8V for emacs-devel@gnu.org; Tue, 01 Nov 2011 11:18:08 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RLG6H-0000e2-O3 for emacs-devel@gnu.org; Tue, 01 Nov 2011 11:18:07 -0400 Original-Received: from mail-bw0-f41.google.com ([209.85.214.41]:57276) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RLG6H-0000dl-J0 for emacs-devel@gnu.org; Tue, 01 Nov 2011 11:18:05 -0400 Original-Received: by bkas6 with SMTP id s6so1049884bka.0 for ; Tue, 01 Nov 2011 08:18:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:content-type:content-transfer-encoding:subject:date:message-id :to:mime-version:x-mailer; bh=F2dmfAc0jyngmp+pct5CMqMnmt8ICJImThVDB8BjPWA=; b=RW7WV77lv97xadpUDrSECbthxvYfjx12+ci81Ku4xe+Gz3QSU8ENLsiZsIL2t3L/5z sd9DnxIe3ODAz4w2/TEOd6OeBJHZtLbXLAoZLW3tfL4+XUVRBX62IQRPCEfYWMMeDrmd SFwBNIi7SV4bAYMNP9U8iFmJ/Bt+opL57Wpys= Original-Received: by 10.204.150.205 with SMTP id z13mr7257615bkv.67.1320160684154; Tue, 01 Nov 2011 08:18:04 -0700 (PDT) Original-Received: from [192.168.0.112] (90-230-232-153-no73.business.telia.com. [90.230.232.153]) by mx.google.com with ESMTPS id k6sm20948231bkv.8.2011.11.01.08.18.01 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 01 Nov 2011 08:18:02 -0700 (PDT) X-Mailer: Apple Mail (2.1251.1) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.214.41 X-Mailman-Approved-At: Tue, 01 Nov 2011 12:16:27 -0400 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:145829 Archived-At: The ubiquitous function `eval-after-load` seems to be broken. The following code causes the message to be displayed: (require 'dired) (eval-after-load "dired" '(message "String works!")) But the following code doesn=92t: (require 'dired) (eval-after-load 'dired '(message "Symbol works!")) =46rom the docstring of `eval-after-load`: Arrange that if FILE is loaded, FORM will be run immediately = afterwards. If FILE is already loaded, evaluate FORM right now. [=85] Alternatively, FILE can be a feature (i.e. a symbol), in which case = FORM is evaluated at the end of any file that `provide's this feature. I guess that _could_ be trying to say that "when FILE is a symbol" it *shouldn=92t* "evaluate FORM right now", but if you look at the = source code for `eval-after-load` it doesn=92t actually avoid evaluating FORM, it just happens for an unrelated reason to wrap it in a false = conditional: (when (symbolp regexp-or-feature) ;; For features, the after-load-alist elements get run when = `provide' is ;; called rather than at the end of the file. So add an = indirection to ;; make sure that `form' is really run "after-load" in case the = provide ;; call happens early. (setq form `(when load-file-name =85 So, is this actually a bug? The behavior sure seems broken anyway. --=20 Daniel Brockman, partner & developer Go Interactive Twitter: http://twitter.com/dbrock Telephone: +46706880739