From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [Emacs-diffs] master 012487b: * lisp/display-line-numbers.el (display-line-numbers-type): Autoload it. Date: Tue, 25 Jul 2017 09:56:29 -0400 Message-ID: References: <20170723072843.23485.53761@vcs0.savannah.gnu.org> <20170723072844.877FD22EF0@vcs0.savannah.gnu.org> <87inijxnda.fsf@detlef> <83r2x57orp.fsf@gnu.org> <83o9s97lul.fsf@gnu.org> <83fudl7k0p.fsf@gnu.org> <83eft56y4n.fsf@gnu.org> <87inih6k78.fsf@detlef> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1500991089 20290 195.159.176.226 (25 Jul 2017 13:58:09 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 25 Jul 2017 13:58:09 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux) Cc: Eli Zaretskii , emacs-devel@gnu.org To: Michael Albinus Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 25 15:58:04 2017 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 1da0La-0004tB-4j for ged-emacs-devel@m.gmane.org; Tue, 25 Jul 2017 15:58:02 +0200 Original-Received: from localhost ([::1]:60965 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1da0Lf-0003yk-OD for ged-emacs-devel@m.gmane.org; Tue, 25 Jul 2017 09:58:07 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:50652) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1da0KF-00039o-8A for emacs-devel@gnu.org; Tue, 25 Jul 2017 09:56:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1da0KC-0004dt-7f for emacs-devel@gnu.org; Tue, 25 Jul 2017 09:56:39 -0400 Original-Received: from chene.dit.umontreal.ca ([132.204.246.20]:33612) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1da0KC-0004dW-1H; Tue, 25 Jul 2017 09:56:36 -0400 Original-Received: from ceviche.home (lechon.iro.umontreal.ca [132.204.27.242]) by chene.dit.umontreal.ca (8.14.7/8.14.1) with ESMTP id v6PDuT7H001778; Tue, 25 Jul 2017 09:56:29 -0400 Original-Received: by ceviche.home (Postfix, from userid 20848) id 15766660F2; Tue, 25 Jul 2017 09:56:29 -0400 (EDT) In-Reply-To: <87inih6k78.fsf@detlef> (Michael Albinus's message of "Tue, 25 Jul 2017 09:37:31 +0200") X-NAI-Spam-Flag: NO X-NAI-Spam-Level: X-NAI-Spam-Threshold: 5 X-NAI-Spam-Score: 0.2 X-NAI-Spam-Rules: 3 Rules triggered ATR_WMN=0.2, EDT_SA_DN_PASS=0, RV6078=0 X-NAI-Spam-Version: 2.3.0.9418 : core <6078> : inlines <5992> : streams <1755713> : uri <2469568> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 132.204.246.20 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:217020 Archived-At: >>> We are miscommunicating. By "the problem" I meant the reason(s) why >>> autoloading a defcustom should be considered undesirable, and by >>> "proposed solutions" the alternatives for making sure a defcustom'd >>> variable is defined when it is needed. >> There is no need for the variable to be defined in order to `setq' it, >> which is why a simple (defvar foo) is sufficient here. > In menu-bar.el (the case we are speaking about) and every other package, > which might be interested to modify this variable prior calling the > corresponding autoloaded function. I still don't see why it is better, > to mandate every package using that variable a (defvar foo). - There is currently no other package in this situation. And I don't expect a deluge of such packages either. - Another package might do (require 'display-line-numbers) anyway. - In general when a package doesn't want to (require 'bar) but needs to let-bind or set some variable bar-baz, the answer is to either live with the byte-compiler warning (that's the typical case for code in ~/.emacs) or to add a (defvar bar-baz). It's been that way for ever. Autoloading the variable is used when you need to know the var's value (rather than merely set it) and where (require 'bar) is undesirable. > And if this is better, it must be documented in the manual with a reasoning. Simple reason: the code worked just fine, so all there was to fix was a warning, and (defvar bar-baz) is the tool specifically designed to silence those compiler warnings. The autoload you added won't cause you to rot in hell the for eternity (I think), but it's definitely not the best tool to fix the problem at hand. Stefan