diff options
| author | Vibhav Pant | 2023-03-01 15:04:34 +0530 |
|---|---|---|
| committer | Vibhav Pant | 2023-03-01 15:04:34 +0530 |
| commit | 0040737e4f1b58caf865857019337a80c1d3371c (patch) | |
| tree | c74a49a95139dc647b4724dd4cb7b3a6b124b729 /test | |
| parent | 522b82118de77e33bd701853b6aa7dfda19b11fc (diff) | |
| download | emacs-fix/bug-60974.tar.gz emacs-fix/bug-60974.zip | |
Don't modify interactive closures destructively (Bug#60974).fix/bug-60974
* lisp/emacs-lisp/cconv.el (cconv-convert): When form is an
interactive lambda form, don't destructively modify it, as it might be
a constant literal. Instead, create a new list with the relevant
place(s) changed.
* test/lisp/emacs-lisp/cconv-tests.el
(cconv-tests-interactive-form-modify-bug60974): New test.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/emacs-lisp/cconv-tests.el | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/cconv-tests.el b/test/lisp/emacs-lisp/cconv-tests.el index 349ffeb7e47..6facd3452ea 100644 --- a/test/lisp/emacs-lisp/cconv-tests.el +++ b/test/lisp/emacs-lisp/cconv-tests.el | |||
| @@ -376,6 +376,18 @@ | |||
| 376 | (eval '(lambda (x) :closure-dont-trim-context (+ x 1)) | 376 | (eval '(lambda (x) :closure-dont-trim-context (+ x 1)) |
| 377 | `((y . ,magic-string))))))) | 377 | `((y . ,magic-string))))))) |
| 378 | 378 | ||
| 379 | (ert-deftest cconv-tests-interactive-form-modify-bug60974 () | ||
| 380 | (let* ((f '(function (lambda (&optional arg) | ||
| 381 | (interactive | ||
| 382 | (list (if current-prefix-arg | ||
| 383 | (prefix-numeric-value current-prefix-arg) | ||
| 384 | 'toggle))) | ||
| 385 | (ignore arg)))) | ||
| 386 | (if (cadr (nth 2 (cadr f)))) | ||
| 387 | (if2)) | ||
| 388 | (cconv-closure-convert f) | ||
| 389 | (setq if2 (cadr (nth 2 (cadr f)))) | ||
| 390 | (should (eq if if2)))) | ||
| 379 | 391 | ||
| 380 | (provide 'cconv-tests) | 392 | (provide 'cconv-tests) |
| 381 | ;;; cconv-tests.el ends here | 393 | ;;; cconv-tests.el ends here |