all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Hongyi Zhao <hongyi.zhao@gmail.com>
To: Drew Adams <drew.adams@oracle.com>
Cc: Joost Kremers <joostkremers@fastmail.fm>,
	"help-gnu-emacs@gnu.org" <help-gnu-emacs@gnu.org>
Subject: Re: [External] : Re: About the usage of `with-eval-after-load'.
Date: Sun, 19 Sep 2021 11:41:39 +0800	[thread overview]
Message-ID: <CAGP6POJ-yYn_vKpUuaGCDXscDVysdKozT_EfZWF0OuTn7jZdGw@mail.gmail.com> (raw)
In-Reply-To: <SJ0PR10MB5488579E4A384EC682D3E00BF3DE9@SJ0PR10MB5488.namprd10.prod.outlook.com>

On Sat, Sep 18, 2021 at 10:56 PM Drew Adams <drew.adams@oracle.com> wrote:
>
> > > 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.

Thank you for your thoughtful further explanation, which makes me feel
that the Emacs community is indeed one of the few places in the world
where dedicated experts and masters gather. Even though my LISP
language level is still fairly rudimentary, I still have the
motivation to improve with the help of many mentors in such an
environment.

BTW, why do you write the title for your post like the following:

RE: [External] :

Best, HZ



  reply	other threads:[~2021-09-19  3:41 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   ` [External] : " Drew Adams
2021-09-19  3:41     ` Hongyi Zhao [this message]
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

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

  git send-email \
    --in-reply-to=CAGP6POJ-yYn_vKpUuaGCDXscDVysdKozT_EfZWF0OuTn7jZdGw@mail.gmail.com \
    --to=hongyi.zhao@gmail.com \
    --cc=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --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.
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.