* 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
* bug#13021: 24.2.90; compile eval-after-load form
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
1 sibling, 1 reply; 6+ messages in thread
From: Stefan Monnier @ 2012-11-29 4:27 UTC (permalink / raw)
To: 13021; +Cc: Michael Heerdegen
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#13021: 24.2.90; compile eval-after-load form
2012-11-29 4:27 ` Stefan Monnier
@ 2012-11-29 11:31 ` Juanma Barranquero
0 siblings, 0 replies; 6+ messages in thread
From: Juanma Barranquero @ 2012-11-29 11:31 UTC (permalink / raw)
To: Stefan Monnier; +Cc: 13021, Michael Heerdegen
On Thu, Nov 29, 2012 at 5:27 AM, Stefan Monnier
<monnier@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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#13021: 24.2.90; compile eval-after-load form
2012-11-28 15:05 bug#13021: 24.2.90; compile eval-after-load form Christopher Schmidt
2012-11-29 4:27 ` Stefan Monnier
@ 2013-06-19 23:55 ` Christopher Schmidt
2013-06-20 22:55 ` Michael Heerdegen
1 sibling, 1 reply; 6+ messages in thread
From: Christopher Schmidt @ 2013-06-19 23:55 UTC (permalink / raw)
To: 13021-done
Christopher Schmidt <christopher@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
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#13021: 24.2.90; compile eval-after-load form
2013-06-19 23:55 ` Christopher Schmidt
@ 2013-06-20 22:55 ` Michael Heerdegen
2013-06-21 1:08 ` Michael Heerdegen
0 siblings, 1 reply; 6+ messages in thread
From: Michael Heerdegen @ 2013-06-20 22:55 UTC (permalink / raw)
To: 13021
Christopher Schmidt <christopher@ch.ristopher.com> writes:
> There is with-eval-after-load now.
Can we add fontification for it?
Michael.
^ permalink raw reply [flat|nested] 6+ messages in thread
* bug#13021: 24.2.90; compile eval-after-load form
2013-06-20 22:55 ` Michael Heerdegen
@ 2013-06-21 1:08 ` Michael Heerdegen
0 siblings, 0 replies; 6+ messages in thread
From: Michael Heerdegen @ 2013-06-21 1:08 UTC (permalink / raw)
To: 13021
[-- Attachment #1: Type: text/plain, Size: 174 bytes --]
Michael Heerdegen <michael_heerdegen@web.de> writes:
> > There is with-eval-after-load now.
>
> Can we add fontification for it?
I guess this should DTRT (right, Chris?):
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: font-lock.patch --]
[-- Type: text/x-diff, Size: 1413 bytes --]
*** /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"
[-- Attachment #3: Type: text/plain, Size: 21 bytes --]
Regards,
Michael.
^ 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.