aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeo Liu2014-06-06 01:08:18 +0800
committerLeo Liu2014-06-06 01:08:18 +0800
commit14781f7f44dfdfb015082e38894a7e0df4acff83 (patch)
treee7be3c0d7afc093b5707bfbc1669f33c7ffb3ec0
parent1d7f01eeed9b36fcfbb0d7a5de503a418b43814c (diff)
downloademacs-14781f7f44dfdfb015082e38894a7e0df4acff83.tar.gz
emacs-14781f7f44dfdfb015082e38894a7e0df4acff83.zip
* emacs-lisp/cl-macs.el (cl-macrolet): Avoid excessive progn's.
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/emacs-lisp/cl-macs.el16
2 files changed, 13 insertions, 7 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 0abb367f5b8..e0d2ff0a584 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,7 @@
12014-06-05 Leo Liu <sdl.web@gmail.com>
2
3 * emacs-lisp/cl-macs.el (cl-macrolet): Avoid excessive progn's.
4
12014-06-05 Michal Nazarewicz <mina86@mina86.com> 52014-06-05 Michal Nazarewicz <mina86@mina86.com>
2 6
3 * textmodes/tildify.el (tildify-foreach-region-outside-env): New 7 * textmodes/tildify.el (tildify-foreach-region-outside-env): New
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el
index 14e4d2da0c8..299cffc83aa 100644
--- a/lisp/emacs-lisp/cl-macs.el
+++ b/lisp/emacs-lisp/cl-macs.el
@@ -1886,13 +1886,15 @@ This is like `cl-flet', but for macros instead of functions.
1886 cl-declarations body))) 1886 cl-declarations body)))
1887 (if (cdr bindings) 1887 (if (cdr bindings)
1888 `(cl-macrolet (,(car bindings)) (cl-macrolet ,(cdr bindings) ,@body)) 1888 `(cl-macrolet (,(car bindings)) (cl-macrolet ,(cdr bindings) ,@body))
1889 (if (null bindings) (cons 'progn body) 1889 (let ((progn-maybe (lambda (body)
1890 (let* ((name (caar bindings)) 1890 (if (cdr body) (cons 'progn body) (car body)))))
1891 (res (cl--transform-lambda (cdar bindings) name))) 1891 (if (null bindings) (funcall progn-maybe body)
1892 (eval (car res)) 1892 (let* ((name (caar bindings))
1893 (macroexpand-all (cons 'progn body) 1893 (res (cl--transform-lambda (cdar bindings) name)))
1894 (cons (cons name `(lambda ,@(cdr res))) 1894 (eval (car res))
1895 macroexpand-all-environment)))))) 1895 (macroexpand-all (funcall progn-maybe body)
1896 (cons (cons name `(lambda ,@(cdr res)))
1897 macroexpand-all-environment)))))))
1896 1898
1897(defconst cl--old-macroexpand 1899(defconst cl--old-macroexpand
1898 (if (and (boundp 'cl--old-macroexpand) 1900 (if (and (boundp 'cl--old-macroexpand)