From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Cl=c3=a9ment_Pit-Claudel?= Newsgroups: gmane.emacs.devel Subject: Re: emacs-26: `with-eval-after-load' docstring omission Date: Sat, 17 Mar 2018 02:01:33 -0400 Message-ID: References: <827ed6de-fd90-144e-53dd-50163a937b63@gmail.com> <4e07d7b4-f1f7-0d5d-5f2a-b5e491ab4303@gmail.com> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1521266429 20300 195.159.176.226 (17 Mar 2018 06:00:29 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sat, 17 Mar 2018 06:00:29 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 To: emacs-devel@gnu.org, Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Mar 17 07:00:25 2018 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ex4tE-0005Bo-P4 for ged-emacs-devel@m.gmane.org; Sat, 17 Mar 2018 07:00:24 +0100 Original-Received: from localhost ([::1]:60784 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ex4vH-0003EE-OZ for ged-emacs-devel@m.gmane.org; Sat, 17 Mar 2018 02:02:31 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54697) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ex4uO-0003Db-Vl for emacs-devel@gnu.org; Sat, 17 Mar 2018 02:01:37 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ex4uO-0001HQ-4o for emacs-devel@gnu.org; Sat, 17 Mar 2018 02:01:37 -0400 Original-Received: from mail-qk0-x231.google.com ([2607:f8b0:400d:c09::231]:34493) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ex4uN-0001HA-WA for emacs-devel@gnu.org; Sat, 17 Mar 2018 02:01:36 -0400 Original-Received: by mail-qk0-x231.google.com with SMTP id z184so13370958qkc.1 for ; Fri, 16 Mar 2018 23:01:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=RW2yPQFfGT5MrkJ9IziYsaBV3kg2bO+U0V9q1xuuR9I=; b=DbwO0Jb45rJvOF743vu5uAliFldxZ4gZLkGgqWc0FpfIdw+EzTViDz2Ss7FyAwgw3d PFExoeAxvsDSSWXPubNsGI2LM/jrbe7SGbGfHgxwnIC61A91jbhnNgrVGPieydDImQbW Ct0HcB/IHSKvK9nrkd4efuY5UUyTJV78umoUjmTam8hCypsZ+phgS5XpnRKvEvuKzBe0 uFGQoyMkKPdH0MKciHWwbOrZe3Fn4jZxy8xeKUbnCNIB0vHM2QzSyLCM/SSGaj2sDcd+ gaCciBp/GLJy8vErNRjd4kjDYh8kpOMu+/rmiGhRBgjwPUa3vAlVZ6MeBqe3VTN0Gal1 DNcQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=RW2yPQFfGT5MrkJ9IziYsaBV3kg2bO+U0V9q1xuuR9I=; b=tU75eiLa+fKQGJlf75iYnLLogJ42UrjNc1WvXWw78aPaGs0SANj6ryosUq+aghvVxy 12o1m/Z8NPHq+iaKhgRG/w5KVHDiItvbJEEWpb+rwoUrjthMPZmYNrG4U/zTLqhC5141 /ylfHTEGWMy/gjDRmu6WmuZSw4kOLEyOc/8DwMpnjHTR+eaM8VtTWuJ17qZK49dxZ5UV zN1iKb21hFcC7qZAYfktpB9ifESZd/HrvaFgiXuCa+2Ubbfnx/qfUOuBo8da60nWTMGn DqL9SDIpwbzYVKjRD90uO+8Ucv1I69zkwRp7zjbVLcJ+Sf0IgFC2hLur15K1r+3D5vjo taow== X-Gm-Message-State: AElRT7EcFkIpQXAjP9hDJMRpUk0WlmxJzC4k/0slcvhH8t4TOY+/UbiV TTdNO+n9EJuaW/b51VtgV5OgWRov X-Google-Smtp-Source: AG47ELvHvRWD6Yqrc0qOBAZrZv/Rr0XU5zCyTwf8bpYkQf5PjiZAj4uT3AB8GDpYd+f1EVtzpKmFMA== X-Received: by 10.55.157.195 with SMTP id g186mr6991808qke.80.1521266495096; Fri, 16 Mar 2018 23:01:35 -0700 (PDT) Original-Received: from ?IPv6:2601:184:4180:66e7:ad34:ef82:5bcc:95e7? ([2601:184:4180:66e7:ad34:ef82:5bcc:95e7]) by smtp.gmail.com with ESMTPSA id f6sm1472918qkh.13.2018.03.16.23.01.33 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Mar 2018 23:01:34 -0700 (PDT) In-Reply-To: Content-Language: en-GB X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:400d:c09::231 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.21 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" Xref: news.gmane.org gmane.emacs.devel:223781 Archived-At: On 2018-02-28 18:22, Stefan Monnier wrote: > You should not use `eval-after-load` nowadays, you should only use > `with-eval-after-load`, so you'd write something like > > (with-eval-after-load 'flycheck > ;; Use eval+quote to delay macro expansion. > (eval '(flycheck-define-command ...))) I got bitten by this again today, this time with this: (with-eval-after-load 'flycheck (push "npx" (flycheck-checker-get 'javascript-eslint 'command))) … which failed with this message when Flycheck was actually loaded: Debugger entered--Lisp error: (void-function \(setf\ flycheck-checker-get\)) (\(setf\ flycheck-checker-get\) (cons "npx" (flycheck-checker-get 'javascript-eslint 'command)) 'javascript-eslint 'command) I'm slowly developing the habit of writing (with-eval-after-load 'flycheck (eval '(…))), but I'm really not a fan of this pattern :/ What do we gain from byte-compiling the bodies of with-eval-after-load forms? Byte-compilation warnings for undefined variables, but these are usually false positives (precisely because the variables in a with-eval-after-load are often defined by the package in question). And some performance, but with-eval-after-load is discouraged in packages and its body typically runs once (or very few times?), so its performance should be essentially irrelevant. Maybe we can find a way to prevent macro-expansion issues and make the behavior more intuitive? Cheers, Clément.