Function: advice--make

advice--make is a byte-compiled function defined in nadvice.el.gz.

Signature

(advice--make HOW FUNCTION MAIN PROPS)

Documentation

Build a function value that adds FUNCTION to MAIN at HOW.

HOW is a symbol to select an entry in advice--how-alist.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/nadvice.el.gz
(defun advice--make (how function main props)
  "Build a function value that adds FUNCTION to MAIN at HOW.
HOW is a symbol to select an entry in `advice--how-alist'."
  (let ((fd (or (cdr (assq 'depth props)) 0))
        (md (if (advice--p main)
                (or (cdr (assq 'depth (advice--props main))) 0))))
    (if (and md (> fd md))
        ;; `function' should go deeper.
        (let ((rest (advice--make how function (advice--cdr main) props)))
          (advice--cons main rest))
      (let ((proto (assq how advice--how-alist)))
        (unless proto (error "Unknown add-function location `%S'" how))
        (advice--copy (cadr proto)
                      function main how props)))))