all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Rodrigo Morales <me@rodrigomorales.site>
To: Ergus <spacibba@aol.com>
Cc: <help-gnu-emacs@gnu.org>
Subject: Re: [Question] use-package's :init or :config for enabling modes
Date: Sun, 19 May 2024 23:03:49 -0500	[thread overview]
Message-ID: <875xv99lju.fsf@rodrigomorales.site> (raw)
In-Reply-To: <cw6hwdkplcxvgpthtjelxw2hdz4i2pasi2ku4nc35alpqmsbl6@ugqg7ny3t2gh>

Ergus <spacibba@aol.com> writes:

> When we defer the load (either with the :defer, :command or :keys) the
> package is lazily loaded using the autoload mecanisms.
>
> #+BEGIN_SRC elisp
> (use-package vertico :defer t
>    :init
>    (message "Call 1") ;; this will execute always
>    :config
>    (message "Call 2") ;; this will execute after M-x vertico-mode
>    (vertico-mode 1))
> #+END_SRC

Running (message ...) inside :init and :config made it easier to
understand when they are run. Thanks for the idea. It is more clear now.



  reply	other threads:[~2024-05-20  4:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-19 17:38 [Question] use-package's :init or :config for enabling modes Rodrigo Morales
2024-05-19 18:11 ` tomas
2024-05-20  3:56   ` Rodrigo Morales
2024-05-20  5:34     ` tomas
2024-05-19 19:15 ` Ergus
2024-05-20  4:03   ` Rodrigo Morales [this message]
2024-05-20  5:37   ` tomas
2024-05-22 21:15     ` Ergus
2024-05-23  4:32       ` tomas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=875xv99lju.fsf@rodrigomorales.site \
    --to=me@rodrigomorales.site \
    --cc=help-gnu-emacs@gnu.org \
    --cc=spacibba@aol.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.