Function: compile-defun
compile-defun is an autoloaded, interactive and byte-compiled function
defined in bytecomp.el.gz.
Signature
(compile-defun &optional ARG)
Documentation
Compile and evaluate the current top-level form.
Print the result in the echo area. With argument ARG, insert value in current buffer after the form.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/emacs-lisp/bytecomp.el.gz
;;; compiling a single function
;;;###autoload
(defun compile-defun (&optional arg)
"Compile and evaluate the current top-level form.
Print the result in the echo area.
With argument ARG, insert value in current buffer after the form."
(interactive "P")
(save-excursion
(end-of-defun)
(beginning-of-defun)
(let* ((print-symbols-bare t) ; For the final `message'.
(byte-compile-current-file (current-buffer))
(byte-compile-current-buffer (current-buffer))
(start-read-position (point))
(byte-compile-last-warned-form 'nothing)
(symbols-with-pos-enabled t)
(value (eval
(displaying-byte-compile-warnings
(byte-compile-sexp
(let ((form (read-positioning-symbols (current-buffer))))
(push form byte-compile-form-stack)
(eval-sexp-add-defvars
form
start-read-position))))
lexical-binding)))
(cond (arg
(message "Compiling from buffer... done.")
(prin1 value (current-buffer))
(insert "\n"))
((message "%s" (prin1-to-string value)))))))