Function: ad-should-compile

ad-should-compile is a byte-compiled function defined in advice.el.gz.

Signature

(ad-should-compile FUNCTION COMPILE)

Documentation

Return non-nil if the advised FUNCTION should be compiled.

If COMPILE is non-nil and not a negative number then it returns t. If COMPILE is a negative number then it returns nil. If COMPILE is nil then the result depends on the value of ad-default-compilation-action (which see).

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/advice.el.gz
;; @@ Activation and definition handling:
;; ======================================

(defun ad-should-compile (function compile)
  "Return non-nil if the advised FUNCTION should be compiled.
If COMPILE is non-nil and not a negative number then it returns t.
If COMPILE is a negative number then it returns nil.
If COMPILE is nil then the result depends on the value of
`ad-default-compilation-action' (which see)."
  (cond
   ;; Don't compile until the real function definition is known (bug#12965).
   ((not (ad-real-orig-definition function)) nil)
   ((integerp compile) (>= compile 0))
   (compile)
   ((eq ad-default-compilation-action 'never) nil)
   ((eq ad-default-compilation-action 'always) t)
   ((eq ad-default-compilation-action 'like-original)
    (or (subrp (ad-get-orig-definition function))
        (ad-compiled-p (ad-get-orig-definition function))))
   ;; everything else means `maybe':
   (t (featurep 'byte-compile))))