help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: [External] : Re: About the usage of `with-eval-after-load'.


From: Drew Adams
Subject: RE: [External] : Re: About the usage of `with-eval-after-load'.
Date: Sat, 18 Sep 2021 14:56:01 +0000

> > 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 via email to

[Prev in Thread] Current Thread [Next in Thread]