comparison lisp/emacs-lisp/cl-macs.el @ 20750:df2745fa6999

(define-compiler-macro): Handle empty arglist.
author Richard M. Stallman <rms@gnu.org>
date Thu, 22 Jan 1998 02:26:48 +0000
parents 5abc38e45195
children 99cb527e79ba
comparison
equal deleted inserted replaced
20749:e87544dbfacb 20750:df2745fa6999
2438 FUNC, though possibly more efficiently. Note that, like regular macros, 2438 FUNC, though possibly more efficiently. Note that, like regular macros,
2439 compiler macros are expanded repeatedly until no further expansions are 2439 compiler macros are expanded repeatedly until no further expansions are
2440 possible. Unlike regular macros, BODY can decide to \"punt\" and leave the 2440 possible. Unlike regular macros, BODY can decide to \"punt\" and leave the
2441 original function call alone by declaring an initial `&whole foo' parameter 2441 original function call alone by declaring an initial `&whole foo' parameter
2442 and then returning foo." 2442 and then returning foo."
2443 (let ((p (if (listp args) args (list '&rest args))) (res nil)) 2443 (let ((p args) (res nil))
2444 (while (consp p) (cl-push (cl-pop p) res)) 2444 (while (consp p) (cl-push (cl-pop p) res))
2445 (setq args (nreverse res)) (setcdr res (and p (list '&rest p)))) 2445 (setq args (nconc (nreverse res) (and p (list '&rest p)))))
2446 (list 'eval-when '(compile load eval) 2446 (list 'eval-when '(compile load eval)
2447 (cl-transform-function-property 2447 (cl-transform-function-property
2448 func 'cl-compiler-macro 2448 func 'cl-compiler-macro
2449 (cons (if (memq '&whole args) (delq '&whole args) 2449 (cons (if (memq '&whole args) (delq '&whole args)
2450 (cons '--cl-whole-arg-- args)) body)) 2450 (cons '--cl-whole-arg-- args)) body))