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)
	(byte-compile-read-position nil)
	(byte-compile-last-position nil)
	;; 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)
	;; 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 allows us to get the positions of symbols read; it's
	;; new in Emacs 22.1.
	(read-with-symbol-positions inbuffer)
	(read-symbol-positions-list nil)
	;;	  #### This is bound in b-c-close-variables.
	;;	  (byte-compile-warnings byte-compile-warnings)
	)
    (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
	(and byte-compile-current-file
	     (byte-compile-insert-header byte-compile-current-file
                                         byte-compile--outbuffer))
	(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)))
	  (setq byte-compile-read-position (point)
		byte-compile-last-position byte-compile-read-position)
          (let* ((lread--unescaped-character-literals nil)
                 (form (read inbuffer))
                 (warning (byte-run--unescaped-character-literals-warning)))
            (when warning (byte-compile-warn "%s" warning))
	    (byte-compile-toplevel-file-form form)))
	;; Compile pending forms at end of file.
	(byte-compile-flush-pending)
	;; Make warnings about unresolved functions
	;; give the end of the file as their position.
	(setq byte-compile-last-position (point-max))
	(byte-compile-warn-about-unresolved-functions)))
     byte-compile--outbuffer)))