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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 13021 in the body.
You can then email your comments to 13021 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#13021; Package emacs. (Wed, 28 Nov 2012 15:09:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Christopher Schmidt <christopher <at> ch.ristopher.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Wed, 28 Nov 2012 15:09:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13021; Package emacs. (Thu, 29 Nov 2012 04:30:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: bug-gnu-emacs <at> gnu.org
Cc: Michael Heerdegen <michael_heerdegen <at> web.de>
Subject: Re: bug#13021: 24.2.90; compile eval-after-load form
Date: Wed, 28 Nov 2012 23:27:35 -0500
> I think it is a good idea to compile the form that is passed to
> eval-after-load.

I agree.  More to the point, I think it should be a macro so you don't
need to wrap the code in '(progn ...).

But changing it to a macro would not be backward compatible (you can
convert a macro to a function, like I did recently for kbd, but not
other way around).
I learned this when I tried to convert .... eval-after-load ;-) many
years ago.

IOW, I'm open to introducing a replacement for eval-after-load which
would be a macro, but under another name.


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13021; Package emacs. (Thu, 29 Nov 2012 11:35:02 GMT) Full text and rfc822 format available.

Message #11 received at 13021 <at> debbugs.gnu.org (full text, mbox):

From: Juanma Barranquero <lekktu <at> gmail.com>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 13021 <at> debbugs.gnu.org, Michael Heerdegen <michael_heerdegen <at> web.de>
Subject: Re: bug#13021: 24.2.90; compile eval-after-load form
Date: Thu, 29 Nov 2012 12:31:44 +0100
On Thu, Nov 29, 2012 at 5:27 AM, Stefan Monnier
<monnier <at> iro.umontreal.ca> wrote:

> I think it should be a macro so you don't
> need to wrap the code in '(progn ...).
[...]
> IOW, I'm open to introducing a replacement for eval-after-load which
> would be a macro, but under another name.

That would be really nice.




Reply sent to Christopher Schmidt <christopher <at> ch.ristopher.com>:
You have taken responsibility. (Wed, 19 Jun 2013 23:56:01 GMT) Full text and rfc822 format available.

Notification sent to Christopher Schmidt <christopher <at> ch.ristopher.com>:
bug acknowledged by developer. (Wed, 19 Jun 2013 23:56:02 GMT) Full text and rfc822 format available.

Message #16 received at 13021-done <at> debbugs.gnu.org (full text, mbox):

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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13021; Package emacs. (Thu, 20 Jun 2013 22:57:02 GMT) Full text and rfc822 format available.

Message #19 received at 13021 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: 13021 <at> debbugs.gnu.org
Subject: Re: bug#13021: 24.2.90; compile eval-after-load form
Date: Fri, 21 Jun 2013 00:55:49 +0200
Christopher Schmidt <christopher <at> ch.ristopher.com> writes:

> There is with-eval-after-load now.

Can we add fontification for it?


Michael.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13021; Package emacs. (Fri, 21 Jun 2013 01:09:02 GMT) Full text and rfc822 format available.

Message #22 received at 13021 <at> debbugs.gnu.org (full text, mbox):

From: Michael Heerdegen <michael_heerdegen <at> web.de>
To: 13021 <at> debbugs.gnu.org
Subject: Re: bug#13021: 24.2.90; compile eval-after-load form
Date: Fri, 21 Jun 2013 03:08:35 +0200
[Message part 1 (text/plain, inline)]
Michael Heerdegen <michael_heerdegen <at> web.de> writes:

> > There is with-eval-after-load now.
>
> Can we add fontification for it?

I guess this should DTRT (right, Chris?):

[font-lock.patch (text/x-diff, inline)]
*** /home/micha/today/font-lock.el	2013-06-21 02:47:30.861222585 +0200
--- /home/micha/today/font-lock-new.el	2013-06-21 03:03:20.816992853 +0200
***************
*** 2288,2298 ****
                   "save-window-excursion" "save-match-data" "save-current-buffer"
  		 "combine-after-change-calls" "unwind-protect"
  		 "condition-case" "condition-case-unless-debug"
! 		 "track-mouse" "eval-after-load" "eval-and-compile"
! 		 "eval-when-compile" "eval-when" "eval-next-after-load"
! 		 "with-case-table" "with-category-table" "with-coding-priority"
! 		 "with-current-buffer" "with-demoted-errors"
! 		 "with-electric-help"
  		 "with-local-quit" "with-no-warnings"
  		 "with-output-to-string" "with-output-to-temp-buffer"
  		 "with-selected-window" "with-selected-frame"
--- 2288,2298 ----
                   "save-window-excursion" "save-match-data" "save-current-buffer"
  		 "combine-after-change-calls" "unwind-protect"
  		 "condition-case" "condition-case-unless-debug"
! 		 "track-mouse" "eval-after-load" "with-eval-after-load"
! 		 "eval-and-compile" "eval-when-compile" "eval-when"
! 		 "eval-next-after-load" "with-case-table" "with-category-table"
! 		 "with-coding-priority" "with-current-buffer"
! 		 "with-demoted-errors" "with-electric-help"
  		 "with-local-quit" "with-no-warnings"
  		 "with-output-to-string" "with-output-to-temp-buffer"
  		 "with-selected-window" "with-selected-frame"
[Message part 3 (text/plain, inline)]

Regards,

Michael.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 19 Jul 2013 11:24:03 GMT) Full text and rfc822 format available.

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.