Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
1fea2f3b
Commit
1fea2f3b
authored
Sep 29, 2015
by
Stefan Monnier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* lisp/emacs-lisp/lisp-mode.el (let-when-compile): Work like let*
parent
b425b3ff
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
8 deletions
+12
-8
lisp/emacs-lisp/lisp-mode.el
lisp/emacs-lisp/lisp-mode.el
+12
-8
No files found.
lisp/emacs-lisp/lisp-mode.el
View file @
1fea2f3b
...
...
@@ -238,17 +238,21 @@
(throw 'found t))))))
(defmacro let-when-compile (bindings &rest body)
"
Like
`
let
',
but
allow
for
compile
time
optimization.
Use
BINDINGS
as
in
regular
`
let
',
but
in
BODY
each
usage
should
"
Like
`
let
*
',
but
allow
for
compile
time
optimization.
Use
BINDINGS
as
in
regular
`
let
*
',
but
in
BODY
each
usage
should
be
wrapped
in
`
eval-when-compile
'.
This
will
generate
compile-time
constants
from
BINDINGS.
"
(declare (indent 1) (debug let))
(cl-progv (mapcar #'car bindings)
(mapcar (lambda (x) (eval (cadr x))) bindings)
(macroexpand-all
(macroexp-progn
body)
macroexpand-all-environment)))
(letrec ((loop
(lambda (bindings)
(if (null bindings)
(macroexpand-all (macroexp-progn body)
macroexpand-all-environment)
(let ((binding (pop bindings)))
(cl-progv (list (car binding))
(list (eval (nth 1 binding) t))
(funcall loop bindings)))))))
(funcall loop bindings)))
(let-when-compile
((lisp-fdefs '("
defmacro
" "
defun
"))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment