emacs-devel
[Top][All Lists]
Advanced

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

Re: emacs-26: `with-eval-after-load' docstring omission


From: Stefan Monnier
Subject: Re: emacs-26: `with-eval-after-load' docstring omission
Date: Sat, 17 Mar 2018 10:19:22 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

>   (with-eval-after-load 'flycheck
>     (push "npx" (flycheck-checker-get 'javascript-eslint 'command)))
>
>   Debugger entered--Lisp error: (void-function \(setf\ flycheck-checker-get\))
>     (\(setf\ flycheck-checker-get\) (cons "npx" (flycheck-checker-get 
> 'javascript-eslint 'command)) 'javascript-eslint 'command)

Yes, in this specific case, flycheck could actually make it work by defining
a (setf flycheck-checker-get) function.

> What do we gain from byte-compiling the bodies of with-eval-after-load forms?

As mentioned before: cleaner semantics.  Macro-expanding the body of
with-eval-after-load more lazily (which is the core of the problem
you're hitting) won't help you if you happened to write your code as:

    (defun my-after-flycheck ()
      (push "npx" (flycheck-checker-get 'javascript-eslint 'command)))
    (with-eval-after-load 'flycheck
      (my-after-flycheck))

> Maybe we can find a way to prevent macro-expansion issues and make the
> behavior more intuitive?

I'd suggest to start by trying to find a way to get the behavior you
want *without* relying on (with-)eval-after-load (which is fiddly in any
case for all kinds of reasons.  It's a handy tool when you need it, but
if you need it I consider that it's usually a sign that there's
a problem elsewhere).
Of course, this may require changes in flycheck.


        Stefan



reply via email to

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