emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 1b4442b: Don't expand body inside a let-binding whe


From: Mark Oteiza
Subject: [Emacs-diffs] master 1b4442b: Don't expand body inside a let-binding when there are no bindings
Date: Wed, 15 Feb 2017 20:43:07 -0500 (EST)

branch: master
commit 1b4442bee921d6698fc8ecac1c95c39f7ca2efe4
Author: Mark Oteiza <address@hidden>
Commit: Mark Oteiza <address@hidden>

    Don't expand body inside a let-binding when there are no bindings
    
    * lisp/emacs-lisp/pcase.el (pcase-codegen): Only let-bind if VARS
    is non-nil.
---
 lisp/emacs-lisp/pcase.el | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index 46a5eed..289265a 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -437,8 +437,10 @@ to this macro."
   ;; Don't use let*, otherwise macroexp-let* may merge it with some surrounding
   ;; let* which might prevent the setcar/setcdr in pcase--expand's fancy
   ;; codegen from later metamorphosing this let into a funcall.
-  `(let ,(mapcar (lambda (b) (list (car b) (cdr b))) vars)
-     ,@code))
+  (if vars
+      `(let ,(mapcar (lambda (b) (list (car b) (cdr b))) vars)
+         ,@code)
+    `(progn ,@code)))
 
 (defun pcase--small-branch-p (code)
   (and (= 1 (length code))



reply via email to

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