summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/byte-opt.el
diff options
context:
space:
mode:
Diffstat (limited to 'lisp/emacs-lisp/byte-opt.el')
-rw-r--r--lisp/emacs-lisp/byte-opt.el8
1 files changed, 6 insertions, 2 deletions
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 23c5a566cea..ff512cca36f 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -727,8 +727,12 @@ Same format as `byte-optimize--lexvars', with shared structure and contents.")
(while rest
(setq fe (or all-for-effect (cdr rest)))
(setq new (and (car rest) (byte-optimize-form (car rest) fe)))
- (if (or new (not fe))
- (setq result (cons new result)))
+ (when (and (consp new) (eq (car new) 'progn))
+ ;; Flatten `progn' form into the body.
+ (setq result (append (reverse (cdr new)) result))
+ (setq new (pop result)))
+ (when (or new (not fe))
+ (setq result (cons new result)))
(setq rest (cdr rest)))
(nreverse result)))