Skip to content

Commit efe85a5

Browse files
committed
* lisp/emacs-lisp/cl-macs.el (cl--transform-lambda): Simplify result
It used to return a pair (EXP . LAMBDA-CDR) but EXP was always nil, so just return the LAMBDA-CDR instead. (cl-defun, cl-iter-defun, cl-defmacro, cl-function, cl-macrolet): Adjust callers accordingly.
1 parent 9900b14 commit efe85a5

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

lisp/emacs-lisp/cl-macs.el

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,7 @@ FORM is of the form (ARGS . BODY)."
328328
(setq cl--bind-lets (nreverse cl--bind-lets))
329329
;; (cl-assert (eq :dummy (nth 1 (car cl--bind-lets))))
330330
(list '&rest (car (pop cl--bind-lets))))))))
331-
`(nil
332-
(,@(nreverse simple-args) ,@rest-args)
331+
`((,@(nreverse simple-args) ,@rest-args)
333332
,@header
334333
,(macroexp-let* cl--bind-lets
335334
(macroexp-progn
@@ -366,9 +365,7 @@ more details.
366365
def-body))
367366
(doc-string 3)
368367
(indent 2))
369-
(let* ((res (cl--transform-lambda (cons args body) name))
370-
(form `(defun ,name ,@(cdr res))))
371-
(if (car res) `(progn ,(car res) ,form) form)))
368+
`(defun ,name ,@(cl--transform-lambda (cons args body) name)))
372369

373370
;;;###autoload
374371
(defmacro cl-iter-defun (name args &rest body)
@@ -387,9 +384,7 @@ and BODY is implicitly surrounded by (cl-block NAME ...).
387384
(doc-string 3)
388385
(indent 2))
389386
(require 'generator)
390-
(let* ((res (cl--transform-lambda (cons args body) name))
391-
(form `(iter-defun ,name ,@(cdr res))))
392-
(if (car res) `(progn ,(car res) ,form) form)))
387+
`(iter-defun ,name ,@(cl--transform-lambda (cons args body) name)))
393388

394389
;; The lambda list for macros is different from that of normal lambdas.
395390
;; Note that &environment is only allowed as first or last items in the
@@ -455,9 +450,7 @@ more details.
455450
(&define name cl-macro-list cl-declarations-or-string def-body))
456451
(doc-string 3)
457452
(indent 2))
458-
(let* ((res (cl--transform-lambda (cons args body) name))
459-
(form `(defmacro ,name ,@(cdr res))))
460-
(if (car res) `(progn ,(car res) ,form) form)))
453+
`(defmacro ,name ,@(cl--transform-lambda (cons args body) name)))
461454

462455
(def-edebug-spec cl-lambda-expr
463456
(&define ("lambda" cl-lambda-list
@@ -480,9 +473,7 @@ Like normal `function', except that if argument is a lambda form,
480473
its argument list allows full Common Lisp conventions."
481474
(declare (debug (&or symbolp cl-lambda-expr)))
482475
(if (eq (car-safe func) 'lambda)
483-
(let* ((res (cl--transform-lambda (cdr func) 'cl-none))
484-
(form `(function (lambda . ,(cdr res)))))
485-
(if (car res) `(progn ,(car res) ,form) form))
476+
`(function (lambda . ,(cl--transform-lambda (cdr func) 'cl-none)))
486477
`(function ,func)))
487478

488479
(defun cl--make-usage-var (x)
@@ -2111,10 +2102,9 @@ This is like `cl-flet', but for macros instead of functions.
21112102
(if (null bindings) (macroexp-progn body)
21122103
(let* ((name (caar bindings))
21132104
(res (cl--transform-lambda (cdar bindings) name)))
2114-
(eval (car res))
21152105
(macroexpand-all (macroexp-progn body)
21162106
(cons (cons name
2117-
(eval `(cl-function (lambda ,@(cdr res))) t))
2107+
(eval `(function (lambda ,@res)) t))
21182108
macroexpand-all-environment))))))
21192109

21202110
(defun cl--sm-macroexpand (orig-fun exp &optional env)

0 commit comments

Comments
 (0)