From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Milan Glacier Newsgroups: gmane.emacs.devel Subject: Re: cl-lib warnings Date: Mon, 26 Dec 2022 18:48:53 -0500 Message-ID: <20221226234853.cj4sskzta46dvpbx@Azure-Swing> References: <83wn6kamwr.fsf@gnu.org> <83len0aldq.fsf@gnu.org> <20221226031314.lhwwazpjdq257k4j@Azure-Swing.local> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37758"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: NeoMutt/20220429 Cc: emacs-devel@gnu.org To: =?utf-8?B?Sm/Do28gVMOhdm9yYQ==?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Tue Dec 27 00:49:42 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 1p9xDx-0009bT-Io for ged-emacs-devel@m.gmane-mx.org; Tue, 27 Dec 2022 00:49:42 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1p9xDO-0005Q2-Bt; Mon, 26 Dec 2022 18:49:06 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p9xDL-0005PP-RY for emacs-devel@gnu.org; Mon, 26 Dec 2022 18:49:03 -0500 Original-Received: from sender4-op-o13.zoho.com ([136.143.188.13]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p9xDJ-000705-PJ for emacs-devel@gnu.org; Mon, 26 Dec 2022 18:49:03 -0500 ARC-Seal: i=1; a=rsa-sha256; t=1672098536; cv=none; d=zohomail.com; s=zohoarc; b=EKD2mmU9g9b1lLf4Z1mR9eEVLBZwJckn2AGU8xC1rJSkXexs2/m3B+4pk2lb09xtHof/lNo/xaWYZ/ytSXifzRfpJOvjQbUC5D6Qa6qaB/U1qFeagXnQVLk+41zkhd6/xVn1OACBDWVkilK2xywomU7yB3NcNMSjaCscAPdALkY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1672098536; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:MIME-Version:Message-ID:References:Subject:To; bh=ImzsTmp//7DH6+7rxifVJlYOreumIrCGaROuFk4cETc=; b=jgxdkflDqbWkICvCPa6wiTSSoeXjdIjGqp8u6wUfWvbbB9tHR/QxL3WmEcH+Fh4lhFLW9SzyvS5zq1bwDudflfJJcoiBxD2vZQP/ETqgiTczoGpdyxxm4kPQ/vSmd/Zg1vpZZLSiSzJSTgISxJWDfsHLux+DSfhbglzaKrYi1KQ= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=milanglacier.com; spf=pass smtp.mailfrom=news@milanglacier.com; dmarc=pass header.from= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1672098536; s=zoho; d=milanglacier.com; i=news@milanglacier.com; h=Date:Date:From:From:To:To:Cc:Cc:Subject:Subject:Message-ID:References:MIME-Version:Content-Type:Content-Transfer-Encoding:In-Reply-To:Message-Id:Reply-To; bh=ImzsTmp//7DH6+7rxifVJlYOreumIrCGaROuFk4cETc=; b=MuSmU8qhGoeIUN1+pBjIdFaeGYiqr7PkDxMVi8HHJhZGqPZqi9oWs2MCdTKIO0L8 TGeHyc5igTdo0KJ3PYAGuUw6X3viH4MHrxyXUlhaV29RfKHS/LaANkjQgwb+PqT4DVY S93MgSq6ez2k+cZebbgZt/J/foDRlVXuYyJBHczs= Original-Received: from localhost (c-69-137-42-77.hsd1.md.comcast.net [69.137.42.77]) by mx.zohomail.com with SMTPS id 16720985345231008.9655881811584; Mon, 26 Dec 2022 15:48:54 -0800 (PST) Content-Disposition: inline In-Reply-To: X-ZohoMailClient: External Received-SPF: pass client-ip=136.143.188.13; envelope-from=news@milanglacier.com; helo=sender4-op-o13.zoho.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 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, FROM_FMBLA_NEWDOM14=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 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-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:301947 Archived-At: On 12/26/22 15:10, João Távora wrote: >On Mon, Dec 26, 2022 at 3:13 AM Milan Glacier wrote: > >> use-package is a macro, so if someone uses use-package to configure the >> package, when he needs to debug (for example minimal configuration), he >> can always present the expanded form. (which basically just expands to >> stuffs like setq, autoload, add-hook stuffs). >> > >Yes, this was my initial hope too, that something like >`pp-macroexpand-last-sexp` could help me. But it's got >enough fluff to make it tiring to read. Here's what a simple >'(use-package foo)' with no options expands to: > >(progn > (defvar use-package--warning1 > #'(lambda > (keyword err) > (let > ((msg > (format "%s/%s: %s" 'foo keyword > (error-message-string err)))) > (display-warning 'use-package msg :error)))) > (condition-case-unless-debug err > (if > (not > (require 'foo nil t)) > (display-warning 'use-package > (format "Cannot load %s" 'foo) > :error)) > (error > (funcall use-package--warning1 :catch err)))) > >I'm afraid mode options will make this even more >complicated. And what's with that defvar? use-package is really a magic. But nobody uses a blank `(use-package foo)`, usually a simple and pracctical use-package call would be something like this: (use-package foo :config (setq foo-1 nil) :init (setq foo-2 nil) :hook ((python-mode emacs-lisp-mode) . foo-mode)) which specifies the code to be evaluated before foo is loaded (:init part), the code to be evaluated after foo is loaded (:config part), and the hook related to this package, which expands to: (progn (unless (fboundp 'foo-mode) (autoload (function foo-mode) "foo" nil t)) (setq foo-2 nil) (eval-after-load 'foo '(progn (setq foo-1 nil) t)) (add-hook 'python-mode-hook (function foo-mode)) (add-hook 'emacs-lisp-mode-hook (function foo-mode))) I think the expanded form are not that hard to read. (I personally am not a fan of use-package, I don't think it brings any thing new. Often I need to expand it to see if its behavior is expected, then why shouldn't I just write plain setq, add-hook stuffs directly?)