all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ergus <spacibba@aol.com>
To: tomas@tuxteam.de
Cc: Rodrigo Morales <me@rodrigomorales.site>, help-gnu-emacs@gnu.org
Subject: Re: [Question] use-package's :init or :config for enabling modes
Date: Wed, 22 May 2024 23:15:31 +0200	[thread overview]
Message-ID: <0413862E-6189-49C0-8A0A-B91274B9963A@aol.com> (raw)
In-Reply-To: <Zkrhphijsc0RqAHq@tuxteam.de>



On May 20, 2024 7:37:42 AM GMT+02:00, tomas@tuxteam.de wrote:
>On Sun, May 19, 2024 at 09:15:07PM +0200, Ergus wrote:
>> Hi:
>> 
>> I am not specialist here, but they exist because the :init is ALWAYS
>> executed while loading the init.el, but the :config is executed AFTER
>> loading the package (using eval-after-load).
>
>If I understand correctly, :init happens (possibly) before the package
>is loaded. So assuming it's already there seems risky.
>
Exactly. 

>Unless "just invoking" the mode (as OP did in the :init) manages to
>load the package, because, e.g. it is autoloaded). Then all is well,
>but the explicit load doesn't do anything, because the package was
>(auto-) loaded in the :init already.
>
>But I may be wrong :-)
>
The package may be autoloaded unless there is a defer indication (command, keymap, defer).

The :init may take place at any moment, but usually it is before loading the package. There is also a :preface keyword which happens even earlier, for example to set things like the load-path or define functions that will be used in the init.


>Cheers

-- 
Sent from my Android device with K-9 Mail. Please excuse my brevity.



  reply	other threads:[~2024-05-22 21:15 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
2024-05-20  5:37   ` tomas
2024-05-22 21:15     ` Ergus [this message]
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=0413862E-6189-49C0-8A0A-B91274B9963A@aol.com \
    --to=spacibba@aol.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=me@rodrigomorales.site \
    --cc=tomas@tuxteam.de \
    /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.