Function: byte-compile-from-buffer

byte-compile-from-buffer is a byte-compiled function defined in bytecomp.el.gz.

Signature

(byte-compile-from-buffer INBUFFER)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/bytecomp.el.gz
(defun byte-compile-from-buffer (inbuffer)
  (let ((byte-compile-current-buffer inbuffer)
	;; Prevent truncation of flonums and lists as we read and print them
	(float-output-format nil)
	(case-fold-search nil)
	(print-length nil)
	(print-level nil)
        (print-symbols-bare t)
	;; Prevent edebug from interfering when we compile
	;; and put the output into a file.
;;      (edebug-all-defs nil)
;;      (edebug-all-forms nil)
	;; Simulate entry to byte-compile-top-level
        (byte-compile-jump-tables nil)
        (byte-compile-constants nil)
	(byte-compile-variables nil)
	(byte-compile-tag-number 0)
	(byte-compile-depth 0)
	(byte-compile-maxdepth 0)
	(byte-compile-output nil)
	;;	  #### This is bound in b-c-close-variables.
	;;	  (byte-compile-warnings byte-compile-warnings)
        (symbols-with-pos-enabled t))
    (byte-compile-close-variables
     (with-current-buffer
         (setq byte-compile--outbuffer
               (get-buffer-create
                (concat " *Compiler Output*"
                        (if (<= byte-compile-level 1) ""
                          (format "-%s" (1- byte-compile-level))))))
       (set-buffer-multibyte t)
       (erase-buffer)
       ;;	 (emacs-lisp-mode)
       (setq case-fold-search nil))
     (displaying-byte-compile-warnings
      (with-current-buffer inbuffer
	(when byte-compile-current-file
	  (byte-compile-insert-header byte-compile-current-file
                                      byte-compile--outbuffer)
          ;; Instruct native-comp to ignore this file.
          (when (bound-and-true-p no-native-compile)
            (with-current-buffer byte-compile--outbuffer
              (insert
               "(when (boundp 'comp--no-native-compile)
  (puthash load-file-name t comp--no-native-compile))\n\n"))))
	(goto-char (point-min))
	;; Should we always do this?  When calling multiple files, it
	;; would be useful to delay this warning until all have been
	;; compiled.  A: Yes!  b-c-u-f might contain dross from a
	;; previous byte-compile.
	(setq byte-compile-unresolved-functions nil)
        (setq byte-compile-noruntime-functions nil)
        (setq byte-compile-new-defuns nil)
        (when byte-native-compiling
          (defvar native-comp-speed)
          (push `(native-comp-speed . ,native-comp-speed) byte-native-qualities)
          (defvar native-comp-debug)
          (push `(native-comp-debug . ,native-comp-debug) byte-native-qualities)
          (defvar native-comp-compiler-options)
          (push `(native-comp-compiler-options . ,native-comp-compiler-options)
                byte-native-qualities)
          (defvar native-comp-driver-options)
          (push `(native-comp-driver-options . ,native-comp-driver-options)
                byte-native-qualities)
          (defvar no-native-compile)
          (push `(no-native-compile . ,no-native-compile)
                byte-native-qualities))

	;; Compile the forms from the input buffer.
	(while (progn
		 (while (progn (skip-chars-forward " \t\n\^l")
			       (= (following-char) ?\;))
		   (forward-line 1))
		 (not (eobp)))
          (let* ((lread--unescaped-character-literals nil)
                 ;; Don't bind `load-read-function' to
                 ;; `read-positioning-symbols' here.  Calls to `read'
                 ;; at a lower level must not get symbols with
                 ;; position.
                 (form (read-positioning-symbols inbuffer))
                 (warning (byte-run--unescaped-character-literals-warning)))
            (when warning (byte-compile-warn-x form "%s" warning))
	    (byte-compile-toplevel-file-form form)))
	;; Compile pending forms at end of file.
	(byte-compile-flush-pending)
	(byte-compile-warn-about-unresolved-functions)))
     byte-compile--outbuffer)))