aboutsummaryrefslogtreecommitdiffstats
path: root/test/lisp
diff options
context:
space:
mode:
authorStefan Monnier2017-07-14 00:32:34 -0400
committerNoam Postavsky2017-08-07 18:54:49 -0400
commitcc30d77ecdd1b9155ade3d0656a84a0839ee2795 (patch)
treea0b0c1180b8152284d10420d4189eb7cebdbc7d7 /test/lisp
parent00f7e31110a27e568529192d7441d9631b9096bc (diff)
downloademacs-cc30d77ecdd1b9155ade3d0656a84a0839ee2795.tar.gz
emacs-cc30d77ecdd1b9155ade3d0656a84a0839ee2795.zip
Let `define-symbol-prop' take effect during compilation
* src/fns.c (syms_of_fns): New variable `overriding-plist-environment'. (Fget): Consult it. * lisp/emacs-lisp/bytecomp.el (byte-compile-close-variables): Let-bind it to nil. (byte-compile-define-symbol-prop): New function, handles compilation of top-level `define-symbol-prop' and `function-put' calls by putting the symbol setting into `overriding-plist-environment'. Co-authored-by: Noam Postavsky <npostavs@gmail.com>
Diffstat (limited to 'test/lisp')
-rw-r--r--test/lisp/emacs-lisp/bytecomp-tests.el17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/lisp/emacs-lisp/bytecomp-tests.el b/test/lisp/emacs-lisp/bytecomp-tests.el
index d15bd8b6e65..8ef2ce70251 100644
--- a/test/lisp/emacs-lisp/bytecomp-tests.el
+++ b/test/lisp/emacs-lisp/bytecomp-tests.el
@@ -545,6 +545,23 @@ literals (Bug#20852)."
545This functionality has been obsolete for more than 10 years already 545This functionality has been obsolete for more than 10 years already
546and will be removed soon. See (elisp)Backquote in the manual."))))))) 546and will be removed soon. See (elisp)Backquote in the manual.")))))))
547 547
548
549(ert-deftest bytecomp-tests-function-put ()
550 "Check `function-put' operates during compilation."
551 (should (boundp 'lread--old-style-backquotes))
552 (bytecomp-tests--with-temp-file source
553 (dolist (form '((function-put 'bytecomp-tests--foo 'foo 1)
554 (function-put 'bytecomp-tests--foo 'bar 2)
555 (defmacro bytecomp-tests--foobar ()
556 `(cons ,(function-get 'bytecomp-tests--foo 'foo)
557 ,(function-get 'bytecomp-tests--foo 'bar)))
558 (defvar bytecomp-tests--foobar 1)
559 (setq bytecomp-tests--foobar (bytecomp-tests--foobar))))
560 (print form (current-buffer)))
561 (write-region (point-min) (point-max) source nil 'silent)
562 (byte-compile-file source t)
563 (should (equal bytecomp-tests--foobar (cons 1 2)))))
564
548;; Local Variables: 565;; Local Variables:
549;; no-byte-compile: t 566;; no-byte-compile: t
550;; End: 567;; End: