From 6c9acd13d0d2aa181d21bf78d6530b3399520533 Mon Sep 17 00:00:00 2001 From: Andrea Corallo Date: Sun, 8 Dec 2019 20:52:34 +0100 Subject: [PATCH] single function native compilation doc + interactive support + tests --- lisp/emacs-lisp/comp.el | 4 +++- test/src/comp-tests.el | 10 +++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el index ffd4985301e..0f0a90c82fb 100644 --- a/lisp/emacs-lisp/comp.el +++ b/lisp/emacs-lisp/comp.el @@ -420,7 +420,9 @@ Put PREFIX in front of it." "Byte compile FUNCTION-NAME spilling data from the byte compiler." (let* ((f (symbol-function function-name)) (func (make-comp-func :name function-name - :c-name (comp-c-func-name function-name"F")))) + :c-name (comp-c-func-name function-name"F") + :doc (documentation f) + :int-spec (interactive-form f)))) (when (byte-code-function-p f) (signal 'native-compiler-error "can't native compile an already bytecompiled function")) diff --git a/test/src/comp-tests.el b/test/src/comp-tests.el index 230d5bfbdaf..82a30424d09 100644 --- a/test/src/comp-tests.el +++ b/test/src/comp-tests.el @@ -328,10 +328,18 @@ Check that the resulting binaries do not differ." (ert-deftest comp-tests-free-fun () "Check we are able to compile a single function." (defun comp-tests-free-fun-f () + "Some doc." + (interactive) 3) (load (native-compile #'comp-tests-free-fun-f)) + (should (subr-native-elisp-p (symbol-function #'comp-tests-free-fun-f))) - (should (= (comp-tests-free-fun-f) 3))) + (should (= (comp-tests-free-fun-f) 3)) + (should (string= (documentation #'comp-tests-free-fun-f) + "Some doc.")) + (should (commandp #'comp-tests-free-fun-f)) + (should (equal (interactive-form #'comp-tests-free-fun-f) + '(interactive)))) ;;;;;;;;;;;;;;;;;;;;