all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#13021: 24.2.90; compile eval-after-load form
@ 2012-11-28 15:05 Christopher Schmidt
  2012-11-29  4:27 ` Stefan Monnier
  2013-06-19 23:55 ` Christopher Schmidt
  0 siblings, 2 replies; 6+ messages in thread
From: Christopher Schmidt @ 2012-11-28 15:05 UTC (permalink / raw)
  To: 13021; +Cc: Michael Heerdegen

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





^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-06-21  1:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-28 15:05 bug#13021: 24.2.90; compile eval-after-load form Christopher Schmidt
2012-11-29  4:27 ` Stefan Monnier
2012-11-29 11:31   ` Juanma Barranquero
2013-06-19 23:55 ` Christopher Schmidt
2013-06-20 22:55   ` Michael Heerdegen
2013-06-21  1:08     ` Michael Heerdegen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.