Function: byte-compile-fdefinition

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

Signature

(byte-compile-fdefinition NAME MACRO-P)

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/bytecomp.el.gz
;;; sanity-checking arglists

(defun byte-compile-fdefinition (name macro-p)
  ;; If a function has an entry saying (FUNCTION . t).
  ;; that means we know it is defined but we don't know how.
  ;; If a function has an entry saying (FUNCTION . nil),
  ;; that means treat it as not defined.
  (let* ((list (if macro-p
		   byte-compile-macro-environment
		 byte-compile-function-environment))
	 (env (cdr (assq name list))))
    (or env
	(let ((fn name))
	  (while (and (symbolp fn)
		      (fboundp fn)
		      (or (symbolp (symbol-function fn))
			  (consp (symbol-function fn))
			  (and (not macro-p)
			       (compiled-function-p (symbol-function fn)))))
	    (setq fn (symbol-function fn)))
          (let ((advertised (get-advertised-calling-convention
                             (if (and (symbolp fn) (fboundp fn))
                                 ;; Could be a subr.
                                 (symbol-function fn)
                               fn))))
            (cond
             ((listp advertised)
              (if macro-p
                  `(macro lambda ,advertised)
                `(lambda ,advertised)))
             ((and (not macro-p) (compiled-function-p fn)) fn)
             ((not (consp fn)) nil)
             ((eq 'macro (car fn)) (cdr fn))
             (macro-p nil)
             ((eq 'autoload (car fn)) nil)
             (t fn)))))))