unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Joost Kremers <joostkremers@fastmail.fm>,
	Hongyi Zhao <hongyi.zhao@gmail.com>
Cc: "help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: RE: [External] : Re: About the usage of `with-eval-after-load'.
Date: Sat, 18 Sep 2021 14:56:01 +0000	[thread overview]
Message-ID: <SJ0PR10MB5488579E4A384EC682D3E00BF3DE9@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)
In-Reply-To: <87wnnetazo.fsf@fastmail.fm>

> > Based on the above explanation, it seems that only one FILE can be
> > used, but according to my tries, the following code snippet also take
> > effect:
> >   (add-hook 'python-mode-hook 'hs-minor-mode)
> >   (with-eval-after-load
> >     "python"
> >     (progn...) 'elpy (pyvenv-activate...))

Joost explained well what's going on.  In addition,
just in case it still isn't clear:

You're using only _one_ FILE arg, "python".  The 3
other args you pass correspond to the &rest arg (aka
&body defmacro arg), BODY.  So BODY is the list of
actual args: ((progn...) 'elpy (pyenv-activate...)).

Before macro `with-eval-after-load' was added, users
sometimes forgot to quote (or otherwise generate) the
second arg to the _function_ `eval-after-load' (and it
is a single arg, FORM, not an &rest list of args BODY).

That was the main reason `with-*' was introduced: for
convenience because 99% of the time FORM was a quoted
sexp, and sometimes users forgot the quote char.

  reply	other threads:[~2021-09-18 14:56 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-18  9:51 About the usage of `with-eval-after-load' Hongyi Zhao
2021-09-18 10:28 ` Omar Polo
2021-09-18 10:40 ` Joost Kremers
2021-09-18 14:56   ` Drew Adams [this message]
2021-09-19  3:41     ` [External] : " Hongyi Zhao
2021-09-19  4:25       ` Drew Adams
2021-09-19  0:16 ` Michael Heerdegen
2021-09-19  1:16   ` Hongyi Zhao
2021-09-19  1:50     ` Michael Heerdegen
2021-09-19  1:55       ` Hongyi Zhao

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=SJ0PR10MB5488579E4A384EC682D3E00BF3DE9@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=hongyi.zhao@gmail.com \
    --cc=joostkremers@fastmail.fm \
    /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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).