Subject: bug#13021: closed (Re: bug#13021: 24.2.90; compile eval-after-load form)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 19 Jun 2013 23:56:02 +0000

Your bug report

#13021: 24.2.90; compile eval-after-load form

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
13021: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13021
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#13021: 24.2.90; compile eval-after-load form
From: Christopher Schmidt <[email-masked]>
To: [email-masked]
Date: Thu, 20 Jun 2013 00:55:27 +0100 (BST)
List-Id: <debbugs-submit.debbugs.gnu.org>

Christopher Schmidt <[email-masked]> writes:
> I think it is a good idea to compile the form that is passed to
> eval-after-load.

There is with-eval-after-load now.

        Christopher

Subject: 24.2.90; compile eval-after-load form
From: Christopher Schmidt <[email-masked]>
To: [email-masked]
Cc: Michael Heerdegen <[email-masked]>
Date: Wed, 28 Nov 2012 15:05:56 +0000 (GMT)
List-Id: <debbugs-submit.debbugs.gnu.org>

severity: wishlist

I think it is a good idea to compile the form that is passed to
eval-after-load.  The advantage is that one gets compiler warnings and
errors and the form itself is executed faster.

This is what I use:

    (defmacro eal (package &rest forms)
      (declare (indent 1) (debug t))
      `(,(if (if (symbolp package)
                 (require package nil t)
               (load package t t))
             'progn
           (message "eal: cannot find %s" package)
           'with-no-warnings)
        (eval-after-load ',package
          `(funcall (function ,(lambda () ,@forms))))))

This is what Michael (Heerdegen) uses:

    (defun-safe init-file-eval-after-load (file &rest forms)
      "Like `eval-after-load', but byte-compile FORMS before eval."
      (eval-after-load file `(let ((byte-compile-log-buffer "*Warnings*")
                                   (byte-compile-current-form
                                    (format "`init-file-eval-after-load': %s" ',file)))
                               (funcall (byte-compile (lambda () ,@forms))))))

Could vanilla eval-after-load be modified so it compiles the form?  I am
thinking of an optional third parameter, one that allows to either keep
the current behaviour (default), load the package & compile the form at
compile time or compile the form at run-time before evaling.

WDYT?

        Christopher