diff options
| author | Alan Mackenzie | 2024-06-11 09:38:53 +0000 |
|---|---|---|
| committer | Alan Mackenzie | 2024-06-11 09:38:53 +0000 |
| commit | eb89a6c44565ec67379c399eaae4ba8d33a06430 (patch) | |
| tree | 729a01da3337cc37739206833e685479954d765e | |
| parent | 7cc20b5d7f6e5e8d64bd23b72d4d10a80b3b83d2 (diff) | |
| download | emacs-feature/positioned-lambdas.tar.gz emacs-feature/positioned-lambdas.zip | |
Load backquote.el before byte-run.el.feature/positioned-lambdas
This is to allow the many functions with "hand expanded
backquotes" to use actual backquotes. Also make a few
miscellaneous amendments, particularly to the test suite.
* lisp/emacs-lisp/backquote.el (backquote-list*-function)
(backquote-list*-macro, backquote, backquote-delay-process)
(backquote-process, backquote-listify): Replace the declaring
`defun's and `defmacros' with defalias.
(Random places in the file): Replace `not' with `null', `push'
with `setq' and `cons', and `unless' with `if' and `null'.
* lisp/emacs-lisp/backtrace.el (backtrace--to-string): Use
cl-prin1 rather than prin1.
* lisp/emacs-lisp/byte-run.el (byte-run--posify-def-form):
Remove.
(byte-run--posify-list): No longer posify defining forms.
(byte-run-posify-all-lambdas-etc) Rename by removing the "-etc"
and no longer posify defining-forms.
(byte-run--set-advertised-calling-convention)
(byte-run--set-obsolete, byte-run--set-interactive-only)
(byte-run--set-pure, byte-run--set-side-effect-free)
(byte-run--set-important-return-value)
(byte-run--set-doc-string, byte-run--set-indent)
(byte-run--set-speed, byte-run--set-safety)
(byte-run--set-completion, byte-run--set-modes)
(byte-run--set-interactive-args)
(byte-run--posify-defining-form, byte-run--set-function-type)
(byte-run--set-debug, byte-run--set-no-font-lock-keyword)
(defmacro, defun, dont-compile, eval-when-compile)
(eval-and-compile): Recode using the backquote macro.
* lisp/emacs-lisp/cl-generic.el (cl-defmethod): Remove the
obtrusive car of the function which is the cdr of the return
value from the byte-run-defined-form property value of this
function.
* lisp/emacs-lisp/macroexp.el (macroexp--expand-all): In the
handling of quoted forms, no longer test
byte-compile-in-progress.
* lisp/loadup.el (top level) load backquote.el before
byte-run.el.
* test/lisp/emacs-lisp/backtrace-tests.el
(backtrace-tests--forward-frame)
* test/lisp/emacs-lisp/cconv-tests.el
(cconv-convert-lambda-lifted, cconv-closure-convert-remap-var)
(cconv-tests-interactive-form-modify-bug60974)
* test/lisp/erc/erc-tests.el (erc--with-dependent-type-match):
Use byte-run-strip-lambda-doc to prevent mismatches in
comparisons caused by the presence of position information in
doc strings.
| -rw-r--r-- | lisp/emacs-lisp/backquote.el | 55 | ||||
| -rw-r--r-- | lisp/emacs-lisp/backtrace.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/byte-run.el | 404 | ||||
| -rw-r--r-- | lisp/emacs-lisp/cl-generic.el | 2 | ||||
| -rw-r--r-- | lisp/emacs-lisp/macroexp.el | 7 | ||||
| -rw-r--r-- | lisp/loadup.el | 4 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/backtrace-tests.el | 14 | ||||
| -rw-r--r-- | test/lisp/emacs-lisp/cconv-tests.el | 144 | ||||
| -rw-r--r-- | test/lisp/erc/erc-tests.el | 11 |
9 files changed, 275 insertions, 368 deletions
diff --git a/lisp/emacs-lisp/backquote.el b/lisp/emacs-lisp/backquote.el index 6917128d70a..8db1f94132f 100644 --- a/lisp/emacs-lisp/backquote.el +++ b/lisp/emacs-lisp/backquote.el | |||
| @@ -40,7 +40,8 @@ | |||
| 40 | 40 | ||
| 41 | ;; function and macro versions of backquote-list* | 41 | ;; function and macro versions of backquote-list* |
| 42 | 42 | ||
| 43 | (defun backquote-list*-function (first &rest list) | 43 | (defalias 'backquote-list*-function |
| 44 | #'(lambda (first &rest list) | ||
| 44 | "Like `list' but the last argument is the tail of the new list. | 45 | "Like `list' but the last argument is the tail of the new list. |
| 45 | 46 | ||
| 46 | For example (backquote-list* \\='a \\='b \\='c) => (a b . c)" | 47 | For example (backquote-list* \\='a \\='b \\='c) => (a b . c)" |
| @@ -55,9 +56,11 @@ For example (backquote-list* \\='a \\='b \\='c) => (a b . c)" | |||
| 55 | rest (cdr rest))) | 56 | rest (cdr rest))) |
| 56 | (setcdr last (car rest)) | 57 | (setcdr last (car rest)) |
| 57 | newlist) | 58 | newlist) |
| 58 | first)) | 59 | first))) |
| 59 | 60 | ||
| 60 | (defmacro backquote-list*-macro (first &rest list) | 61 | (defalias 'backquote-list*-macro |
| 62 | (cons 'macro | ||
| 63 | #'(lambda (first &rest list) | ||
| 61 | "Like `list' but the last argument is the tail of the new list. | 64 | "Like `list' but the last argument is the tail of the new list. |
| 62 | 65 | ||
| 63 | For example (backquote-list* \\='a \\='b \\='c) => (a b . c)" | 66 | For example (backquote-list* \\='a \\='b \\='c) => (a b . c)" |
| @@ -75,7 +78,7 @@ For example (backquote-list* \\='a \\='b \\='c) => (a b . c)" | |||
| 75 | (setq newlist (list 'cons (car rest) newlist) | 78 | (setq newlist (list 'cons (car rest) newlist) |
| 76 | rest (cdr rest))) | 79 | rest (cdr rest))) |
| 77 | newlist) | 80 | newlist) |
| 78 | first)) | 81 | first)))) |
| 79 | 82 | ||
| 80 | (defalias 'backquote-list* (symbol-function 'backquote-list*-macro)) | 83 | (defalias 'backquote-list* (symbol-function 'backquote-list*-macro)) |
| 81 | 84 | ||
| @@ -90,8 +93,10 @@ For example (backquote-list* \\='a \\='b \\='c) => (a b . c)" | |||
| 90 | (defconst backquote-splice-symbol '\,@ | 93 | (defconst backquote-splice-symbol '\,@ |
| 91 | "Symbol used to represent a splice inside a backquote.") | 94 | "Symbol used to represent a splice inside a backquote.") |
| 92 | 95 | ||
| 93 | (defmacro backquote (structure) | 96 | (defalias 'backquote |
| 94 | "Argument STRUCTURE describes a template to build. | 97 | (cons 'macro |
| 98 | #'(lambda (structure) | ||
| 99 | "Argument STRUCTURE describes a template to build. | ||
| 95 | 100 | ||
| 96 | The whole structure acts as if it were quoted except for certain | 101 | The whole structure acts as if it were quoted except for certain |
| 97 | places where expressions are evaluated and inserted or spliced in. | 102 | places where expressions are evaluated and inserted or spliced in. |
| @@ -107,7 +112,7 @@ Vectors work just like lists. Nested backquotes are permitted. | |||
| 107 | 112 | ||
| 108 | Note that some macros, such as `pcase', use this symbol for other | 113 | Note that some macros, such as `pcase', use this symbol for other |
| 109 | purposes." | 114 | purposes." |
| 110 | (cdr (backquote-process structure))) | 115 | (cdr (backquote-process structure))))) |
| 111 | 116 | ||
| 112 | ;; GNU Emacs has no reader macros | 117 | ;; GNU Emacs has no reader macros |
| 113 | 118 | ||
| @@ -118,29 +123,31 @@ purposes." | |||
| 118 | ;; constant, 1 => to be unquoted, 2 => to be spliced in. | 123 | ;; constant, 1 => to be unquoted, 2 => to be spliced in. |
| 119 | ;; The top-level backquote macro just discards the tag. | 124 | ;; The top-level backquote macro just discards the tag. |
| 120 | 125 | ||
| 121 | (defun backquote-delay-process (s level) | 126 | (defalias 'backquote-delay-process |
| 127 | #'(lambda (s level) | ||
| 122 | "Process a (un|back|splice)quote inside a backquote. | 128 | "Process a (un|back|splice)quote inside a backquote. |
| 123 | This simply recurses through the body." | 129 | This simply recurses through the body." |
| 124 | (let ((exp (backquote-listify (list (cons 0 (list 'quote (car s)))) | 130 | (let ((exp (backquote-listify (list (cons 0 (list 'quote (car s)))) |
| 125 | (backquote-process (cdr s) level)))) | 131 | (backquote-process (cdr s) level)))) |
| 126 | (cons (if (eq (car-safe exp) 'quote) 0 1) exp))) | 132 | (cons (if (eq (car-safe exp) 'quote) 0 1) exp)))) |
| 127 | 133 | ||
| 128 | (defun backquote-process (s &optional level) | 134 | (defalias 'backquote-process |
| 129 | "Process the body of a backquote. | 135 | #'(lambda (s &optional level) |
| 136 | "Process the body of a backquote. | ||
| 130 | S is the body. Returns a cons cell whose cdr is piece of code which | 137 | S is the body. Returns a cons cell whose cdr is piece of code which |
| 131 | is the macro-expansion of S, and whose car is a small integer whose value | 138 | is the macro-expansion of S, and whose car is a small integer whose value |
| 132 | can either indicate that the code is constant (0), or not (1), or returns | 139 | can either indicate that the code is constant (0), or not (1), or returns |
| 133 | a list which should be spliced into its environment (2). | 140 | a list which should be spliced into its environment (2). |
| 134 | LEVEL is only used internally and indicates the nesting level: | 141 | LEVEL is only used internally and indicates the nesting level: |
| 135 | 0 (the default) is for the toplevel nested inside a single backquote." | 142 | 0 (the default) is for the toplevel nested inside a single backquote." |
| 136 | (unless level (setq level 0)) | 143 | (if (null level) (setq level 0)) |
| 137 | (cond | 144 | (cond |
| 138 | ((vectorp s) | 145 | ((vectorp s) |
| 139 | (let ((n (backquote-process (append s ()) level))) | 146 | (let ((n (backquote-process (append s ()) level))) |
| 140 | (if (= (car n) 0) | 147 | (if (= (car n) 0) |
| 141 | (cons 0 s) | 148 | (cons 0 s) |
| 142 | (cons 1 (cond | 149 | (cons 1 (cond |
| 143 | ((not (listp (cdr n))) | 150 | ((null (listp (cdr n))) |
| 144 | (list 'vconcat (cdr n))) | 151 | (list 'vconcat (cdr n))) |
| 145 | ((eq (nth 1 n) 'list) | 152 | ((eq (nth 1 n) 'list) |
| 146 | (cons 'vector (nthcdr 2 n))) | 153 | (cons 'vector (nthcdr 2 n))) |
| @@ -150,7 +157,7 @@ LEVEL is only used internally and indicates the nesting level: | |||
| 150 | (list 'apply '(function vector) (cdr n)))))))) | 157 | (list 'apply '(function vector) (cdr n)))))))) |
| 151 | ((atom s) | 158 | ((atom s) |
| 152 | ;; FIXME: Use macroexp-quote! | 159 | ;; FIXME: Use macroexp-quote! |
| 153 | (cons 0 (if (or (null s) (eq s t) (not (symbolp s))) | 160 | (cons 0 (if (or (null s) (eq s t) (null (symbolp s))) |
| 154 | s | 161 | s |
| 155 | (list 'quote s)))) | 162 | (list 'quote s)))) |
| 156 | ((eq (car s) backquote-unquote-symbol) | 163 | ((eq (car s) backquote-unquote-symbol) |
| @@ -187,8 +194,8 @@ LEVEL is only used internally and indicates the nesting level: | |||
| 187 | ;; Stop if the cdr is an expression inside a backquote or | 194 | ;; Stop if the cdr is an expression inside a backquote or |
| 188 | ;; unquote since this needs to go recursively through | 195 | ;; unquote since this needs to go recursively through |
| 189 | ;; backquote-process. | 196 | ;; backquote-process. |
| 190 | (not (or (eq (car rest) backquote-unquote-symbol) | 197 | (null (or (eq (car rest) backquote-unquote-symbol) |
| 191 | (eq (car rest) backquote-backquote-symbol)))) | 198 | (eq (car rest) backquote-backquote-symbol)))) |
| 192 | (setq item (backquote-process (car rest) level)) | 199 | (setq item (backquote-process (car rest) level)) |
| 193 | (cond | 200 | (cond |
| 194 | ((= (car item) 2) | 201 | ((= (car item) 2) |
| @@ -199,8 +206,8 @@ LEVEL is only used internally and indicates the nesting level: | |||
| 199 | list nil)) | 206 | list nil)) |
| 200 | ;; Otherwise, put any preceding nonspliced items into LISTS. | 207 | ;; Otherwise, put any preceding nonspliced items into LISTS. |
| 201 | (if list | 208 | (if list |
| 202 | (push (backquote-listify list '(0 . nil)) lists)) | 209 | (setq lists (cons (backquote-listify list '(0 . nil)) lists))) |
| 203 | (push (cdr item) lists) | 210 | (setq lists (cons (cdr item) lists)) |
| 204 | (setq list nil)) | 211 | (setq list nil)) |
| 205 | (t | 212 | (t |
| 206 | (setq list (cons item list)))) | 213 | (setq list (cons item list)))) |
| @@ -208,8 +215,9 @@ LEVEL is only used internally and indicates the nesting level: | |||
| 208 | ;; Handle nonsplicing final elements, and the tail of the list | 215 | ;; Handle nonsplicing final elements, and the tail of the list |
| 209 | ;; (which remains in REST). | 216 | ;; (which remains in REST). |
| 210 | (if (or rest list) | 217 | (if (or rest list) |
| 211 | (push (backquote-listify list (backquote-process rest level)) | 218 | (setq lists |
| 212 | lists)) | 219 | (cons (backquote-listify list (backquote-process rest level)) |
| 220 | lists))) | ||
| 213 | ;; Turn LISTS into a form that produces the combined list. | 221 | ;; Turn LISTS into a form that produces the combined list. |
| 214 | (setq expression | 222 | (setq expression |
| 215 | (if (or (cdr lists) | 223 | (if (or (cdr lists) |
| @@ -219,13 +227,14 @@ LEVEL is only used internally and indicates the nesting level: | |||
| 219 | ;; Tack on any initial elements. | 227 | ;; Tack on any initial elements. |
| 220 | (if firstlist | 228 | (if firstlist |
| 221 | (setq expression (backquote-listify firstlist (cons 1 expression)))) | 229 | (setq expression (backquote-listify firstlist (cons 1 expression)))) |
| 222 | (cons (if (eq (car-safe expression) 'quote) 0 1) expression))))) | 230 | (cons (if (eq (car-safe expression) 'quote) 0 1) expression)))))) |
| 223 | 231 | ||
| 224 | ;; backquote-listify takes (tag . structure) pairs from backquote-process | 232 | ;; backquote-listify takes (tag . structure) pairs from backquote-process |
| 225 | ;; and decides between append, list, backquote-list*, and cons depending | 233 | ;; and decides between append, list, backquote-list*, and cons depending |
| 226 | ;; on which tags are in the list. | 234 | ;; on which tags are in the list. |
| 227 | 235 | ||
| 228 | (defun backquote-listify (list old-tail) | 236 | (defalias 'backquote-listify |
| 237 | #'(lambda (list old-tail) | ||
| 229 | (let ((heads nil) (tail (cdr old-tail)) (list-tail list) (item nil)) | 238 | (let ((heads nil) (tail (cdr old-tail)) (list-tail list) (item nil)) |
| 230 | (if (= (car old-tail) 0) | 239 | (if (= (car old-tail) 0) |
| 231 | (setq tail (eval tail) | 240 | (setq tail (eval tail) |
| @@ -248,7 +257,7 @@ LEVEL is only used internally and indicates the nesting level: | |||
| 248 | (cons (if use-list* 'backquote-list* 'cons) | 257 | (cons (if use-list* 'backquote-list* 'cons) |
| 249 | (append heads (list tail)))) | 258 | (append heads (list tail)))) |
| 250 | tail)) | 259 | tail)) |
| 251 | (t (cons 'list heads))))) | 260 | (t (cons 'list heads)))))) |
| 252 | 261 | ||
| 253 | 262 | ||
| 254 | ;; Give `,' and `,@' documentation strings which can be examined by C-h f. | 263 | ;; Give `,' and `,@' documentation strings which can be examined by C-h f. |
diff --git a/lisp/emacs-lisp/backtrace.el b/lisp/emacs-lisp/backtrace.el index 04b64e7916b..065869c9b87 100644 --- a/lisp/emacs-lisp/backtrace.el +++ b/lisp/emacs-lisp/backtrace.el | |||
| @@ -908,7 +908,7 @@ function calls currently active." | |||
| 908 | (backtrace-mode) | 908 | (backtrace-mode) |
| 909 | (setq backtrace-view '(:show-flags t) | 909 | (setq backtrace-view '(:show-flags t) |
| 910 | backtrace-frames frames | 910 | backtrace-frames frames |
| 911 | backtrace-print-function #'prin1;; #'cl-prin1 STOUGH, 2024-02-12 | 911 | backtrace-print-function #'cl-prin1 |
| 912 | ) | 912 | ) |
| 913 | (backtrace-print) | 913 | (backtrace-print) |
| 914 | (filter-buffer-substring (point-min) (point-max))))) | 914 | (filter-buffer-substring (point-min) (point-max))))) |
diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index a98bb7e22af..a7bf067e9d3 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el | |||
| @@ -293,67 +293,9 @@ The original FORM is not changed. Return a changed copy of FORM, or FORM." | |||
| 293 | (if changed new form)) | 293 | (if changed new form)) |
| 294 | form))) | 294 | form))) |
| 295 | 295 | ||
| 296 | (defalias 'byte-run--posify-def-form | ||
| 297 | #'(lambda (form) | ||
| 298 | "Posify FORM, a defining form. | ||
| 299 | A defining form is one whose function has a `byte-run-defined-form' | ||
| 300 | property. Examples are `defun', `cl-defmethod'." | ||
| 301 | (let* ((df (get (car form) 'byte-run-defined-form)) | ||
| 302 | (mth (car df)) | ||
| 303 | (nth (and (integerp mth) (if (> mth 0) mth (- mth)))) | ||
| 304 | (posifier (cdr df)) | ||
| 305 | defining-symbol ; Bound for `byte-run-posify-doc-string'. | ||
| 306 | old-ds new-ds new-obj | ||
| 307 | (obj | ||
| 308 | (and nth | ||
| 309 | (condition-case nil | ||
| 310 | (nth nth form) | ||
| 311 | (wrong-type-argument nil) | ||
| 312 | (t nil))))) | ||
| 313 | (if obj | ||
| 314 | (progn | ||
| 315 | (setq new-obj | ||
| 316 | (if (> mth 0) | ||
| 317 | (if (symbol-with-pos-p obj) | ||
| 318 | (progn (setq defining-symbol obj) | ||
| 319 | (bare-symbol obj)) | ||
| 320 | obj) | ||
| 321 | (if (and (eq (car-safe obj) 'quote) | ||
| 322 | (symbol-with-pos-p (car-safe (cdr obj)))) | ||
| 323 | (progn (setq defining-symbol (car (cdr obj))) | ||
| 324 | (list 'quote (bare-symbol (car (cdr obj))))) | ||
| 325 | obj))) | ||
| 326 | (if (let (symbols-with-pos-enabled) | ||
| 327 | (null (eq new-obj obj))) | ||
| 328 | (progn | ||
| 329 | (if (functionp posifier) | ||
| 330 | (progn | ||
| 331 | (setq posifier (funcall posifier form)))) | ||
| 332 | (let ((flat-posifier | ||
| 333 | (if (integerp posifier) | ||
| 334 | posifier | ||
| 335 | ;; At this stage the &rest arguments won't have been | ||
| 336 | ;; gathered into a single list, hence we must treat | ||
| 337 | ;; them as individual arguments. | ||
| 338 | (+ (car posifier) (cdr posifier))))) | ||
| 339 | (setq old-ds (nth flat-posifier form)) | ||
| 340 | (setq new-ds | ||
| 341 | (byte-run-posify-doc-string (and (stringp old-ds) old-ds))) | ||
| 342 | (append (take nth form) | ||
| 343 | (list new-obj) | ||
| 344 | (take (- flat-posifier (1+ nth)) | ||
| 345 | (nthcdr (1+ nth) form)) | ||
| 346 | (list new-ds) | ||
| 347 | (nthcdr (if (stringp old-ds) | ||
| 348 | (1+ flat-posifier) | ||
| 349 | flat-posifier) | ||
| 350 | form)))) | ||
| 351 | form)) | ||
| 352 | form)))) | ||
| 353 | |||
| 354 | (defalias 'byte-run--posify-list | 296 | (defalias 'byte-run--posify-list |
| 355 | #'(lambda (form) | 297 | #'(lambda (form) |
| 356 | "Posify any lambda or defining forms still unposified in the list FORM. | 298 | "Posify any lambda forms still unposified in the list FORM. |
| 357 | This original FORM is not changed. Return a changed copy of FORM or FORM." | 299 | This original FORM is not changed. Return a changed copy of FORM or FORM." |
| 358 | (let ((a form) | 300 | (let ((a form) |
| 359 | changed elt new) | 301 | changed elt new) |
| @@ -367,7 +309,7 @@ This original FORM is not changed. Return a changed copy of FORM or FORM." | |||
| 367 | (eq (bare-symbol (car a)) 'lambda)) | 309 | (eq (bare-symbol (car a)) 'lambda)) |
| 368 | (if (and | 310 | (if (and |
| 369 | (cdr-safe a) | 311 | (cdr-safe a) |
| 370 | (listp (car-safe (cdr a)))) ; valid param list. | 312 | (consp (car-safe (cdr a)))) ; valid param list. |
| 371 | (let ((stripped | 313 | (let ((stripped |
| 372 | (byte-run-posify-lambda-form | 314 | (byte-run-posify-lambda-form |
| 373 | a (symbol-with-pos-pos (car a)) | 315 | a (symbol-with-pos-pos (car a)) |
| @@ -377,21 +319,14 @@ This original FORM is not changed. Return a changed copy of FORM or FORM." | |||
| 377 | a (cdr a)) | 319 | a (cdr a)) |
| 378 | (setq new (cons (car a) new) ; param list. | 320 | (setq new (cons (car a) new) ; param list. |
| 379 | a (cdr a)) | 321 | a (cdr a)) |
| 380 | (setq new (cons (car a) new) ; doc string. | 322 | ;; Leave the doc string as the car of A to be accumulated |
| 381 | a (cdr a)) | 323 | ;; into NEW below. |
| 324 | ;; (setq new (cons (car a) new) ; doc string. | ||
| 325 | ;; a (cdr a)) | ||
| 382 | (setq changed t)) | 326 | (setq changed t)) |
| 383 | (byte-run-pull-lambda-source (car a)) | 327 | (byte-run-pull-lambda-source (car a)) |
| 384 | (setq new (cons 'lambda new) | 328 | (setq a (cons 'lambda (cdr a)) |
| 385 | a (cdr a)))) | 329 | changed t))) |
| 386 | |||
| 387 | ;; Do we need to posify a defining form? | ||
| 388 | (if (and (symbolp (car a)) | ||
| 389 | (get (car a) 'byte-run-defined-form)) | ||
| 390 | (let ((stripped (byte-run--posify-def-form a))) | ||
| 391 | (if (null (eq stripped a)) | ||
| 392 | (progn | ||
| 393 | (setq a stripped) | ||
| 394 | (setq changed t))))) | ||
| 395 | 330 | ||
| 396 | ;; Accumulate an element. | 331 | ;; Accumulate an element. |
| 397 | (if (consp a) | 332 | (if (consp a) |
| @@ -431,14 +366,13 @@ This original FORM is not changed. Return a changed copy of FORM or FORM." | |||
| 431 | rev) | 366 | rev) |
| 432 | form)))) | 367 | form)))) |
| 433 | 368 | ||
| 434 | (defalias 'byte-run-posify-all-lambdas-etc | 369 | (defalias 'byte-run-posify-all-lambdas |
| 435 | #'(lambda (form) | 370 | #'(lambda (form) |
| 436 | "Posify any lambda forms still unposified in FORM. | 371 | "Posify any lambda forms still unposified in FORM. |
| 437 | Also strip the positions of any `lambda' which doesn't open a form. | ||
| 438 | 372 | ||
| 439 | FORM is any Lisp object, but is usually a list or a vector or a | 373 | FORM is any Lisp object, but is usually a list or a vector or a record, |
| 440 | record, containing symbols with position. Return FORM, possibly | 374 | containing symbols with position. Return a modified copy of FORM, or |
| 441 | destructively modified." | 375 | FORM." |
| 442 | (setq byte-run--ssp-seen (make-hash-table :test 'eq)) | 376 | (setq byte-run--ssp-seen (make-hash-table :test 'eq)) |
| 443 | (cond | 377 | (cond |
| 444 | ((consp form) | 378 | ((consp form) |
| @@ -682,47 +616,52 @@ read-stream (typically as a symbol) where FORM occurred or nil. | |||
| 682 | 616 | ||
| 683 | The modification of FORM will be done by creating a new list | 617 | The modification of FORM will be done by creating a new list |
| 684 | form." | 618 | form." |
| 685 | (let* ((bare-ds (bare-symbol defining-symbol)) | 619 | ;; We need a proper list with at least the arglist present. |
| 686 | (cand-doc-string (nth 2 form)) | 620 | (if (and (proper-list-p form) |
| 687 | (doc-string | 621 | (cdr-safe form)) |
| 688 | (and (byte-run-valid-doc-string cand-doc-string) | 622 | (let* ((bare-ds (bare-symbol defining-symbol)) |
| 689 | cand-doc-string)) | 623 | (cand-doc-string (nth 2 form)) |
| 690 | (already-posified | 624 | (doc-string |
| 691 | (and doc-string | 625 | (and (byte-run-valid-doc-string cand-doc-string) |
| 692 | (cond | 626 | cand-doc-string)) |
| 693 | ((stringp doc-string) | 627 | (already-posified |
| 694 | (string-match "^;POS\036\001\001\001" doc-string)) | 628 | (and doc-string |
| 695 | ((stringp (car-safe (cdr-safe doc-string))) | 629 | (cond |
| 696 | (string-match "^;POS\036\001\001\001" | 630 | ((stringp doc-string) |
| 697 | (car (cdr doc-string)))) | 631 | (string-match "^;POS\036\001\001\001" doc-string)) |
| 632 | ((stringp (car-safe (cdr-safe doc-string))) | ||
| 633 | (string-match "^;POS\036\001\001\001" | ||
| 634 | (car (cdr doc-string)))) | ||
| 698 | ;;;; STOUGH TO AMEND WHEN APPROPRIATE, 2023-12-17 | 635 | ;;;; STOUGH TO AMEND WHEN APPROPRIATE, 2023-12-17 |
| 699 | (t t) ; For (:documentation 'symbol), in oclosures. | 636 | (t t) ; For (:documentation 'symbol), in oclosures. |
| 700 | ;;;; END OF STOUGH | 637 | ;;;; END OF STOUGH |
| 701 | ))) | 638 | ))) |
| 702 | (empty-body-allowed | 639 | (empty-body-allowed |
| 703 | (and bare-ds (get bare-ds 'empty-body-allowed))) | 640 | (and bare-ds (get bare-ds 'empty-body-allowed))) |
| 704 | (insert (or (null doc-string) | 641 | (insert (or (null doc-string) |
| 705 | (and (null empty-body-allowed) | 642 | (and (null empty-body-allowed) |
| 706 | (null (nthcdr 3 form)))))) | 643 | (null (nthcdr 3 form)))))) |
| 707 | 644 | ||
| 708 | (cond | 645 | (cond |
| 709 | ((and (null already-posified) | 646 | ((and (null already-posified) |
| 710 | (>= (length form) 2)) | 647 | (>= (length form) 2)) |
| 711 | (let ((new-doc-string (byte-run-posify-doc-string | 648 | (let ((new-doc-string (byte-run-posify-doc-string |
| 712 | doc-string | 649 | doc-string |
| 713 | position | 650 | position |
| 714 | lambda-read-stream))) | 651 | lambda-read-stream))) |
| 715 | (append | 652 | (append |
| 716 | (if byte-compile-in-progress | 653 | (if byte-compile-in-progress |
| 717 | (take 1 form) | 654 | (take 1 form) |
| 718 | (list 'lambda)) ; Strip the lambda of its position. | 655 | (list 'lambda)) ; Strip the lambda of its position. |
| 719 | (take 1 (cdr form)) | 656 | (take 1 (cdr form)) |
| 720 | (list new-doc-string) | 657 | (list new-doc-string) |
| 721 | (nthcdr (if insert 2 3) form)))) | 658 | (nthcdr (if insert 2 3) form)))) |
| 722 | ((and (null byte-compile-in-progress) | 659 | ((and (null byte-compile-in-progress) |
| 723 | (symbol-with-pos-p (car form))) | 660 | (symbol-with-pos-p (car form))) |
| 724 | (cons 'lambda (cdr form))) | 661 | (cons 'lambda (cdr form))) |
| 725 | (t form))))) | 662 | (t form))) |
| 663 | ;; We've got an invalid lambda form. Just return it. | ||
| 664 | form))) | ||
| 726 | 665 | ||
| 727 | (defalias 'function-put | 666 | (defalias 'function-put |
| 728 | ;; We don't want people to just use `put' because we can't conveniently | 667 | ;; We don't want people to just use `put' because we can't conveniently |
| @@ -740,39 +679,32 @@ So far, FUNCTION can only be a symbol, not a lambda expression." | |||
| 740 | ;; handle declarations in macro definitions and this is the first file | 679 | ;; handle declarations in macro definitions and this is the first file |
| 741 | ;; loaded by loadup.el that uses declarations in macros. We specify | 680 | ;; loaded by loadup.el that uses declarations in macros. We specify |
| 742 | ;; the values as named aliases so that `describe-variable' prints | 681 | ;; the values as named aliases so that `describe-variable' prints |
| 743 | ;; something useful; cf. Bug#40491. We can only use backquotes inside | 682 | ;; something useful; cf. Bug#40491. Backquotes can be used freely in |
| 744 | ;; the lambdas and not for those properties that are used by functions | 683 | ;; this file since 2024-06. |
| 745 | ;; loaded before backquote.el. | ||
| 746 | 684 | ||
| 747 | (defalias 'byte-run--set-advertised-calling-convention | 685 | (defalias 'byte-run--set-advertised-calling-convention |
| 748 | #'(lambda (f _args arglist when) | 686 | #'(lambda (f _args arglist when) |
| 749 | (list 'set-advertised-calling-convention | 687 | `(set-advertised-calling-convention ',f ',arglist ',when))) |
| 750 | (list 'quote f) (list 'quote arglist) (list 'quote when)))) | ||
| 751 | 688 | ||
| 752 | (defalias 'byte-run--set-obsolete | 689 | (defalias 'byte-run--set-obsolete |
| 753 | #'(lambda (f _args new-name when) | 690 | #'(lambda (f _args new-name when) |
| 754 | (list 'make-obsolete | 691 | `(make-obsolete ',f ',new-name ,when))) |
| 755 | (list 'quote f) (list 'quote new-name) when))) | ||
| 756 | 692 | ||
| 757 | (defalias 'byte-run--set-interactive-only | 693 | (defalias 'byte-run--set-interactive-only |
| 758 | #'(lambda (f _args instead) | 694 | #'(lambda (f _args instead) |
| 759 | (list 'function-put (list 'quote f) | 695 | `(function-put ',f 'interactive-only ',instead))) |
| 760 | ''interactive-only (list 'quote instead)))) | ||
| 761 | 696 | ||
| 762 | (defalias 'byte-run--set-pure | 697 | (defalias 'byte-run--set-pure |
| 763 | #'(lambda (f _args val) | 698 | #'(lambda (f _args val) |
| 764 | (list 'function-put (list 'quote f) | 699 | `(function-put ',f 'pure ',val))) |
| 765 | ''pure (list 'quote val)))) | ||
| 766 | 700 | ||
| 767 | (defalias 'byte-run--set-side-effect-free | 701 | (defalias 'byte-run--set-side-effect-free |
| 768 | #'(lambda (f _args val) | 702 | #'(lambda (f _args val) |
| 769 | (list 'function-put (list 'quote f) | 703 | `(function-put ',f 'side-effect-free ',val))) |
| 770 | ''side-effect-free (list 'quote val)))) | ||
| 771 | 704 | ||
| 772 | (defalias 'byte-run--set-important-return-value | 705 | (defalias 'byte-run--set-important-return-value |
| 773 | #'(lambda (f _args val) | 706 | #'(lambda (f _args val) |
| 774 | (list 'function-put (list 'quote f) | 707 | `(function-put ',f 'important-return-value ',val))) |
| 775 | ''important-return-value (list 'quote val)))) | ||
| 776 | 708 | ||
| 777 | (put 'compiler-macro 'edebug-declaration-spec | 709 | (put 'compiler-macro 'edebug-declaration-spec |
| 778 | '(&or symbolp ("lambda" &define lambda-list lambda-doc def-body))) | 710 | '(&or symbolp ("lambda" &define lambda-list lambda-doc def-body))) |
| @@ -801,51 +733,39 @@ So far, FUNCTION can only be a symbol, not a lambda expression." | |||
| 801 | 733 | ||
| 802 | (defalias 'byte-run--set-doc-string | 734 | (defalias 'byte-run--set-doc-string |
| 803 | #'(lambda (f _args pos) | 735 | #'(lambda (f _args pos) |
| 804 | (list 'function-put (list 'quote f) | 736 | `(function-put ',f 'doc-string-elt |
| 805 | ''doc-string-elt (if (numberp pos) | 737 | ,(if (numberp pos) pos `',pos)))) |
| 806 | pos | ||
| 807 | (list 'quote pos))))) | ||
| 808 | 738 | ||
| 809 | (defalias 'byte-run--set-indent | 739 | (defalias 'byte-run--set-indent |
| 810 | #'(lambda (f _args val) | 740 | #'(lambda (f _args val) |
| 811 | (list 'function-put (list 'quote f) | 741 | `(function-put ',f 'lisp-indent-function |
| 812 | ''lisp-indent-function (if (numberp val) | 742 | ,(if (numberp val) val `',val)))) |
| 813 | val | ||
| 814 | (list 'quote val))))) | ||
| 815 | 743 | ||
| 816 | (defalias 'byte-run--set-speed | 744 | (defalias 'byte-run--set-speed |
| 817 | #'(lambda (f _args val) | 745 | #'(lambda (f _args val) |
| 818 | (list 'function-put (list 'quote f) | 746 | `(function-put ',f 'speed ',val))) |
| 819 | ''speed (list 'quote val)))) | ||
| 820 | 747 | ||
| 821 | (defalias 'byte-run--set-safety | 748 | (defalias 'byte-run--set-safety |
| 822 | #'(lambda (f _args val) | 749 | #'(lambda (f _args val) |
| 823 | (list 'function-put (list 'quote f) | 750 | `(function-put ',f 'safety ',val))) |
| 824 | ''safety (list 'quote val)))) | ||
| 825 | 751 | ||
| 826 | (defalias 'byte-run--set-completion | 752 | (defalias 'byte-run--set-completion |
| 827 | #'(lambda (f _args val) | 753 | #'(lambda (f _args val) |
| 828 | (list 'function-put (list 'quote f) | 754 | `(function-put ',f 'completion-predicate #',val))) |
| 829 | ''completion-predicate (list 'function val)))) | ||
| 830 | 755 | ||
| 831 | (defalias 'byte-run--set-modes | 756 | (defalias 'byte-run--set-modes |
| 832 | #'(lambda (f _args &rest val) | 757 | #'(lambda (f _args &rest val) |
| 833 | (list 'function-put (list 'quote f) | 758 | `(function-put ',f 'command-modes ',val))) |
| 834 | ''command-modes (list 'quote val)))) | ||
| 835 | 759 | ||
| 836 | (defalias 'byte-run--set-interactive-args | 760 | (defalias 'byte-run--set-interactive-args |
| 837 | #'(lambda (f args &rest val) | 761 | #'(lambda (f args &rest val) |
| 838 | (setq args (remove '&optional (remove '&rest args))) | 762 | (setq args (remove '&optional (remove '&rest args))) |
| 839 | (list 'function-put (list 'quote f) | 763 | `(function-put ',f 'interactive-args |
| 840 | ''interactive-args | 764 | ',(mapcar (lambda (elem) |
| 841 | (list | 765 | (cons |
| 842 | 'quote | 766 | (seq-position args (car elem)) |
| 843 | (mapcar | 767 | (cadr elem))) |
| 844 | (lambda (elem) | 768 | val)))) |
| 845 | (cons | ||
| 846 | (seq-position args (car elem)) | ||
| 847 | (cadr elem))) | ||
| 848 | val))))) | ||
| 849 | 769 | ||
| 850 | (defalias 'byte-run--extract-sym-from-form | 770 | (defalias 'byte-run--extract-sym-from-form |
| 851 | #'(lambda (form args) | 771 | #'(lambda (form args) |
| @@ -961,93 +881,70 @@ an example of its use." | |||
| 961 | f def-index)) | 881 | f def-index)) |
| 962 | 882 | ||
| 963 | (cons | 883 | (cons |
| 964 | (list 'function-put (list 'quote f) | 884 | `(function-put ',f 'byte-run-defined-form |
| 965 | ''byte-run-defined-form | 885 | '(,def-index ,@(if doc-n (cons doc-index doc-n) |
| 966 | (list 'quote (cons def-index (if doc-n | 886 | doc-index))) |
| 967 | (cons doc-index doc-n) | 887 | `(progn |
| 968 | doc-index)))) | 888 | (or defining-symbol (setq defining-symbol ,def-spec)) |
| 969 | (list | 889 | (let* ((old-ds (and (byte-run-valid-doc-string ,doc-spec) |
| 970 | 'progn | 890 | ,doc-spec)) |
| 971 | (list 'or 'defining-symbol | 891 | (new-ds (byte-run-posify-doc-string old-ds))) |
| 972 | (list 'setq 'defining-symbol def-spec)) | 892 | ;; Strip the symbol position from the name being defined. |
| 973 | 893 | (if (null byte-compile-in-progress) | |
| 974 | (list 'let* | 894 | (setq ,def-arg-sym |
| 975 | (list | 895 | (byte-run-strip-symbol-positions ,def-arg-sym))) |
| 976 | (list 'old-ds | 896 | ;; Strip the symbol position from the name in the |
| 977 | (list 'and (list 'byte-run-valid-doc-string doc-spec) | 897 | ;; original form. |
| 978 | doc-spec)) | 898 | (if (and cur-evalled-macro-form |
| 979 | (list 'new-ds (list 'byte-run-posify-doc-string 'old-ds))) | 899 | (null byte-compile-in-progress)) |
| 980 | ;; Strip the symbol position from the name being defined. | 900 | (let ((stripped-arg |
| 981 | (list 'if '(null byte-compile-in-progress) | 901 | (byte-run-strip-symbol-positions |
| 982 | (list 'setq def-arg-sym | 902 | (nth ,def-index cur-evalled-macro-form)))) |
| 983 | (list 'byte-run-strip-symbol-positions | 903 | (setcar (nthcdr ,def-index cur-evalled-macro-form) |
| 984 | def-arg-sym))) | 904 | stripped-arg))) |
| 985 | ;; Strip the symbol position from the name in the | 905 | ,@(if empty-body-flag |
| 986 | ;; original form. | 906 | `((put ,def-spec 'empty-body-allowed t))) |
| 987 | (list 'if (list 'and 'cur-evalled-macro-form | 907 | ;; Replace the old doc string with the new, or |
| 988 | (list 'null 'byte-compile-in-progress)) | 908 | ;; insert the new. |
| 989 | (list | 909 | ,(cond |
| 990 | 'let | 910 | (can-insert-doc-before-rest |
| 991 | (list | 911 | `(if (byte-run-valid-doc-string old-ds) |
| 992 | (list 'stripped-arg | 912 | (setq ,doc-spec new-ds) |
| 993 | (list 'byte-run-strip-symbol-positions | 913 | ;; if `doc-spec' isn't a string, it's part of the body. |
| 994 | (list 'nth def-index | 914 | (setq ,body-spec (cons ,doc-spec ,body-spec)) |
| 995 | 'cur-evalled-macro-form)))) | 915 | (setq ,doc-spec new-ds))) |
| 996 | (list 'setcar (list 'nthcdr def-index | 916 | ((symbolp doc-spec) |
| 997 | 'cur-evalled-macro-form) | 917 | `(setq ,doc-spec new-ds)) |
| 998 | 'stripped-arg))) | 918 | (t `(setq ,doc-arg-sym |
| 999 | (if empty-body-flag | 919 | (append |
| 1000 | (list 'put def-spec ''empty-body-allowed t) | 920 | (take ,doc-n ,doc-arg-sym) |
| 1001 | (list 'progn)) | 921 | (cond |
| 1002 | ;; Replace the old doc string with the new, or | 922 | ;; doc-string present and a non-nil (cdr body): |
| 1003 | ;; insert the new. | 923 | ((and (byte-run-valid-doc-string ,doc-spec) |
| 1004 | (cond | 924 | ,after-doc-spec) |
| 1005 | (can-insert-doc-before-rest | 925 | (list new-ds)) |
| 1006 | (list 'if (list 'byte-run-valid-doc-string 'old-ds) | 926 | ;; Single string, both doc string and return value |
| 1007 | (list 'setq doc-spec 'new-ds) | 927 | ((byte-run-valid-doc-string ,doc-spec) |
| 1008 | ;; If `doc-spec' isn't a string, it's part of the body. | 928 | ,(if empty-body-flag |
| 1009 | (list 'setq body-spec | 929 | `(list new-ds) |
| 1010 | (list 'cons doc-spec body-spec)) | 930 | `(list new-ds old-ds))) |
| 1011 | (list 'setq doc-spec 'new-ds))) | 931 | ;; Neither doc string nor return value: |
| 1012 | ((symbolp doc-spec) | 932 | ((null (nthcdr ,doc-n ,doc-arg-sym)) |
| 1013 | (list 'setq doc-spec 'new-ds)) | 933 | ,(if empty-body-flag |
| 1014 | (t | 934 | `(list new-ds) |
| 1015 | (list | 935 | `(list new-ds 'nil))) |
| 1016 | 'setq doc-arg-sym | 936 | ;; No doc string, but a non-nil, non-string body. |
| 1017 | (list | 937 | (t (list new-ds ,doc-spec))) |
| 1018 | 'append | 938 | ,after-doc-spec)))))))))) |
| 1019 | (list 'take doc-n doc-arg-sym) | ||
| 1020 | (list | ||
| 1021 | 'cond | ||
| 1022 | ;; doc-string present and a non-nil (cdr body): | ||
| 1023 | (list (list 'and (list 'byte-run-valid-doc-string | ||
| 1024 | doc-spec) | ||
| 1025 | after-doc-spec) | ||
| 1026 | (list 'list 'new-ds)) | ||
| 1027 | ;; Single string, both doc string and return value: | ||
| 1028 | (list (list 'byte-run-valid-doc-string doc-spec) | ||
| 1029 | (if empty-body-flag | ||
| 1030 | (list 'list 'new-ds) | ||
| 1031 | (list 'list 'new-ds 'old-ds))) | ||
| 1032 | ;; Neither doc string nor return value: | ||
| 1033 | (list (list 'null (list 'nthcdr doc-n doc-arg-sym)) | ||
| 1034 | (if empty-body-flag | ||
| 1035 | (list 'list 'new-ds) | ||
| 1036 | (list 'list 'new-ds ''nil))) | ||
| 1037 | ;; No doc string, but a non-nil body, not a string. | ||
| 1038 | (list t | ||
| 1039 | (list 'list 'new-ds doc-spec))) | ||
| 1040 | after-doc-spec)))))))))) | ||
| 1041 | |||
| 1042 | (put 'byte-run--posify-defining-form 'byte-run-pre-form t) | 939 | (put 'byte-run--posify-defining-form 'byte-run-pre-form t) |
| 940 | |||
| 1043 | (defalias 'byte-run--set-function-type | 941 | (defalias 'byte-run--set-function-type |
| 1044 | #'(lambda (f _args val &optional f2) | 942 | #'(lambda (f _args val &optional f2) |
| 1045 | (when (and f2 (not (eq f2 f))) | 943 | (when (and f2 (not (eq f2 f))) |
| 1046 | (error | 944 | (error |
| 1047 | "`%s' does not match top level function `%s' inside function type \ | 945 | "`%s' does not match top level function `%s' inside function type \ |
| 1048 | declaration" f2 f)) | 946 | declaration" f2 f)) |
| 1049 | (list 'function-put (list 'quote f) | 947 | `(function-put ',f 'function-type ',val))) |
| 1050 | ''function-type (list 'quote val)))) | ||
| 1051 | 948 | ||
| 1052 | ;; Add any new entries to info node `(elisp)Declare Form'. | 949 | ;; Add any new entries to info node `(elisp)Declare Form'. |
| 1053 | (defvar defun-declarations-alist | 950 | (defvar defun-declarations-alist |
| @@ -1085,14 +982,12 @@ This is used by `declare'.") | |||
| 1085 | 982 | ||
| 1086 | (defalias 'byte-run--set-debug | 983 | (defalias 'byte-run--set-debug |
| 1087 | #'(lambda (name _args spec) | 984 | #'(lambda (name _args spec) |
| 1088 | (list 'progn :autoload-end | 985 | `(progn :autoload-end |
| 1089 | (list 'put (list 'quote name) | 986 | (put ',name 'edebug-form-spec ',spec)))) |
| 1090 | ''edebug-form-spec (list 'quote spec))))) | ||
| 1091 | 987 | ||
| 1092 | (defalias 'byte-run--set-no-font-lock-keyword | 988 | (defalias 'byte-run--set-no-font-lock-keyword |
| 1093 | #'(lambda (name _args val) | 989 | #'(lambda (name _args val) |
| 1094 | (list 'function-put (list 'quote name) | 990 | `(function-put ',name 'no-font-lock-keyword ',val))) |
| 1095 | ''no-font-lock-keyword (list 'quote val)))) | ||
| 1096 | 991 | ||
| 1097 | (defalias 'byte-run--parse-body | 992 | (defalias 'byte-run--parse-body |
| 1098 | #'(lambda (body allow-interactive) | 993 | #'(lambda (body allow-interactive) |
| @@ -1251,10 +1146,8 @@ interpreted according to `macro-declarations-alist'. | |||
| 1251 | (setq body (cons docstring body))) | 1146 | (setq body (cons docstring body))) |
| 1252 | (if (null body) | 1147 | (if (null body) |
| 1253 | (setq body '(nil))) | 1148 | (setq body '(nil))) |
| 1254 | (let* ((fun (list 'function (cons 'lambda (cons arglist body)))) | 1149 | (let* ((fun `(function (lambda ,arglist ,@body))) |
| 1255 | (def (list 'defalias | 1150 | (def `(defalias ',name (cons 'macro ,fun)))) |
| 1256 | (list 'quote name) | ||
| 1257 | (list 'cons ''macro fun)))) | ||
| 1258 | (if declarations | 1151 | (if declarations |
| 1259 | (cons 'prog1 (cons def (car declarations))) | 1152 | (cons 'prog1 (cons def (car declarations))) |
| 1260 | def)))))) | 1153 | def)))))) |
| @@ -1279,8 +1172,7 @@ INTERACTIVE is an optional `interactive' specification. | |||
| 1279 | (null (delq t (mapcar #'symbolp arglist))))) | 1172 | (null (delq t (mapcar #'symbolp arglist))))) |
| 1280 | (error "Malformed arglist: %s" arglist)) | 1173 | (error "Malformed arglist: %s" arglist)) |
| 1281 | (let* ((parse (byte-run--parse-body body t)) | 1174 | (let* ((parse (byte-run--parse-body body t)) |
| 1282 | (docstring | 1175 | (docstring (nth 0 parse)) |
| 1283 | (nth 0 parse)) | ||
| 1284 | (declare-form (nth 1 parse)) | 1176 | (declare-form (nth 1 parse)) |
| 1285 | (interactive-form (nth 2 parse)) | 1177 | (interactive-form (nth 2 parse)) |
| 1286 | (body | 1178 | (body |
| @@ -1299,11 +1191,7 @@ INTERACTIVE is an optional `interactive' specification. | |||
| 1299 | (setq body (cons docstring body))) | 1191 | (setq body (cons docstring body))) |
| 1300 | (if (null body) | 1192 | (if (null body) |
| 1301 | (setq body '(nil))) | 1193 | (setq body '(nil))) |
| 1302 | (let ((def (list 'defalias | 1194 | (let ((def `(defalias ',name (function (lambda ,arglist ,@body))))) |
| 1303 | (list 'quote name) | ||
| 1304 | (list 'function | ||
| 1305 | (cons 'lambda | ||
| 1306 | (cons arglist body)))))) | ||
| 1307 | (if declarations | 1195 | (if declarations |
| 1308 | (cons 'prog1 (cons def (car declarations))) | 1196 | (cons 'prog1 (cons def (car declarations))) |
| 1309 | def)))) | 1197 | def)))) |
| @@ -1649,7 +1537,7 @@ obsolete, for example a date or a release number." | |||
| 1649 | "Like `progn', but the body always runs interpreted (not compiled). | 1537 | "Like `progn', but the body always runs interpreted (not compiled). |
| 1650 | If you think you need this, you're probably making a mistake somewhere." | 1538 | If you think you need this, you're probably making a mistake somewhere." |
| 1651 | (declare (debug t) (indent 0) (obsolete nil "24.4")) | 1539 | (declare (debug t) (indent 0) (obsolete nil "24.4")) |
| 1652 | (list 'eval (list 'quote (if (cdr body) (cons 'progn body) (car body))))) | 1540 | `(eval ',(if (cdr body) `(progn ,@body) (car body)))) |
| 1653 | 1541 | ||
| 1654 | 1542 | ||
| 1655 | ;; interface to evaluating things at compile time and/or load time | 1543 | ;; interface to evaluating things at compile time and/or load time |
| @@ -1665,8 +1553,7 @@ constant. In interpreted code, this is entirely equivalent to | |||
| 1665 | not necessarily) computed at load time if eager macro expansion | 1553 | not necessarily) computed at load time if eager macro expansion |
| 1666 | is enabled." | 1554 | is enabled." |
| 1667 | (declare (debug (&rest def-form)) (indent 0)) | 1555 | (declare (debug (&rest def-form)) (indent 0)) |
| 1668 | (list 'quote (eval (cons 'progn (byte-run-posify-all-lambdas-etc body)) | 1556 | `',(eval `(progn ,@(byte-run-posify-all-lambdas body)) lexical-binding)) |
| 1669 | lexical-binding))) | ||
| 1670 | 1557 | ||
| 1671 | (defmacro eval-and-compile (&rest body) | 1558 | (defmacro eval-and-compile (&rest body) |
| 1672 | "Like `progn', but evaluates the body at compile time and at load time. | 1559 | "Like `progn', but evaluates the body at compile time and at load time. |
| @@ -1678,8 +1565,7 @@ enabled." | |||
| 1678 | ;; When the byte-compiler expands code, this macro is not used, so we're | 1565 | ;; When the byte-compiler expands code, this macro is not used, so we're |
| 1679 | ;; either about to run `body' (plain interpretation) or we're doing eager | 1566 | ;; either about to run `body' (plain interpretation) or we're doing eager |
| 1680 | ;; macroexpansion. | 1567 | ;; macroexpansion. |
| 1681 | (list 'quote (eval (cons 'progn (byte-run-posify-all-lambdas-etc body)) | 1568 | `',(eval `(progn ,@(byte-run-posify-all-lambdas body)) lexical-binding)) |
| 1682 | lexical-binding))) | ||
| 1683 | 1569 | ||
| 1684 | (defun with-no-warnings (&rest body) | 1570 | (defun with-no-warnings (&rest body) |
| 1685 | "Like `progn', but prevents compiler warnings in the body." | 1571 | "Like `progn', but prevents compiler warnings in the body." |
diff --git a/lisp/emacs-lisp/cl-generic.el b/lisp/emacs-lisp/cl-generic.el index 6bb8b9c027c..4891df63148 100644 --- a/lisp/emacs-lisp/cl-generic.el +++ b/lisp/emacs-lisp/cl-generic.el | |||
| @@ -632,7 +632,7 @@ See `byte-run--posify-def-form' in byte-run.el." | |||
| 632 | (cl-generic--method-qualifier-p (car ptr))) | 632 | (cl-generic--method-qualifier-p (car ptr))) |
| 633 | (setq ptr (cdr ptr)) | 633 | (setq ptr (cdr ptr)) |
| 634 | (setq i (1+ i))) | 634 | (setq i (1+ i))) |
| 635 | `(1 . (3 . ,i)))))) | 635 | `(3 . ,i))))) |
| 636 | 636 | ||
| 637 | (defun cl--generic-member-method (specializers qualifiers methods) | 637 | (defun cl--generic-member-method (specializers qualifiers methods) |
| 638 | (while | 638 | (while |
diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index ebd69aa631d..9d26dcb5583 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el | |||
| @@ -384,8 +384,8 @@ Assumes the caller has bound `macroexpand-all-environment'." | |||
| 384 | 384 | ||
| 385 | ;; `eval-when-compile' and `eval-and-compile' need their args expanded | 385 | ;; `eval-when-compile' and `eval-and-compile' need their args expanded |
| 386 | ;; first, in case there are any backquote constructs in them which | 386 | ;; first, in case there are any backquote constructs in them which |
| 387 | ;; would otherwise confuse the `byte-run-posify-all-lambdas-etc' calls | 387 | ;; would otherwise confuse the `byte-run-posify-all-lambdas' calls in |
| 388 | ;; in those macros. | 388 | ;; those macros. |
| 389 | (macroexpand (macroexp--all-forms form 1) | 389 | (macroexpand (macroexp--all-forms form 1) |
| 390 | macroexpand-all-environment)) | 390 | macroexpand-all-environment)) |
| 391 | 391 | ||
| @@ -473,8 +473,7 @@ Assumes the caller has bound `macroexpand-all-environment'." | |||
| 473 | 473 | ||
| 474 | (`(function . ,_) form) | 474 | (`(function . ,_) form) |
| 475 | (`(quote ,_arg) | 475 | (`(quote ,_arg) |
| 476 | (if (null byte-compile-in-progress) | 476 | (setq form (byte-run-posify-all-lambdas form)) |
| 477 | (setq form (byte-run-posify-all-lambdas-etc form))) | ||
| 478 | form) | 477 | form) |
| 479 | (`(,(and fun (or 'let 'let*)) . ,(or `(,bindings . ,body) | 478 | (`(,(and fun (or 'let 'let*)) . ,(or `(,bindings . ,body) |
| 480 | pcase--dontcare)) | 479 | pcase--dontcare)) |
diff --git a/lisp/loadup.el b/lisp/loadup.el index 05722dd0611..f18a70899b8 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el | |||
| @@ -129,6 +129,7 @@ | |||
| 129 | (defvar real-defvar (symbol-function 'defvar)) | 129 | (defvar real-defvar (symbol-function 'defvar)) |
| 130 | (fset 'defvar (symbol-function 'defvar-bootstrap)) | 130 | (fset 'defvar (symbol-function 'defvar-bootstrap)) |
| 131 | (load "emacs-lisp/debug-early") | 131 | (load "emacs-lisp/debug-early") |
| 132 | (load "emacs-lisp/backquote") | ||
| 132 | (load "emacs-lisp/byte-run") | 133 | (load "emacs-lisp/byte-run") |
| 133 | (byte-run-posify-existing-defaliases) | 134 | (byte-run-posify-existing-defaliases) |
| 134 | (byte-run-posify-existing-lambdas) | 135 | (byte-run-posify-existing-lambdas) |
| @@ -136,7 +137,6 @@ | |||
| 136 | ;; (makunbound 'early-lambda-lists) | 137 | ;; (makunbound 'early-lambda-lists) |
| 137 | (setq early-lambda-lists nil) ; We don't want its symbols with | 138 | (setq early-lambda-lists nil) ; We don't want its symbols with |
| 138 | ; position in the dumped image. | 139 | ; position in the dumped image. |
| 139 | (load "emacs-lisp/backquote") | ||
| 140 | (load "subr") | 140 | (load "subr") |
| 141 | (load "keymap") | 141 | (load "keymap") |
| 142 | 142 | ||
| @@ -180,11 +180,11 @@ | |||
| 180 | ;;;; END OF NEW STOUGH | 180 | ;;;; END OF NEW STOUGH |
| 181 | 181 | ||
| 182 | (load "emacs-lisp/debug-early") | 182 | (load "emacs-lisp/debug-early") |
| 183 | (load "emacs-lisp/backquote") | ||
| 183 | (load "emacs-lisp/byte-run") | 184 | (load "emacs-lisp/byte-run") |
| 184 | (message "loadup.el, just after second load of byte-run.el.") | 185 | (message "loadup.el, just after second load of byte-run.el.") |
| 185 | (message "loadup.el, just after setting base-loaded to t") | 186 | (message "loadup.el, just after setting base-loaded to t") |
| 186 | (unintern 'base-loaded nil) ; So that it can't be messed with from Lisp. | 187 | (unintern 'base-loaded nil) ; So that it can't be messed with from Lisp. |
| 187 | (load "emacs-lisp/backquote") | ||
| 188 | ;; Second loading of these files to clear out symbols with positions from | 188 | ;; Second loading of these files to clear out symbols with positions from |
| 189 | ;; lambda symbols. This absolutely requires macroexp.el. | 189 | ;; lambda symbols. This absolutely requires macroexp.el. |
| 190 | ;; In the second loading, we make `internal-macroexpand-for-load' unbound so | 190 | ;; In the second loading, we make `internal-macroexpand-for-load' unbound so |
diff --git a/test/lisp/emacs-lisp/backtrace-tests.el b/test/lisp/emacs-lisp/backtrace-tests.el index 3248403078f..17c6b8592c9 100644 --- a/test/lisp/emacs-lisp/backtrace-tests.el +++ b/test/lisp/emacs-lisp/backtrace-tests.el | |||
| @@ -225,12 +225,14 @@ | |||
| 225 | (ert-deftest backtrace-tests--single-and-multi-line () | 225 | (ert-deftest backtrace-tests--single-and-multi-line () |
| 226 | "Forms in backtrace frames can be on a single line or on multiple lines." | 226 | "Forms in backtrace frames can be on a single line or on multiple lines." |
| 227 | (ert-with-test-buffer (:name "single-multi-line") | 227 | (ert-with-test-buffer (:name "single-multi-line") |
| 228 | (let* ((arg '(lambda (x) ; Quote this so it isn't made into a closure. | 228 | (let* ((arg |
| 229 | ;; Make the form long enough so `number' should not | 229 | (byte-run-strip-lambda-doc |
| 230 | ;; appear on the first line once pretty-printed. | 230 | '(lambda (x) ; Quote this so it isn't made into a closure. |
| 231 | (interactive (region-beginning)) | 231 | ;; Make the form long enough so `number' should not |
| 232 | (let ((number (1+ x))) | 232 | ;; appear on the first line once pretty-printed. |
| 233 | (+ x number)))) | 233 | (interactive (region-beginning)) |
| 234 | (let ((number (1+ x))) | ||
| 235 | (+ x number))))) | ||
| 234 | (header-string "Test header: ") | 236 | (header-string "Test header: ") |
| 235 | (header (format "%s%s\n" header-string arg)) | 237 | (header (format "%s%s\n" header-string arg)) |
| 236 | (insert-header-function (lambda () | 238 | (insert-header-function (lambda () |
diff --git a/test/lisp/emacs-lisp/cconv-tests.el b/test/lisp/emacs-lisp/cconv-tests.el index 5bbade0ae6e..11fe7b0ab32 100644 --- a/test/lisp/emacs-lisp/cconv-tests.el +++ b/test/lisp/emacs-lisp/cconv-tests.el | |||
| @@ -179,8 +179,9 @@ | |||
| 179 | (cconv-closure-convert | 179 | (cconv-closure-convert |
| 180 | '#'(lambda (x) (let ((f #'(lambda () (+ x 1)))) | 180 | '#'(lambda (x) (let ((f #'(lambda () (+ x 1)))) |
| 181 | (funcall f))))) | 181 | (funcall f))))) |
| 182 | (byte-run-strip-lambda-doc | ||
| 182 | '#'(lambda (x) (let ((f #'(lambda (x) (+ x 1)))) | 183 | '#'(lambda (x) (let ((f #'(lambda (x) (+ x 1)))) |
| 183 | (funcall f x))))) | 184 | (funcall f x)))))) |
| 184 | 185 | ||
| 185 | ;; Bug#30872. | 186 | ;; Bug#30872. |
| 186 | (should | 187 | (should |
| @@ -216,10 +217,11 @@ | |||
| 216 | (cconv-closure-convert | 217 | (cconv-closure-convert |
| 217 | '#'(lambda (x) | 218 | '#'(lambda (x) |
| 218 | #'(lambda () x))))) | 219 | #'(lambda () x))))) |
| 219 | '#'(lambda (x) | 220 | (byte-run-strip-lambda-doc |
| 220 | (internal-make-closure | 221 | '#'(lambda (x) |
| 221 | nil (x) nil | 222 | (internal-make-closure |
| 222 | (internal-get-closed-var 0))))) | 223 | nil (x) nil |
| 224 | (internal-get-closed-var 0)))))) | ||
| 223 | 225 | ||
| 224 | ;; Basic case: | 226 | ;; Basic case: |
| 225 | (should (equal (byte-run-strip-lambda-doc (cconv-tests--intern-all | 227 | (should (equal (byte-run-strip-lambda-doc (cconv-tests--intern-all |
| @@ -228,22 +230,24 @@ | |||
| 228 | (let ((f #'(lambda () x))) | 230 | (let ((f #'(lambda () x))) |
| 229 | (let ((x 'b)) | 231 | (let ((x 'b)) |
| 230 | (list x (funcall f)))))))) | 232 | (list x (funcall f)))))))) |
| 231 | '#'(lambda (x) | 233 | (byte-run-strip-lambda-doc |
| 232 | (let ((f #'(lambda (x) x))) | 234 | '#'(lambda (x) |
| 233 | (let ((x 'b) | 235 | (let ((f #'(lambda (x) x))) |
| 234 | (closed-x x)) | 236 | (let ((x 'b) |
| 235 | (list x (funcall f closed-x))))))) | 237 | (closed-x x)) |
| 238 | (list x (funcall f closed-x)))))))) | ||
| 236 | (should (equal (byte-run-strip-lambda-doc (cconv-tests--intern-all | 239 | (should (equal (byte-run-strip-lambda-doc (cconv-tests--intern-all |
| 237 | (cconv-closure-convert | 240 | (cconv-closure-convert |
| 238 | '#'(lambda (x) | 241 | '#'(lambda (x) |
| 239 | (let ((f #'(lambda () x))) | 242 | (let ((f #'(lambda () x))) |
| 240 | (let* ((x 'b)) | 243 | (let* ((x 'b)) |
| 241 | (list x (funcall f)))))))) | 244 | (list x (funcall f)))))))) |
| 242 | '#'(lambda (x) | 245 | (byte-run-strip-lambda-doc |
| 243 | (let ((f #'(lambda (x) x))) | 246 | '#'(lambda (x) |
| 244 | (let* ((closed-x x) | 247 | (let ((f #'(lambda (x) x))) |
| 245 | (x 'b)) | 248 | (let* ((closed-x x) |
| 246 | (list x (funcall f closed-x))))))) | 249 | (x 'b)) |
| 250 | (list x (funcall f closed-x)))))))) | ||
| 247 | 251 | ||
| 248 | ;; With the lambda-lifted shadowed variable also being captured: | 252 | ;; With the lambda-lifted shadowed variable also being captured: |
| 249 | (should (equal (byte-run-strip-lambda-doc | 253 | (should (equal (byte-run-strip-lambda-doc |
| @@ -254,13 +258,14 @@ | |||
| 254 | (let ((f #'(lambda () x))) | 258 | (let ((f #'(lambda () x))) |
| 255 | (let ((x 'a)) | 259 | (let ((x 'a)) |
| 256 | (list x (funcall f))))))))) | 260 | (list x (funcall f))))))))) |
| 257 | '#'(lambda (x) | 261 | (byte-run-strip-lambda-doc |
| 258 | (internal-make-closure | 262 | '#'(lambda (x) |
| 259 | nil (x) nil | 263 | (internal-make-closure |
| 260 | (let ((f #'(lambda (x) x))) | 264 | nil (x) nil |
| 261 | (let ((x 'a) | 265 | (let ((f #'(lambda (x) x))) |
| 262 | (closed-x (internal-get-closed-var 0))) | 266 | (let ((x 'a) |
| 263 | (list x (funcall f closed-x)))))))) | 267 | (closed-x (internal-get-closed-var 0))) |
| 268 | (list x (funcall f closed-x))))))))) | ||
| 264 | (should (equal (byte-run-strip-lambda-doc | 269 | (should (equal (byte-run-strip-lambda-doc |
| 265 | (cconv-tests--intern-all | 270 | (cconv-tests--intern-all |
| 266 | (cconv-closure-convert | 271 | (cconv-closure-convert |
| @@ -269,13 +274,14 @@ | |||
| 269 | (let ((f #'(lambda () x))) | 274 | (let ((f #'(lambda () x))) |
| 270 | (let* ((x 'a)) | 275 | (let* ((x 'a)) |
| 271 | (list x (funcall f))))))))) | 276 | (list x (funcall f))))))))) |
| 272 | '#'(lambda (x) | 277 | (byte-run-strip-lambda-doc |
| 273 | (internal-make-closure | 278 | '#'(lambda (x) |
| 274 | nil (x) nil | 279 | (internal-make-closure |
| 275 | (let ((f #'(lambda (x) x))) | 280 | nil (x) nil |
| 276 | (let* ((closed-x (internal-get-closed-var 0)) | 281 | (let ((f #'(lambda (x) x))) |
| 277 | (x 'a)) | 282 | (let* ((closed-x (internal-get-closed-var 0)) |
| 278 | (list x (funcall f closed-x)))))))) | 283 | (x 'a)) |
| 284 | (list x (funcall f closed-x))))))))) | ||
| 279 | ;; With lambda-lifted shadowed variable also being mutably captured: | 285 | ;; With lambda-lifted shadowed variable also being mutably captured: |
| 280 | (should (equal (byte-run-strip-lambda-doc | 286 | (should (equal (byte-run-strip-lambda-doc |
| 281 | (cconv-tests--intern-all | 287 | (cconv-tests--intern-all |
| @@ -286,16 +292,17 @@ | |||
| 286 | (setq x x) | 292 | (setq x x) |
| 287 | (let ((x 'a)) | 293 | (let ((x 'a)) |
| 288 | (list x (funcall f))))))))) | 294 | (list x (funcall f))))))))) |
| 289 | '#'(lambda (x) | 295 | (byte-run-strip-lambda-doc |
| 290 | (let ((x (list x))) | 296 | '#'(lambda (x) |
| 291 | (internal-make-closure | 297 | (let ((x (list x))) |
| 292 | nil (x) nil | 298 | (internal-make-closure |
| 293 | (let ((f #'(lambda (x) (car-safe x)))) | 299 | nil (x) nil |
| 294 | (setcar (internal-get-closed-var 0) | 300 | (let ((f #'(lambda (x) (car-safe x)))) |
| 295 | (car-safe (internal-get-closed-var 0))) | 301 | (setcar (internal-get-closed-var 0) |
| 296 | (let ((x 'a) | 302 | (car-safe (internal-get-closed-var 0))) |
| 297 | (closed-x (internal-get-closed-var 0))) | 303 | (let ((x 'a) |
| 298 | (list x (funcall f closed-x))))))))) | 304 | (closed-x (internal-get-closed-var 0))) |
| 305 | (list x (funcall f closed-x)))))))))) | ||
| 299 | (should (equal (byte-run-strip-lambda-doc | 306 | (should (equal (byte-run-strip-lambda-doc |
| 300 | (cconv-tests--intern-all | 307 | (cconv-tests--intern-all |
| 301 | (cconv-closure-convert | 308 | (cconv-closure-convert |
| @@ -305,16 +312,17 @@ | |||
| 305 | (setq x x) | 312 | (setq x x) |
| 306 | (let* ((x 'a)) | 313 | (let* ((x 'a)) |
| 307 | (list x (funcall f))))))))) | 314 | (list x (funcall f))))))))) |
| 308 | '#'(lambda (x) | 315 | (byte-run-strip-lambda-doc |
| 309 | (let ((x (list x))) | 316 | '#'(lambda (x) |
| 310 | (internal-make-closure | 317 | (let ((x (list x))) |
| 311 | nil (x) nil | 318 | (internal-make-closure |
| 312 | (let ((f #'(lambda (x) (car-safe x)))) | 319 | nil (x) nil |
| 313 | (setcar (internal-get-closed-var 0) | 320 | (let ((f #'(lambda (x) (car-safe x)))) |
| 314 | (car-safe (internal-get-closed-var 0))) | 321 | (setcar (internal-get-closed-var 0) |
| 315 | (let* ((closed-x (internal-get-closed-var 0)) | 322 | (car-safe (internal-get-closed-var 0))) |
| 316 | (x 'a)) | 323 | (let* ((closed-x (internal-get-closed-var 0)) |
| 317 | (list x (funcall f closed-x))))))))) | 324 | (x 'a)) |
| 325 | (list x (funcall f closed-x)))))))))) | ||
| 318 | ;; Lambda-lifted variable that isn't actually captured where it is shadowed: | 326 | ;; Lambda-lifted variable that isn't actually captured where it is shadowed: |
| 319 | (should (equal (byte-run-strip-lambda-doc | 327 | (should (equal (byte-run-strip-lambda-doc |
| 320 | (cconv-tests--intern-all | 328 | (cconv-tests--intern-all |
| @@ -324,13 +332,14 @@ | |||
| 324 | (h #'(lambda () (setq x x)))) | 332 | (h #'(lambda () (setq x x)))) |
| 325 | (let ((x 'b)) | 333 | (let ((x 'b)) |
| 326 | (list x (funcall g) (funcall h)))))))) | 334 | (list x (funcall g) (funcall h)))))))) |
| 327 | '#'(lambda (x) | 335 | (byte-run-strip-lambda-doc |
| 328 | (let ((x (list x))) | 336 | '#'(lambda (x) |
| 329 | (let ((g #'(lambda (x) (car-safe x))) | 337 | (let ((x (list x))) |
| 330 | (h #'(lambda (x) (setcar x (car-safe x))))) | 338 | (let ((g #'(lambda (x) (car-safe x))) |
| 331 | (let ((x 'b) | 339 | (h #'(lambda (x) (setcar x (car-safe x))))) |
| 332 | (closed-x x)) | 340 | (let ((x 'b) |
| 333 | (list x (funcall g closed-x) (funcall h closed-x)))))))) | 341 | (closed-x x)) |
| 342 | (list x (funcall g closed-x) (funcall h closed-x))))))))) | ||
| 334 | (should (equal (byte-run-strip-lambda-doc | 343 | (should (equal (byte-run-strip-lambda-doc |
| 335 | (cconv-tests--intern-all | 344 | (cconv-tests--intern-all |
| 336 | (cconv-closure-convert | 345 | (cconv-closure-convert |
| @@ -339,14 +348,14 @@ | |||
| 339 | (h #'(lambda () (setq x x)))) | 348 | (h #'(lambda () (setq x x)))) |
| 340 | (let* ((x 'b)) | 349 | (let* ((x 'b)) |
| 341 | (list x (funcall g) (funcall h)))))))) | 350 | (list x (funcall g) (funcall h)))))))) |
| 342 | '#'(lambda (x) | 351 | (byte-run-strip-lambda-doc |
| 343 | (let ((x (list x))) | 352 | '#'(lambda (x) |
| 344 | (let ((g #'(lambda (x) (car-safe x))) | 353 | (let ((x (list x))) |
| 345 | (h #'(lambda (x) (setcar x (car-safe x))))) | 354 | (let ((g #'(lambda (x) (car-safe x))) |
| 346 | (let* ((closed-x x) | 355 | (h #'(lambda (x) (setcar x (car-safe x))))) |
| 347 | (x 'b)) | 356 | (let* ((closed-x x) |
| 348 | (list x (funcall g closed-x) (funcall h closed-x)))))))) | 357 | (x 'b)) |
| 349 | ) | 358 | (list x (funcall g closed-x) (funcall h closed-x)))))))))) |
| 350 | 359 | ||
| 351 | (ert-deftest cconv-tests-interactive-closure-bug51695 () | 360 | (ert-deftest cconv-tests-interactive-closure-bug51695 () |
| 352 | (let ((f (let ((d 51695)) | 361 | (let ((f (let ((d 51695)) |
| @@ -384,10 +393,11 @@ | |||
| 384 | (prefix-numeric-value current-prefix-arg) | 393 | (prefix-numeric-value current-prefix-arg) |
| 385 | 'toggle))) | 394 | 'toggle))) |
| 386 | (ignore arg)))) | 395 | (ignore arg)))) |
| 387 | (if (cadr (nth 2 (cadr f)))) | 396 | (f2 (byte-run-strip-lambda-doc f)) |
| 397 | (if (cadr (nth 2 (cadr f2)))) | ||
| 388 | (if2)) | 398 | (if2)) |
| 389 | (cconv-closure-convert f) | 399 | (cconv-closure-convert f2) |
| 390 | (setq if2 (cadr (nth 2 (cadr f)))) | 400 | (setq if2 (cadr (nth 2 (cadr f2)))) |
| 391 | (should (eq if if2)))) | 401 | (should (eq if if2)))) |
| 392 | 402 | ||
| 393 | (provide 'cconv-tests) | 403 | (provide 'cconv-tests) |
diff --git a/test/lisp/erc/erc-tests.el b/test/lisp/erc/erc-tests.el index 561e4577d8b..a2a5bcc831c 100644 --- a/test/lisp/erc/erc-tests.el +++ b/test/lisp/erc/erc-tests.el | |||
| @@ -169,11 +169,12 @@ | |||
| 169 | (byte-run-strip-lambda-doc | 169 | (byte-run-strip-lambda-doc |
| 170 | (macroexpand-1 | 170 | (macroexpand-1 |
| 171 | '(erc--with-dependent-type-match (repeat face) erc-match))) | 171 | '(erc--with-dependent-type-match (repeat face) erc-match))) |
| 172 | '(backquote-list* | 172 | (byte-run-strip-lambda-doc |
| 173 | 'repeat :match (lambda (w v) | 173 | '(backquote-list* |
| 174 | (require 'erc-match) | 174 | 'repeat :match (lambda (w v) |
| 175 | (widget-editable-list-match w v)) | 175 | (require 'erc-match) |
| 176 | '(face))))) | 176 | (widget-editable-list-match w v)) |
| 177 | '(face)))))) | ||
| 177 | 178 | ||
| 178 | (ert-deftest erc--doarray () | 179 | (ert-deftest erc--doarray () |
| 179 | (let ((array "abcdefg") | 180 | (let ((array "abcdefg") |