emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r117274: * emacs-lisp/cl-macs.el (cl-macrolet): Avoi


From: Leo Liu
Subject: [Emacs-diffs] trunk r117274: * emacs-lisp/cl-macs.el (cl-macrolet): Avoid excessive progn's.
Date: Thu, 05 Jun 2014 17:11:53 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117274
revision-id: address@hidden
parent: address@hidden
committer: Leo Liu <address@hidden>
branch nick: trunk
timestamp: Fri 2014-06-06 01:08:18 +0800
message:
  * emacs-lisp/cl-macs.el (cl-macrolet): Avoid excessive progn's.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/emacs-lisp/cl-macs.el     clmacs.el-20091113204419-o5vbwnq5f7feedwu-612
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-06-05 14:42:07 +0000
+++ b/lisp/ChangeLog    2014-06-05 17:08:18 +0000
@@ -1,3 +1,7 @@
+2014-06-05  Leo Liu  <address@hidden>
+
+       * emacs-lisp/cl-macs.el (cl-macrolet): Avoid excessive progn's.
+
 2014-06-05  Michal Nazarewicz  <address@hidden>
 
        * textmodes/tildify.el (tildify-foreach-region-outside-env): New

=== modified file 'lisp/emacs-lisp/cl-macs.el'
--- a/lisp/emacs-lisp/cl-macs.el        2014-05-04 19:37:56 +0000
+++ b/lisp/emacs-lisp/cl-macs.el        2014-06-05 17:08:18 +0000
@@ -1886,13 +1886,15 @@
              cl-declarations body)))
   (if (cdr bindings)
       `(cl-macrolet (,(car bindings)) (cl-macrolet ,(cdr bindings) ,@body))
-    (if (null bindings) (cons 'progn body)
-      (let* ((name (caar bindings))
-            (res (cl--transform-lambda (cdar bindings) name)))
-       (eval (car res))
-       (macroexpand-all (cons 'progn body)
-                         (cons (cons name `(lambda ,@(cdr res)))
-                               macroexpand-all-environment))))))
+    (let ((progn-maybe (lambda (body)
+                        (if (cdr body) (cons 'progn body) (car body)))))
+      (if (null bindings) (funcall progn-maybe body)
+       (let* ((name (caar bindings))
+              (res (cl--transform-lambda (cdar bindings) name)))
+         (eval (car res))
+         (macroexpand-all (funcall progn-maybe body)
+                          (cons (cons name `(lambda ,@(cdr res)))
+                                macroexpand-all-environment)))))))
 
 (defconst cl--old-macroexpand
   (if (and (boundp 'cl--old-macroexpand)


reply via email to

[Prev in Thread] Current Thread [Next in Thread]