From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.devel Subject: Re: Adding use-package to ELPA Date: Mon, 07 Mar 2022 23:12:17 +0000 Message-ID: <87wnh52w8e.fsf@posteo.net> References: <87k0dbi7ol.fsf@posteo.net> <871qzgyfuo.fsf@posteo.net> <87ilsre5jf.fsf@posteo.net> <87zgm2bpez.fsf@posteo.net> <87ilsp4lc8.fsf@posteo.net> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6344"; mail-complaints-to="usenet@ciao.gmane.io" Cc: chad , EMACS development team To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Mar 08 00:16:50 2022 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nRMau-0001Os-O0 for ged-emacs-devel@m.gmane-mx.org; Tue, 08 Mar 2022 00:16:48 +0100 Original-Received: from localhost ([::1]:57768 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nRMat-0003nE-A8 for ged-emacs-devel@m.gmane-mx.org; Mon, 07 Mar 2022 18:16:47 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:57306) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRMWd-0004CO-BO for emacs-devel@gnu.org; Mon, 07 Mar 2022 18:12:23 -0500 Original-Received: from mout01.posteo.de ([185.67.36.65]:48735) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nRMWb-0000xP-7D for emacs-devel@gnu.org; Mon, 07 Mar 2022 18:12:23 -0500 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id 1E2B1240026 for ; Tue, 8 Mar 2022 00:12:18 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1646694739; bh=QVtcboCKMQ44iV0vXCaPIXbEXDi1eu4CmczL8lxNFTE=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=HeVP0AysuDrthhsuz/m/724idJd1s4oDBDj3sqL+tXY2tW4PE+GRT/k1oqoJyKVug QfYQHptgCjRa8gKia10D2t0JQkDg9itTe4e2TMpVYMdguwNlFg5CEEHJb9SXxw6qWZ yCzLhzawE4ibwdEDh/yxfM5MYG+Nc4Y2JdqSl+4jk+ZdyX5xUW/RwMchiKHD+WwpRM 8K6QwKGvQRaaZkwjO2hggSkUScZVI1w+dgxV00IZjQwTYDIcrYC/36e7hef5yvAgd0 mO9y4jAQxSEpTSQLPxI88hT1MguIfjNWU5qOGNZ+EjgVYoCU2kaB0c/wCPd7u2jqAN Nlzqxiwwc9nLA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4KCDkV0kkWz6tmQ; Tue, 8 Mar 2022 00:12:17 +0100 (CET) Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB In-Reply-To: (Stefan Monnier's message of "Mon, 07 Mar 2022 16:03:46 -0500") Received-SPF: pass client-ip=185.67.36.65; envelope-from=philipk@posteo.net; helo=mout01.posteo.de X-Spam_score_int: -43 X-Spam_score: -4.4 X-Spam_bar: ---- X-Spam_report: (-4.4 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:286906 Archived-At: Stefan Monnier writes: >> True, because the above examples just expands to >> >> (setq smtpmail-smtp-service 587) >> >> I'd usually recommend to use a local macro to avoid these issues, >> because something like >> >> (setup smtpmail >> (:option smtpmail-smtp-service 587)) >> >> would expand to a `customize-set-variable'-like code, where >> `smtpmail-smtp-service' would appear as a quoted symbol. > > If it expands to `customize-set-variable`, then presumably you wouldn't > get the warning, indeed (that's good) but you also wouldn't get > a warning if you mistype the var (less good). > > I want both: absence of warnings when the var name is right, and > presence of a warning when it isn't (and presence of a warning when the > var is obsolete). True, so this is certainly worth investigating. Yet this is only part of the problem, as function have a similar pattern, but they cannot reliably be detected in this way. E.g. (setup foo (:hook bar)) wouldn't be able to infer that bar is a function that exists, just because it is being added to foo-bar-mode. >>> So `setup.el` could maybe do something like: >>> >>> (defmacro setup (pkg &rest args) >>> (when (we-are-byte-compiling-p) >>> (require (byte-run-strip-symbol-positions pkg))) >>> ...) >> >> What is the point of using byte-run-strip-symbol-positions here? > > Macros receive source code as input, which can/should come with > source-position information. Before we can safely run that code we need > to strip the position info. I'm glad to see that there are always some details about macros one doesn't know about. >> I just tried something like this, but it doesn't seem to work. > > I'm glad to see that I'm still able to write incorrect code. Eh, my bad, I had used (macroexp-compiling-p) that apparently didn't do the right job. Without that check, it works in principle, but of course doesn't do the intended thing. -- Philip Kaludercic