diff options
| author | Stefan Monnier | 2007-06-27 18:53:15 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2007-06-27 18:53:15 +0000 |
| commit | ebacfcc69dc1246c5cc6774b05b0de6ad46224d1 (patch) | |
| tree | 3ff1a793439a605a9b4fae93778d5b09f64cbcd7 | |
| parent | 36c6bc15c8318993963538825307eefb8a3eecc6 (diff) | |
| download | emacs-ebacfcc69dc1246c5cc6774b05b0de6ad46224d1.tar.gz emacs-ebacfcc69dc1246c5cc6774b05b0de6ad46224d1.zip | |
Set generated-autoload-file to cl-loaddefs.el.
Add autoload cookies on all defs autoloaded manually in cl.el.
| -rw-r--r-- | lisp/emacs-lisp/cl-macs.el | 65 |
1 files changed, 62 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index adbe7054cda..10228c151c1 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el | |||
| @@ -75,6 +75,7 @@ | |||
| 75 | 75 | ||
| 76 | (defvar cl-old-bc-file-form nil) | 76 | (defvar cl-old-bc-file-form nil) |
| 77 | 77 | ||
| 78 | ;;;###autoload | ||
| 78 | (defun cl-compile-time-init () | 79 | (defun cl-compile-time-init () |
| 79 | (run-hooks 'cl-hack-bytecomp-hook)) | 80 | (run-hooks 'cl-hack-bytecomp-hook)) |
| 80 | 81 | ||
| @@ -165,6 +166,7 @@ | |||
| 165 | ;;; Symbols. | 166 | ;;; Symbols. |
| 166 | 167 | ||
| 167 | (defvar *gensym-counter*) | 168 | (defvar *gensym-counter*) |
| 169 | ;;;###autoload | ||
| 168 | (defun gensym (&optional prefix) | 170 | (defun gensym (&optional prefix) |
| 169 | "Generate a new uninterned symbol. | 171 | "Generate a new uninterned symbol. |
| 170 | The name is made by appending a number to PREFIX, default \"G\"." | 172 | The name is made by appending a number to PREFIX, default \"G\"." |
| @@ -174,6 +176,7 @@ The name is made by appending a number to PREFIX, default \"G\"." | |||
| 174 | (setq *gensym-counter* (1+ *gensym-counter*)))))) | 176 | (setq *gensym-counter* (1+ *gensym-counter*)))))) |
| 175 | (make-symbol (format "%s%d" pfix num)))) | 177 | (make-symbol (format "%s%d" pfix num)))) |
| 176 | 178 | ||
| 179 | ;;;###autoload | ||
| 177 | (defun gentemp (&optional prefix) | 180 | (defun gentemp (&optional prefix) |
| 178 | "Generate a new interned symbol with a unique name. | 181 | "Generate a new interned symbol with a unique name. |
| 179 | The name is made by appending a number to PREFIX, default \"G\"." | 182 | The name is made by appending a number to PREFIX, default \"G\"." |
| @@ -186,6 +189,7 @@ The name is made by appending a number to PREFIX, default \"G\"." | |||
| 186 | 189 | ||
| 187 | ;;; Program structure. | 190 | ;;; Program structure. |
| 188 | 191 | ||
| 192 | ;;;###autoload | ||
| 189 | (defmacro defun* (name args &rest body) | 193 | (defmacro defun* (name args &rest body) |
| 190 | "Define NAME as a function. | 194 | "Define NAME as a function. |
| 191 | Like normal `defun', except ARGLIST allows full Common Lisp conventions, | 195 | Like normal `defun', except ARGLIST allows full Common Lisp conventions, |
| @@ -196,6 +200,7 @@ and BODY is implicitly surrounded by (block NAME ...). | |||
| 196 | (form (list* 'defun name (cdr res)))) | 200 | (form (list* 'defun name (cdr res)))) |
| 197 | (if (car res) (list 'progn (car res) form) form))) | 201 | (if (car res) (list 'progn (car res) form) form))) |
| 198 | 202 | ||
| 203 | ;;;###autoload | ||
| 199 | (defmacro defmacro* (name args &rest body) | 204 | (defmacro defmacro* (name args &rest body) |
| 200 | "Define NAME as a macro. | 205 | "Define NAME as a macro. |
| 201 | Like normal `defmacro', except ARGLIST allows full Common Lisp conventions, | 206 | Like normal `defmacro', except ARGLIST allows full Common Lisp conventions, |
| @@ -206,6 +211,7 @@ and BODY is implicitly surrounded by (block NAME ...). | |||
| 206 | (form (list* 'defmacro name (cdr res)))) | 211 | (form (list* 'defmacro name (cdr res)))) |
| 207 | (if (car res) (list 'progn (car res) form) form))) | 212 | (if (car res) (list 'progn (car res) form) form))) |
| 208 | 213 | ||
| 214 | ;;;###autoload | ||
| 209 | (defmacro function* (func) | 215 | (defmacro function* (func) |
| 210 | "Introduce a function. | 216 | "Introduce a function. |
| 211 | Like normal `function', except that if argument is a lambda form, | 217 | Like normal `function', except that if argument is a lambda form, |
| @@ -422,6 +428,7 @@ its argument list allows full Common Lisp conventions." | |||
| 422 | (setq res (nconc res (cl-arglist-args arg)))))) | 428 | (setq res (nconc res (cl-arglist-args arg)))))) |
| 423 | (nconc res (and args (list args)))))) | 429 | (nconc res (and args (list args)))))) |
| 424 | 430 | ||
| 431 | ;;;###autoload | ||
| 425 | (defmacro destructuring-bind (args expr &rest body) | 432 | (defmacro destructuring-bind (args expr &rest body) |
| 426 | (let* ((bind-lets nil) (bind-forms nil) (bind-inits nil) | 433 | (let* ((bind-lets nil) (bind-forms nil) (bind-inits nil) |
| 427 | (bind-defs nil) (bind-block 'cl-none)) | 434 | (bind-defs nil) (bind-block 'cl-none)) |
| @@ -435,6 +442,7 @@ its argument list allows full Common Lisp conventions." | |||
| 435 | 442 | ||
| 436 | (defvar cl-not-toplevel nil) | 443 | (defvar cl-not-toplevel nil) |
| 437 | 444 | ||
| 445 | ;;;###autoload | ||
| 438 | (defmacro eval-when (when &rest body) | 446 | (defmacro eval-when (when &rest body) |
| 439 | "Control when BODY is evaluated. | 447 | "Control when BODY is evaluated. |
| 440 | If `compile' is in WHEN, BODY is evaluated when compiled at top-level. | 448 | If `compile' is in WHEN, BODY is evaluated when compiled at top-level. |
| @@ -466,6 +474,7 @@ If `eval' is in WHEN, BODY is evaluated when interpreted or at non-top-level. | |||
| 466 | form))) | 474 | form))) |
| 467 | (t (eval form) form))) | 475 | (t (eval form) form))) |
| 468 | 476 | ||
| 477 | ;;;###autoload | ||
| 469 | (defmacro load-time-value (form &optional read-only) | 478 | (defmacro load-time-value (form &optional read-only) |
| 470 | "Like `progn', but evaluates the body at load time. | 479 | "Like `progn', but evaluates the body at load time. |
| 471 | The result of the body appears to the compiler as a quoted constant." | 480 | The result of the body appears to the compiler as a quoted constant." |
| @@ -488,6 +497,7 @@ The result of the body appears to the compiler as a quoted constant." | |||
| 488 | 497 | ||
| 489 | ;;; Conditional control structures. | 498 | ;;; Conditional control structures. |
| 490 | 499 | ||
| 500 | ;;;###autoload | ||
| 491 | (defmacro case (expr &rest clauses) | 501 | (defmacro case (expr &rest clauses) |
| 492 | "Eval EXPR and choose among clauses on that value. | 502 | "Eval EXPR and choose among clauses on that value. |
| 493 | Each clause looks like (KEYLIST BODY...). EXPR is evaluated and compared | 503 | Each clause looks like (KEYLIST BODY...). EXPR is evaluated and compared |
| @@ -522,12 +532,14 @@ Key values are compared by `eql'. | |||
| 522 | (if (eq temp expr) body | 532 | (if (eq temp expr) body |
| 523 | (list 'let (list (list temp expr)) body)))) | 533 | (list 'let (list (list temp expr)) body)))) |
| 524 | 534 | ||
| 535 | ;;;###autoload | ||
| 525 | (defmacro ecase (expr &rest clauses) | 536 | (defmacro ecase (expr &rest clauses) |
| 526 | "Like `case', but error if no case fits. | 537 | "Like `case', but error if no case fits. |
| 527 | `otherwise'-clauses are not allowed. | 538 | `otherwise'-clauses are not allowed. |
| 528 | \n(fn EXPR (KEYLIST BODY...)...)" | 539 | \n(fn EXPR (KEYLIST BODY...)...)" |
| 529 | (list* 'case expr (append clauses '((ecase-error-flag))))) | 540 | (list* 'case expr (append clauses '((ecase-error-flag))))) |
| 530 | 541 | ||
| 542 | ;;;###autoload | ||
| 531 | (defmacro typecase (expr &rest clauses) | 543 | (defmacro typecase (expr &rest clauses) |
| 532 | "Evals EXPR, chooses among clauses on that value. | 544 | "Evals EXPR, chooses among clauses on that value. |
| 533 | Each clause looks like (TYPE BODY...). EXPR is evaluated and, if it | 545 | Each clause looks like (TYPE BODY...). EXPR is evaluated and, if it |
| @@ -554,6 +566,7 @@ final clause, and matches if no other keys match. | |||
| 554 | (if (eq temp expr) body | 566 | (if (eq temp expr) body |
| 555 | (list 'let (list (list temp expr)) body)))) | 567 | (list 'let (list (list temp expr)) body)))) |
| 556 | 568 | ||
| 569 | ;;;###autoload | ||
| 557 | (defmacro etypecase (expr &rest clauses) | 570 | (defmacro etypecase (expr &rest clauses) |
| 558 | "Like `typecase', but error if no case fits. | 571 | "Like `typecase', but error if no case fits. |
| 559 | `otherwise'-clauses are not allowed. | 572 | `otherwise'-clauses are not allowed. |
| @@ -563,6 +576,7 @@ final clause, and matches if no other keys match. | |||
| 563 | 576 | ||
| 564 | ;;; Blocks and exits. | 577 | ;;; Blocks and exits. |
| 565 | 578 | ||
| 579 | ;;;###autoload | ||
| 566 | (defmacro block (name &rest body) | 580 | (defmacro block (name &rest body) |
| 567 | "Define a lexically-scoped block named NAME. | 581 | "Define a lexically-scoped block named NAME. |
| 568 | NAME may be any symbol. Code inside the BODY forms can call `return-from' | 582 | NAME may be any symbol. Code inside the BODY forms can call `return-from' |
| @@ -598,11 +612,13 @@ called from BODY." | |||
| 598 | (if cl-found (setcdr cl-found t))) | 612 | (if cl-found (setcdr cl-found t))) |
| 599 | (byte-compile-normal-call (cons 'throw (cdr cl-form)))) | 613 | (byte-compile-normal-call (cons 'throw (cdr cl-form)))) |
| 600 | 614 | ||
| 615 | ;;;###autoload | ||
| 601 | (defmacro return (&optional result) | 616 | (defmacro return (&optional result) |
| 602 | "Return from the block named nil. | 617 | "Return from the block named nil. |
| 603 | This is equivalent to `(return-from nil RESULT)'." | 618 | This is equivalent to `(return-from nil RESULT)'." |
| 604 | (list 'return-from nil result)) | 619 | (list 'return-from nil result)) |
| 605 | 620 | ||
| 621 | ;;;###autoload | ||
| 606 | (defmacro return-from (name &optional result) | 622 | (defmacro return-from (name &optional result) |
| 607 | "Return from the block named NAME. | 623 | "Return from the block named NAME. |
| 608 | This jump out to the innermost enclosing `(block NAME ...)' form, | 624 | This jump out to the innermost enclosing `(block NAME ...)' form, |
| @@ -622,6 +638,7 @@ This is compatible with Common Lisp, but note that `defun' and | |||
| 622 | (defvar loop-result) (defvar loop-result-explicit) | 638 | (defvar loop-result) (defvar loop-result-explicit) |
| 623 | (defvar loop-result-var) (defvar loop-steps) (defvar loop-symbol-macs) | 639 | (defvar loop-result-var) (defvar loop-steps) (defvar loop-symbol-macs) |
| 624 | 640 | ||
| 641 | ;;;###autoload | ||
| 625 | (defmacro loop (&rest args) | 642 | (defmacro loop (&rest args) |
| 626 | "The Common Lisp `loop' macro. | 643 | "The Common Lisp `loop' macro. |
| 627 | Valid clauses are: | 644 | Valid clauses are: |
| @@ -1181,12 +1198,14 @@ Valid clauses are: | |||
| 1181 | 1198 | ||
| 1182 | ;;; Other iteration control structures. | 1199 | ;;; Other iteration control structures. |
| 1183 | 1200 | ||
| 1201 | ;;;###autoload | ||
| 1184 | (defmacro do (steps endtest &rest body) | 1202 | (defmacro do (steps endtest &rest body) |
| 1185 | "The Common Lisp `do' loop. | 1203 | "The Common Lisp `do' loop. |
| 1186 | 1204 | ||
| 1187 | \(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)" | 1205 | \(fn ((VAR INIT [STEP])...) (END-TEST [RESULT...]) BODY...)" |
| 1188 | (cl-expand-do-loop steps endtest body nil)) | 1206 | (cl-expand-do-loop steps endtest body nil)) |
| 1189 | 1207 | ||
| 1208 | ;;;###autoload | ||
| 1190 | (defmacro do* (steps endtest &rest body) | 1209 | (defmacro do* (steps endtest &rest body) |
| 1191 | "The Common Lisp `do*' loop. | 1210 | "The Common Lisp `do*' loop. |
| 1192 | 1211 | ||
| @@ -1214,6 +1233,7 @@ Valid clauses are: | |||
| 1214 | (apply 'append sets))))))) | 1233 | (apply 'append sets))))))) |
| 1215 | (or (cdr endtest) '(nil))))) | 1234 | (or (cdr endtest) '(nil))))) |
| 1216 | 1235 | ||
| 1236 | ;;;###autoload | ||
| 1217 | (defmacro dolist (spec &rest body) | 1237 | (defmacro dolist (spec &rest body) |
| 1218 | "Loop over a list. | 1238 | "Loop over a list. |
| 1219 | Evaluate BODY with VAR bound to each `car' from LIST, in turn. | 1239 | Evaluate BODY with VAR bound to each `car' from LIST, in turn. |
| @@ -1230,6 +1250,7 @@ Then evaluate RESULT to get return value, default nil. | |||
| 1230 | (cons (list 'setq (car spec) nil) (cdr (cdr spec))) | 1250 | (cons (list 'setq (car spec) nil) (cdr (cdr spec))) |
| 1231 | '(nil)))))) | 1251 | '(nil)))))) |
| 1232 | 1252 | ||
| 1253 | ;;;###autoload | ||
| 1233 | (defmacro dotimes (spec &rest body) | 1254 | (defmacro dotimes (spec &rest body) |
| 1234 | "Loop a certain number of times. | 1255 | "Loop a certain number of times. |
| 1235 | Evaluate BODY with VAR bound to successive integers from 0, inclusive, | 1256 | Evaluate BODY with VAR bound to successive integers from 0, inclusive, |
| @@ -1244,6 +1265,7 @@ nil. | |||
| 1244 | (append body (list (list 'incf (car spec))))) | 1265 | (append body (list (list 'incf (car spec))))) |
| 1245 | (or (cdr (cdr spec)) '(nil)))))) | 1266 | (or (cdr (cdr spec)) '(nil)))))) |
| 1246 | 1267 | ||
| 1268 | ;;;###autoload | ||
| 1247 | (defmacro do-symbols (spec &rest body) | 1269 | (defmacro do-symbols (spec &rest body) |
| 1248 | "Loop over all symbols. | 1270 | "Loop over all symbols. |
| 1249 | Evaluate BODY with VAR bound to each interned symbol, or to each symbol | 1271 | Evaluate BODY with VAR bound to each interned symbol, or to each symbol |
| @@ -1258,12 +1280,14 @@ from OBARRAY. | |||
| 1258 | (and (cadr spec) (list (cadr spec)))) | 1280 | (and (cadr spec) (list (cadr spec)))) |
| 1259 | (caddr spec)))) | 1281 | (caddr spec)))) |
| 1260 | 1282 | ||
| 1283 | ;;;###autoload | ||
| 1261 | (defmacro do-all-symbols (spec &rest body) | 1284 | (defmacro do-all-symbols (spec &rest body) |
| 1262 | (list* 'do-symbols (list (car spec) nil (cadr spec)) body)) | 1285 | (list* 'do-symbols (list (car spec) nil (cadr spec)) body)) |
| 1263 | 1286 | ||
| 1264 | 1287 | ||
| 1265 | ;;; Assignments. | 1288 | ;;; Assignments. |
| 1266 | 1289 | ||
| 1290 | ;;;###autoload | ||
| 1267 | (defmacro psetq (&rest args) | 1291 | (defmacro psetq (&rest args) |
| 1268 | "Set SYMs to the values VALs in parallel. | 1292 | "Set SYMs to the values VALs in parallel. |
| 1269 | This is like `setq', except that all VAL forms are evaluated (in order) | 1293 | This is like `setq', except that all VAL forms are evaluated (in order) |
| @@ -1275,6 +1299,7 @@ before assigning any symbols SYM to the corresponding values. | |||
| 1275 | 1299 | ||
| 1276 | ;;; Binding control structures. | 1300 | ;;; Binding control structures. |
| 1277 | 1301 | ||
| 1302 | ;;;###autoload | ||
| 1278 | (defmacro progv (symbols values &rest body) | 1303 | (defmacro progv (symbols values &rest body) |
| 1279 | "Bind SYMBOLS to VALUES dynamically in BODY. | 1304 | "Bind SYMBOLS to VALUES dynamically in BODY. |
| 1280 | The forms SYMBOLS and VALUES are evaluated, and must evaluate to lists. | 1305 | The forms SYMBOLS and VALUES are evaluated, and must evaluate to lists. |
| @@ -1288,6 +1313,7 @@ a `let' form, except that the list of symbols can be computed at run-time." | |||
| 1288 | '(cl-progv-after)))) | 1313 | '(cl-progv-after)))) |
| 1289 | 1314 | ||
| 1290 | ;;; This should really have some way to shadow 'byte-compile properties, etc. | 1315 | ;;; This should really have some way to shadow 'byte-compile properties, etc. |
| 1316 | ;;;###autoload | ||
| 1291 | (defmacro flet (bindings &rest body) | 1317 | (defmacro flet (bindings &rest body) |
| 1292 | "Make temporary function definitions. | 1318 | "Make temporary function definitions. |
| 1293 | This is an analogue of `let' that operates on the function cell of FUNC | 1319 | This is an analogue of `let' that operates on the function cell of FUNC |
| @@ -1315,6 +1341,7 @@ go back to their previous definitions, or lack thereof). | |||
| 1315 | bindings) | 1341 | bindings) |
| 1316 | body)) | 1342 | body)) |
| 1317 | 1343 | ||
| 1344 | ;;;###autoload | ||
| 1318 | (defmacro labels (bindings &rest body) | 1345 | (defmacro labels (bindings &rest body) |
| 1319 | "Make temporary function bindings. | 1346 | "Make temporary function bindings. |
| 1320 | This is like `flet', except the bindings are lexical instead of dynamic. | 1347 | This is like `flet', except the bindings are lexical instead of dynamic. |
| @@ -1339,6 +1366,7 @@ Unlike `flet', this macro is fully compliant with the Common Lisp standard. | |||
| 1339 | 1366 | ||
| 1340 | ;; The following ought to have a better definition for use with newer | 1367 | ;; The following ought to have a better definition for use with newer |
| 1341 | ;; byte compilers. | 1368 | ;; byte compilers. |
| 1369 | ;;;###autoload | ||
| 1342 | (defmacro macrolet (bindings &rest body) | 1370 | (defmacro macrolet (bindings &rest body) |
| 1343 | "Make temporary macro definitions. | 1371 | "Make temporary macro definitions. |
| 1344 | This is like `flet', but for macros instead of functions. | 1372 | This is like `flet', but for macros instead of functions. |
| @@ -1355,6 +1383,7 @@ This is like `flet', but for macros instead of functions. | |||
| 1355 | (cons (list* name 'lambda (cdr res)) | 1383 | (cons (list* name 'lambda (cdr res)) |
| 1356 | cl-macro-environment)))))) | 1384 | cl-macro-environment)))))) |
| 1357 | 1385 | ||
| 1386 | ;;;###autoload | ||
| 1358 | (defmacro symbol-macrolet (bindings &rest body) | 1387 | (defmacro symbol-macrolet (bindings &rest body) |
| 1359 | "Make symbol macro definitions. | 1388 | "Make symbol macro definitions. |
| 1360 | Within the body FORMs, references to the variable NAME will be replaced | 1389 | Within the body FORMs, references to the variable NAME will be replaced |
| @@ -1371,6 +1400,7 @@ by EXPANSION, and (setq NAME ...) will act like (setf EXPANSION ...). | |||
| 1371 | cl-macro-environment))))) | 1400 | cl-macro-environment))))) |
| 1372 | 1401 | ||
| 1373 | (defvar cl-closure-vars nil) | 1402 | (defvar cl-closure-vars nil) |
| 1403 | ;;;###autoload | ||
| 1374 | (defmacro lexical-let (bindings &rest body) | 1404 | (defmacro lexical-let (bindings &rest body) |
| 1375 | "Like `let', but lexically scoped. | 1405 | "Like `let', but lexically scoped. |
| 1376 | The main visible difference is that lambdas inside BODY will create | 1406 | The main visible difference is that lambdas inside BODY will create |
| @@ -1414,6 +1444,7 @@ lexical closures as in Common Lisp. | |||
| 1414 | vars)) | 1444 | vars)) |
| 1415 | ebody)))) | 1445 | ebody)))) |
| 1416 | 1446 | ||
| 1447 | ;;;###autoload | ||
| 1417 | (defmacro lexical-let* (bindings &rest body) | 1448 | (defmacro lexical-let* (bindings &rest body) |
| 1418 | "Like `let*', but lexically scoped. | 1449 | "Like `let*', but lexically scoped. |
| 1419 | The main visible difference is that lambdas inside BODY will create | 1450 | The main visible difference is that lambdas inside BODY will create |
| @@ -1434,6 +1465,7 @@ lexical closures as in Common Lisp. | |||
| 1434 | 1465 | ||
| 1435 | ;;; Multiple values. | 1466 | ;;; Multiple values. |
| 1436 | 1467 | ||
| 1468 | ;;;###autoload | ||
| 1437 | (defmacro multiple-value-bind (vars form &rest body) | 1469 | (defmacro multiple-value-bind (vars form &rest body) |
| 1438 | "Collect multiple return values. | 1470 | "Collect multiple return values. |
| 1439 | FORM must return a list; the BODY is then executed with the first N elements | 1471 | FORM must return a list; the BODY is then executed with the first N elements |
| @@ -1451,6 +1483,7 @@ a synonym for (list A B C). | |||
| 1451 | vars)) | 1483 | vars)) |
| 1452 | body))) | 1484 | body))) |
| 1453 | 1485 | ||
| 1486 | ;;;###autoload | ||
| 1454 | (defmacro multiple-value-setq (vars form) | 1487 | (defmacro multiple-value-setq (vars form) |
| 1455 | "Collect multiple return values. | 1488 | "Collect multiple return values. |
| 1456 | FORM must return a list; the first N elements of this list are stored in | 1489 | FORM must return a list; the first N elements of this list are stored in |
| @@ -1477,7 +1510,9 @@ values. For compatibility, (values A B C) is a synonym for (list A B C). | |||
| 1477 | 1510 | ||
| 1478 | ;;; Declarations. | 1511 | ;;; Declarations. |
| 1479 | 1512 | ||
| 1513 | ;;;###autoload | ||
| 1480 | (defmacro locally (&rest body) (cons 'progn body)) | 1514 | (defmacro locally (&rest body) (cons 'progn body)) |
| 1515 | ;;;###autoload | ||
| 1481 | (defmacro the (type form) form) | 1516 | (defmacro the (type form) form) |
| 1482 | 1517 | ||
| 1483 | (defvar cl-proclaim-history t) ; for future compilers | 1518 | (defvar cl-proclaim-history t) ; for future compilers |
| @@ -1532,6 +1567,7 @@ values. For compatibility, (values A B C) is a synonym for (list A B C). | |||
| 1532 | (while p (cl-do-proclaim (pop p) t)) | 1567 | (while p (cl-do-proclaim (pop p) t)) |
| 1533 | (setq cl-proclaims-deferred nil)) | 1568 | (setq cl-proclaims-deferred nil)) |
| 1534 | 1569 | ||
| 1570 | ;;;###autoload | ||
| 1535 | (defmacro declare (&rest specs) | 1571 | (defmacro declare (&rest specs) |
| 1536 | (if (cl-compiling-file) | 1572 | (if (cl-compiling-file) |
| 1537 | (while specs | 1573 | (while specs |
| @@ -1543,6 +1579,7 @@ values. For compatibility, (values A B C) is a synonym for (list A B C). | |||
| 1543 | 1579 | ||
| 1544 | ;;; Generalized variables. | 1580 | ;;; Generalized variables. |
| 1545 | 1581 | ||
| 1582 | ;;;###autoload | ||
| 1546 | (defmacro define-setf-method (func args &rest body) | 1583 | (defmacro define-setf-method (func args &rest body) |
| 1547 | "Define a `setf' method. | 1584 | "Define a `setf' method. |
| 1548 | This method shows how to handle `setf's to places of the form (NAME ARGS...). | 1585 | This method shows how to handle `setf's to places of the form (NAME ARGS...). |
| @@ -1561,6 +1598,7 @@ form. See `defsetf' for a simpler way to define most setf-methods. | |||
| 1561 | func 'setf-method (cons args body))))) | 1598 | func 'setf-method (cons args body))))) |
| 1562 | (defalias 'define-setf-expander 'define-setf-method) | 1599 | (defalias 'define-setf-expander 'define-setf-method) |
| 1563 | 1600 | ||
| 1601 | ;;;###autoload | ||
| 1564 | (defmacro defsetf (func arg1 &rest args) | 1602 | (defmacro defsetf (func arg1 &rest args) |
| 1565 | "(defsetf NAME FUNC): define a `setf' method. | 1603 | "(defsetf NAME FUNC): define a `setf' method. |
| 1566 | This macro is an easy-to-use substitute for `define-setf-method' that works | 1604 | This macro is an easy-to-use substitute for `define-setf-method' that works |
| @@ -1836,6 +1874,7 @@ Example: | |||
| 1836 | (list 'substring (nth 4 method) from-temp to-temp)))) | 1874 | (list 'substring (nth 4 method) from-temp to-temp)))) |
| 1837 | 1875 | ||
| 1838 | ;;; Getting and optimizing setf-methods. | 1876 | ;;; Getting and optimizing setf-methods. |
| 1877 | ;;;###autoload | ||
| 1839 | (defun get-setf-method (place &optional env) | 1878 | (defun get-setf-method (place &optional env) |
| 1840 | "Return a list of five values describing the setf-method for PLACE. | 1879 | "Return a list of five values describing the setf-method for PLACE. |
| 1841 | PLACE may be any Lisp form which can appear as the PLACE argument to | 1880 | PLACE may be any Lisp form which can appear as the PLACE argument to |
| @@ -1903,6 +1942,7 @@ a macro like `setf' or `incf'." | |||
| 1903 | (not (eq (car-safe (symbol-function (car form))) 'macro)))) | 1942 | (not (eq (car-safe (symbol-function (car form))) 'macro)))) |
| 1904 | 1943 | ||
| 1905 | ;;; The standard modify macros. | 1944 | ;;; The standard modify macros. |
| 1945 | ;;;###autoload | ||
| 1906 | (defmacro setf (&rest args) | 1946 | (defmacro setf (&rest args) |
| 1907 | "Set each PLACE to the value of its VAL. | 1947 | "Set each PLACE to the value of its VAL. |
| 1908 | This is a generalized version of `setq'; the PLACEs may be symbolic | 1948 | This is a generalized version of `setq'; the PLACEs may be symbolic |
| @@ -1921,6 +1961,7 @@ The return value is the last VAL in the list. | |||
| 1921 | (store (cl-setf-do-store (nth 1 method) (nth 1 args)))) | 1961 | (store (cl-setf-do-store (nth 1 method) (nth 1 args)))) |
| 1922 | (if (car method) (list 'let* (car method) store) store))))) | 1962 | (if (car method) (list 'let* (car method) store) store))))) |
| 1923 | 1963 | ||
| 1964 | ;;;###autoload | ||
| 1924 | (defmacro psetf (&rest args) | 1965 | (defmacro psetf (&rest args) |
| 1925 | "Set PLACEs to the values VALs in parallel. | 1966 | "Set PLACEs to the values VALs in parallel. |
| 1926 | This is like `setf', except that all VAL forms are evaluated (in order) | 1967 | This is like `setf', except that all VAL forms are evaluated (in order) |
| @@ -1944,6 +1985,7 @@ before assigning any PLACEs to the corresponding values. | |||
| 1944 | (setq expr (list 'setf (cadr args) (list 'prog1 (car args) expr)))) | 1985 | (setq expr (list 'setf (cadr args) (list 'prog1 (car args) expr)))) |
| 1945 | (list 'progn expr nil))))) | 1986 | (list 'progn expr nil))))) |
| 1946 | 1987 | ||
| 1988 | ;;;###autoload | ||
| 1947 | (defun cl-do-pop (place) | 1989 | (defun cl-do-pop (place) |
| 1948 | (if (cl-simple-expr-p place) | 1990 | (if (cl-simple-expr-p place) |
| 1949 | (list 'prog1 (list 'car place) (list 'setf place (list 'cdr place))) | 1991 | (list 'prog1 (list 'car place) (list 'setf place (list 'cdr place))) |
| @@ -1956,6 +1998,7 @@ before assigning any PLACEs to the corresponding values. | |||
| 1956 | (list 'car temp) | 1998 | (list 'car temp) |
| 1957 | (cl-setf-do-store (nth 1 method) (list 'cdr temp))))))) | 1999 | (cl-setf-do-store (nth 1 method) (list 'cdr temp))))))) |
| 1958 | 2000 | ||
| 2001 | ;;;###autoload | ||
| 1959 | (defmacro remf (place tag) | 2002 | (defmacro remf (place tag) |
| 1960 | "Remove TAG from property list PLACE. | 2003 | "Remove TAG from property list PLACE. |
| 1961 | PLACE may be a symbol, or any generalized variable allowed by `setf'. | 2004 | PLACE may be a symbol, or any generalized variable allowed by `setf'. |
| @@ -1976,6 +2019,7 @@ The form returns true if TAG was found and removed, nil otherwise." | |||
| 1976 | t) | 2019 | t) |
| 1977 | (list 'cl-do-remf tval ttag))))) | 2020 | (list 'cl-do-remf tval ttag))))) |
| 1978 | 2021 | ||
| 2022 | ;;;###autoload | ||
| 1979 | (defmacro shiftf (place &rest args) | 2023 | (defmacro shiftf (place &rest args) |
| 1980 | "Shift left among PLACEs. | 2024 | "Shift left among PLACEs. |
| 1981 | Example: (shiftf A B C) sets A to B, B to C, and returns the old A. | 2025 | Example: (shiftf A B C) sets A to B, B to C, and returns the old A. |
| @@ -1991,6 +2035,7 @@ Each PLACE may be a symbol, or any generalized variable allowed by `setf'. | |||
| 1991 | (prog1 ,(nth 2 method) | 2035 | (prog1 ,(nth 2 method) |
| 1992 | ,(cl-setf-do-store (nth 1 method) `(shiftf ,@args)))))))) | 2036 | ,(cl-setf-do-store (nth 1 method) `(shiftf ,@args)))))))) |
| 1993 | 2037 | ||
| 2038 | ;;;###autoload | ||
| 1994 | (defmacro rotatef (&rest args) | 2039 | (defmacro rotatef (&rest args) |
| 1995 | "Rotate left among PLACEs. | 2040 | "Rotate left among PLACEs. |
| 1996 | Example: (rotatef A B C) sets A to B, B to C, and C to A. It returns nil. | 2041 | Example: (rotatef A B C) sets A to B, B to C, and C to A. It returns nil. |
| @@ -2016,6 +2061,7 @@ Each PLACE may be a symbol, or any generalized variable allowed by `setf'. | |||
| 2016 | (list 'let* (append (car method) (list (list temp (nth 2 method)))) | 2061 | (list 'let* (append (car method) (list (list temp (nth 2 method)))) |
| 2017 | (cl-setf-do-store (nth 1 method) form) nil))))) | 2062 | (cl-setf-do-store (nth 1 method) form) nil))))) |
| 2018 | 2063 | ||
| 2064 | ;;;###autoload | ||
| 2019 | (defmacro letf (bindings &rest body) | 2065 | (defmacro letf (bindings &rest body) |
| 2020 | "Temporarily bind to PLACEs. | 2066 | "Temporarily bind to PLACEs. |
| 2021 | This is the analogue of `let', but with generalized variables (in the | 2067 | This is the analogue of `let', but with generalized variables (in the |
| @@ -2072,6 +2118,7 @@ the PLACE is not modified before executing BODY. | |||
| 2072 | rev (cdr rev)))) | 2118 | rev (cdr rev)))) |
| 2073 | (list* 'let* lets body)))) | 2119 | (list* 'let* lets body)))) |
| 2074 | 2120 | ||
| 2121 | ;;;###autoload | ||
| 2075 | (defmacro letf* (bindings &rest body) | 2122 | (defmacro letf* (bindings &rest body) |
| 2076 | "Temporarily bind to PLACEs. | 2123 | "Temporarily bind to PLACEs. |
| 2077 | This is the analogue of `let*', but with generalized variables (in the | 2124 | This is the analogue of `let*', but with generalized variables (in the |
| @@ -2090,6 +2137,7 @@ the PLACE is not modified before executing BODY. | |||
| 2090 | (setq body (list (list* 'letf (list (pop bindings)) body)))) | 2137 | (setq body (list (list* 'letf (list (pop bindings)) body)))) |
| 2091 | (car body))) | 2138 | (car body))) |
| 2092 | 2139 | ||
| 2140 | ;;;###autoload | ||
| 2093 | (defmacro callf (func place &rest args) | 2141 | (defmacro callf (func place &rest args) |
| 2094 | "Set PLACE to (FUNC PLACE ARGS...). | 2142 | "Set PLACE to (FUNC PLACE ARGS...). |
| 2095 | FUNC should be an unquoted function name. PLACE may be a symbol, | 2143 | FUNC should be an unquoted function name. PLACE may be a symbol, |
| @@ -2104,6 +2152,7 @@ or any generalized variable allowed by `setf'. | |||
| 2104 | (list* 'funcall (list 'function func) | 2152 | (list* 'funcall (list 'function func) |
| 2105 | rargs)))))) | 2153 | rargs)))))) |
| 2106 | 2154 | ||
| 2155 | ;;;###autoload | ||
| 2107 | (defmacro callf2 (func arg1 place &rest args) | 2156 | (defmacro callf2 (func arg1 place &rest args) |
| 2108 | "Set PLACE to (FUNC ARG1 PLACE ARGS...). | 2157 | "Set PLACE to (FUNC ARG1 PLACE ARGS...). |
| 2109 | Like `callf', but PLACE is the second argument of FUNC, not the first. | 2158 | Like `callf', but PLACE is the second argument of FUNC, not the first. |
| @@ -2120,6 +2169,7 @@ Like `callf', but PLACE is the second argument of FUNC, not the first. | |||
| 2120 | (list* 'funcall (list 'function func) | 2169 | (list* 'funcall (list 'function func) |
| 2121 | rargs))))))) | 2170 | rargs))))))) |
| 2122 | 2171 | ||
| 2172 | ;;;###autoload | ||
| 2123 | (defmacro define-modify-macro (name arglist func &optional doc) | 2173 | (defmacro define-modify-macro (name arglist func &optional doc) |
| 2124 | "Define a `setf'-like modify macro. | 2174 | "Define a `setf'-like modify macro. |
| 2125 | If NAME is called, it combines its PLACE argument with the other arguments | 2175 | If NAME is called, it combines its PLACE argument with the other arguments |
| @@ -2134,6 +2184,7 @@ from ARGLIST using FUNC: (define-modify-macro incf (&optional (n 1)) +)" | |||
| 2134 | 2184 | ||
| 2135 | ;;; Structures. | 2185 | ;;; Structures. |
| 2136 | 2186 | ||
| 2187 | ;;;###autoload | ||
| 2137 | (defmacro defstruct (struct &rest descs) | 2188 | (defmacro defstruct (struct &rest descs) |
| 2138 | "Define a struct type. | 2189 | "Define a struct type. |
| 2139 | This macro defines a new Lisp data type called NAME, which contains data | 2190 | This macro defines a new Lisp data type called NAME, which contains data |
| @@ -2358,6 +2409,7 @@ copier, a `NAME-p' predicate, and setf-able `NAME-SLOT' accessors. | |||
| 2358 | forms) | 2409 | forms) |
| 2359 | (cons 'progn (nreverse (cons (list 'quote name) forms))))) | 2410 | (cons 'progn (nreverse (cons (list 'quote name) forms))))) |
| 2360 | 2411 | ||
| 2412 | ;;;###autoload | ||
| 2361 | (defun cl-struct-setf-expander (x name accessor pred-form pos) | 2413 | (defun cl-struct-setf-expander (x name accessor pred-form pos) |
| 2362 | (let* ((temp (make-symbol "--cl-x--")) (store (make-symbol "--cl-store--"))) | 2414 | (let* ((temp (make-symbol "--cl-x--")) (store (make-symbol "--cl-store--"))) |
| 2363 | (list (list temp) (list x) (list store) | 2415 | (list (list temp) (list x) (list store) |
| @@ -2426,11 +2478,13 @@ The type name can then be used in `typecase', `check-type', etc." | |||
| 2426 | ((eq (car type) 'satisfies) (list (cadr type) val)) | 2478 | ((eq (car type) 'satisfies) (list (cadr type) val)) |
| 2427 | (t (error "Bad type spec: %s" type))))) | 2479 | (t (error "Bad type spec: %s" type))))) |
| 2428 | 2480 | ||
| 2481 | ;;;###autoload | ||
| 2429 | (defun typep (object type) ; See compiler macro below. | 2482 | (defun typep (object type) ; See compiler macro below. |
| 2430 | "Check that OBJECT is of type TYPE. | 2483 | "Check that OBJECT is of type TYPE. |
| 2431 | TYPE is a Common Lisp-style type specifier." | 2484 | TYPE is a Common Lisp-style type specifier." |
| 2432 | (eval (cl-make-type-test 'object type))) | 2485 | (eval (cl-make-type-test 'object type))) |
| 2433 | 2486 | ||
| 2487 | ;;;###autoload | ||
| 2434 | (defmacro check-type (form type &optional string) | 2488 | (defmacro check-type (form type &optional string) |
| 2435 | "Verify that FORM is of type TYPE; signal an error if not. | 2489 | "Verify that FORM is of type TYPE; signal an error if not. |
| 2436 | STRING is an optional description of the desired type." | 2490 | STRING is an optional description of the desired type." |
| @@ -2445,6 +2499,7 @@ STRING is an optional description of the desired type." | |||
| 2445 | (if (eq temp form) (list 'progn body nil) | 2499 | (if (eq temp form) (list 'progn body nil) |
| 2446 | (list 'let (list (list temp form)) body nil))))) | 2500 | (list 'let (list (list temp form)) body nil))))) |
| 2447 | 2501 | ||
| 2502 | ;;;###autoload | ||
| 2448 | (defmacro assert (form &optional show-args string &rest args) | 2503 | (defmacro assert (form &optional show-args string &rest args) |
| 2449 | "Verify that FORM returns non-nil; signal an error if not. | 2504 | "Verify that FORM returns non-nil; signal an error if not. |
| 2450 | Second arg SHOW-ARGS means to include arguments of FORM in message. | 2505 | Second arg SHOW-ARGS means to include arguments of FORM in message. |
| @@ -2466,6 +2521,7 @@ omitted, a default message listing FORM itself is used." | |||
| 2466 | (list* 'list (list 'quote form) sargs)))) | 2521 | (list* 'list (list 'quote form) sargs)))) |
| 2467 | nil)))) | 2522 | nil)))) |
| 2468 | 2523 | ||
| 2524 | ;;;###autoload | ||
| 2469 | (defmacro ignore-errors (&rest body) | 2525 | (defmacro ignore-errors (&rest body) |
| 2470 | "Execute BODY; if an error occurs, return nil. | 2526 | "Execute BODY; if an error occurs, return nil. |
| 2471 | Otherwise, return result of last form in BODY." | 2527 | Otherwise, return result of last form in BODY." |
| @@ -2474,6 +2530,7 @@ Otherwise, return result of last form in BODY." | |||
| 2474 | 2530 | ||
| 2475 | ;;; Compiler macros. | 2531 | ;;; Compiler macros. |
| 2476 | 2532 | ||
| 2533 | ;;;###autoload | ||
| 2477 | (defmacro define-compiler-macro (func args &rest body) | 2534 | (defmacro define-compiler-macro (func args &rest body) |
| 2478 | "Define a compiler-only macro. | 2535 | "Define a compiler-only macro. |
| 2479 | This is like `defmacro', but macro expansion occurs only if the call to | 2536 | This is like `defmacro', but macro expansion occurs only if the call to |
| @@ -2497,6 +2554,7 @@ and then returning foo." | |||
| 2497 | (list 'put (list 'quote func) '(quote byte-compile) | 2554 | (list 'put (list 'quote func) '(quote byte-compile) |
| 2498 | '(quote cl-byte-compile-compiler-macro))))) | 2555 | '(quote cl-byte-compile-compiler-macro))))) |
| 2499 | 2556 | ||
| 2557 | ;;;###autoload | ||
| 2500 | (defun compiler-macroexpand (form) | 2558 | (defun compiler-macroexpand (form) |
| 2501 | (while | 2559 | (while |
| 2502 | (let ((func (car-safe form)) (handler nil)) | 2560 | (let ((func (car-safe form)) (handler nil)) |
| @@ -2665,9 +2723,10 @@ surrounded by (block NAME ...). | |||
| 2665 | 2723 | ||
| 2666 | (run-hooks 'cl-macs-load-hook) | 2724 | (run-hooks 'cl-macs-load-hook) |
| 2667 | 2725 | ||
| 2668 | ;;; Local variables: | 2726 | ;; Local variables: |
| 2669 | ;;; byte-compile-warnings: (redefine callargs free-vars unresolved obsolete noruntime) | 2727 | ;; byte-compile-warnings: (redefine callargs free-vars unresolved obsolete noruntime) |
| 2670 | ;;; End: | 2728 | ;; generated-autoload-file: "cl-loaddefs.el" |
| 2729 | ;; End: | ||
| 2671 | 2730 | ||
| 2672 | ;; arch-tag: afd947a6-b553-4df1-bba5-000be6388f46 | 2731 | ;; arch-tag: afd947a6-b553-4df1-bba5-000be6388f46 |
| 2673 | ;;; cl-macs.el ends here | 2732 | ;;; cl-macs.el ends here |