[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: emacs-26: `with-eval-after-load' docstring omission
From: |
Clément Pit-Claudel |
Subject: |
Re: emacs-26: `with-eval-after-load' docstring omission |
Date: |
Wed, 28 Feb 2018 09:53:09 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 |
On 2018-02-27 15:58, Stefan Monnier wrote:
>
> (defun FUN () EXP)
> (eval-after-load FILE '(FUN))
> ≠
> (eval-after-load FILE 'EXP)
>
> [ Well, of course, this equivalence is actually true as well given the
> current compiler-macro, but I'm assuming above that we undo this
> compiler macro. ]
>
> IOW, the behavior you seem to want is semantically a good bit more messy.
Is that because macroexpansion happens eagerly in the body of the defun, too?
I guess I just don't expect that to happen unless the file is byte-compiled,
really :/
> In your case, you do want the quote because you need to delay
> macro-expansion, but I think it's cleaner to solve this problem by
> *explicitly* using a quote, rather than by relying on the messy
> semantics of the macro/function you happen to be using.
I'm not sure I follow: doesn't the compiler macro mean that even explicitly
using a quote isn't enough?
> E.g. your exact same problem could show up if you used, say,
> (add-hook 'flycheck-mode-hook ...)
> instead of
> (with-eval-after-load ...)
> but you wouldn't ask for a change in add-hook to "solve" your problem.
Would the problem there be that the body of the lambda I'd pass to add-hook
would be eagerly macro-expanded?
I think the big difference between these two is that I expect
`with-eval-after-load` to really behave differently, and the reason for
expecting that is that we don't otherwise have a convenient way to delay
macroexpansion and execution of a form until a file is loaded, right?
Maybe we need a `with-macroexp-and-eval-after-load`?
Clément.
Re: emacs-26: `with-eval-after-load' docstring omission, Stefan Monnier, 2018/02/27