GNU bug report logs - #13021
24.2.90; compile eval-after-load form

Previous Next

Package: emacs;

Reported by: Christopher Schmidt <christopher <at> ch.ristopher.com>

Date: Wed, 28 Nov 2012 15:09:02 UTC

Severity: wishlist

Found in version 24.2.90

Done: Christopher Schmidt <christopher <at> ch.ristopher.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Christopher Schmidt <christopher <at> ch.ristopher.com>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#13021: closed (24.2.90; compile eval-after-load form)
Date: Wed, 19 Jun 2013 23:56:01 +0000
[Message part 1 (text/plain, inline)]
Your message dated Thu, 20 Jun 2013 00:55:27 +0100 (BST)
with message-id <87mwql64gk <at> ch.ristopher.com>
and subject line Re: bug#13021: 24.2.90; compile eval-after-load form
has caused the debbugs.gnu.org bug report #13021,
regarding 24.2.90; compile eval-after-load form
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
13021: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=13021
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Christopher Schmidt <christopher <at> ch.ristopher.com>
To: bug-gnu-emacs <at> gnu.org
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>
Subject: 24.2.90; compile eval-after-load form
Date: Wed, 28 Nov 2012 15:05:56 +0000 (GMT)
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


[Message part 3 (message/rfc822, inline)]
From: Christopher Schmidt <christopher <at> ch.ristopher.com>
To: 13021-done <at> debbugs.gnu.org
Subject: Re: bug#13021: 24.2.90; compile eval-after-load form
Date: Thu, 20 Jun 2013 00:55:27 +0100 (BST)
Christopher Schmidt <christopher <at> ch.ristopher.com> 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


This bug report was last modified 11 years and 340 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.