From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Ruijie Yu via Users list for the GNU Emacs text editor Newsgroups: gmane.emacs.help Subject: Re: use-package :after ?? Date: Fri, 12 May 2023 09:18:14 +0800 Message-ID: References: <83fs87c8wg.fsf@gnu.org> <831qjn75tw.fsf@gnu.org> Reply-To: Ruijie Yu Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6060"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.11.3; emacs 30.0.50 Cc: Eli Zaretskii , help-gnu-emacs@gnu.org To: David Masterson Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Fri May 12 03:19:18 2023 Return-path: Envelope-to: geh-help-gnu-emacs@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 1pxHRG-0001Mp-8h for geh-help-gnu-emacs@m.gmane-mx.org; Fri, 12 May 2023 03:19:18 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pxHQa-0006TR-U2; Thu, 11 May 2023 21:18:37 -0400 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 1pxHQZ-0006TI-Ig for help-gnu-emacs@gnu.org; Thu, 11 May 2023 21:18:35 -0400 Original-Received: from netyu.xyz ([152.44.41.246] helo=mail.netyu.xyz) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pxHQX-0008T3-P1; Thu, 11 May 2023 21:18:35 -0400 Original-Received: from fw.net.yu.netyu.xyz ( [222.248.4.98]) by netyu.xyz (OpenSMTPD) with ESMTPSA id 09613cdc (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 12 May 2023 01:18:30 +0000 (UTC) In-reply-to: Received-SPF: pass client-ip=152.44.41.246; envelope-from=ruijie@netyu.xyz; helo=mail.netyu.xyz X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:143563 Archived-At: --=-=-= Content-Type: text/plain David Masterson writes: > Eli Zaretskii writes: > >>> From: David Masterson >>> Cc: help-gnu-emacs@gnu.org >>> Date: Wed, 10 May 2023 20:24:18 -0700 >>> >>> One thing I left out was that org-ac also depends on auto-complete-pcmp >>> making the :after more complicated -- namely does order make a >>> difference in how things should be loaded? >> >> Depends how? via autoloads or via :after? >> >> And why does it make thing more complicated? If package FOO should be >> loaded after BAR, and BAR should be loaded after BAZ, then the order >> I'd expect should be: BAZ, then BAR, then FOO. Right? > > Yes. Will that be handled properly by the following (with global > deferred loading)? > > (use-package foo :after bar > :config (foo-setup) > ) > (use-package bar :after baz > # :demand t > ) > (use-package baz) > > In particular, use-package will ensure foo-setup is called after foo is > loaded, right? If I uncommented the :demand, should/would that make a > difference? > > I may be overthinking this because of my org-ac issue and this looked > like an obvious debugging approach. I attach my scratch session after macroexpanding with the :demand t (after a pretty-print because I don't think having everything on one line helps much). You should be able to figure out the answer to your question by looking at the generated form and playing around with the macroexpand form. --=-=-= Content-Type: text/plain Content-Disposition: attachment; filename=macroexpand-result-scratch.eld ;; This buffer is for text that is not saved, and for Lisp evaluation. ;; To create a file, visit it with C-x C-f and enter text in its buffer. (setq-local eval-expression-print-level nil) (macroexpand-all '(progn (use-package foo :after bar :config (foo-setup)) (use-package bar :after baz :demand t) (use-package baz))) (progn (progn (defvar use-package--warning3 #'(lambda (keyword err) (let ((msg (format "%s/%s: %s" 'foo keyword (error-message-string err)))) (display-warning 'use-package msg :error)))) (condition-case err (eval-after-load 'bar #'(lambda nil (if (not (require 'foo nil t)) (display-warning 'use-package (format "Cannot load %s" 'foo) :error) (condition-case err (progn (foo-setup) t) ((debug error) (funcall use-package--warning3 :config err)))))) ((debug error) (funcall use-package--warning3 :catch err)))) (progn (defvar use-package--warning4 #'(lambda (keyword err) (let ((msg (format "%s/%s: %s" 'bar keyword (error-message-string err)))) (display-warning 'use-package msg :error)))) (condition-case err (eval-after-load 'baz #'(lambda nil (if (not (require 'bar nil t)) (display-warning 'use-package (format "Cannot load %s" 'bar) :error)))) ((debug error) (funcall use-package--warning4 :catch err)))) (progn (defvar use-package--warning5 #'(lambda (keyword err) (let ((msg (format "%s/%s: %s" 'baz keyword (error-message-string err)))) (display-warning 'use-package msg :error)))) (condition-case err (if (not (require 'baz nil t)) (display-warning 'use-package (format "Cannot load %s" 'baz) :error)) ((debug error) (funcall use-package--warning5 :catch err))))) --=-=-= Content-Type: text/plain -- Best, RY --=-=-=--